user32: redrawwindow

BlitzPlus Forums/BlitzPlus Programming/user32: redrawwindow

I was having a gander at some user32.dll stuff and I found this redrawwindow command. When Ive tried to get it working it crashes blitz out. Anybody know the correct way to get it working?

Thanks

Mr Brinne

Well, it works fine for me, though doesn't seem terribly useful. How are you calling it?

I am interested in this. Any examples?

the blitz code I'm calling is so:

w = CreateWindow("", 100,100,200,200,0)
redrawwindow(queryobject(w, 1), 0, 0, 0)

I also tried:

w = CreateWindow("", 100,100,200,200,0)
redrawwindow(queryobject(w, 1), 0, 0, 1)

It has to be said I couldn't find the values for the flags RDW_.... not even in the massive list of win32 consts posted by defiance:

http://www.blitzbasic.com/codearcs/codearcs.php?code=589#comments

The user32.decls line is declared like so:

RedrawWindow%(hwnd%, lprcupdate*, hrgnupdate%, furedraw%)

my suspicions are it is either

a) dodgy flag setup
b) somat to do with lprcupdate* bit of the redrawwindow line in user32.decls

Mr Brine

Yes, you're right.

Issue #1:
Change the lprcupdate* in the declaration to lprcupdate%. You want to do this since you're passing NULL (0). The way it is now, Blitz is trying to dereference 0 (get the value at address 0), and you're getting a memory access violation. It will work fine after that, you'll see.

Issue #2:
Yes the list of Windows constants isn't so complete as many think. You can see at the bottom of the doc page that the RDW* constants are actually defined in windows.h (or possibly winuser.h). Those are included with VC++ or the Windows Platform SDK (free, if you can find it on MS' site -- I can't). Just open up the .h file and search for the names. I would do it for you except my personal system is running a disk diagnosis right now so I can't look at it. You might also have luck looking on google.

Please post this when you have a working demo!

Incidentally, here are the RedrawWindow flags:


#define RDW_INVALIDATE 0x0001
#define RDW_INTERNALPAINT 0x0002
#define RDW_ERASE 0x0004

#define RDW_VALIDATE 0x0008
#define RDW_NOINTERNALPAINT 0x0010
#define RDW_NOERASE 0x0020

#define RDW_NOCHILDREN 0x0040
#define RDW_ALLCHILDREN 0x0080

#define RDW_UPDATENOW 0x0100
#define RDW_ERASENOW 0x0200

#define RDW_FRAME 0x0400
#define RDW_NOFRAME 0x0800


Of course, replace "#define" with "Const", and "0x" with "=$".