RedrawWindow not working :(

Archives Forums/Win32 Discussion/RedrawWindow not working :(

Picklesworth(Posted 2005) [#1]
I am using the api_RedrawWindow function in User32.decls (Blitz3d).

The declaration is as follows:
.lib "user32.dll"
*snip*
api_RedrawWindow% (hwnd%, lprcUpdate*, hrgnUpdate%, fuRedraw%) : "RedrawWindow"
*snip*

When I compile, I get an MAV.
That function is not repeated anywhere else, and the stuff on the right of the colon is the exact same as is given by DumpBin.


My intent is to have a button lose and gain focus, and be properly updated so that the changes are visible. This works, but the button isn't redrawn... thus, I use redraw window and it causes a crash.

I have had a few other User32.decls functions do this, and I just switched to their alternative. (I seem to have a whole bunch of functions in there without underscores that are identical to the ones with). For example, api_GetMessage crashed, but apiGetMessage worked.

Here is my B3d source:
Function DisableWindow(hWnd)
	Local style
	style=apiGetWindowLong(hWnd,GWL_STYLE)
	style=style Or WS_DISABLED
	apiSetWindowLong(hWnd,GWL_STYLE,style)
	api_RedrawWindow(hWnd,0,0,-268)
End Function

Function EnableWindow(hWnd)
	Local style
	style=apiGetWindowLong(hWnd,GWL_STYLE)
	style=style And ~WS_DISABLED
	apiSetWindowLong(hWnd,GWL_STYLE,style)
	api_RedrawWindow(hWnd,0,0,-268)
End Function



TartanTangerine (was Indiepath)(Posted 2005) [#2]
You might try looking at InvalidateRect or InvalidateRgn to force redraw of an area.


Picklesworth(Posted 2005) [#3]
It works!
Thanks :D

It's amazing how many functions they can make that look idetical, but all work completely differently...


TartanTangerine (was Indiepath)(Posted 2005) [#4]
Glad I could help.