Link to home
Start Free TrialLog in
Avatar of c0ldfyr3
c0ldfyr3Flag for Ireland

asked on

EM_GETEVENTMASK and WM_SETREDRAW on a Visual Basic 6 form not working.

Howdy folks,

I've been trying to stop a form from updating while it loads and filters a set of record sets.
The code I'm using is as follows...

Dim iEventMask as Integer
iEventMask = SendMessage(frmGeneric.hwnd, EM_GETEVENTMASK, 0, 0&)
Call SendMessage(frmGeneric.hwnd, WM_SETREDRAW, 0, 0&)
'DO STUFF
Call SendMessage(frmGeneric.hwnd, EM_SETEVENTMASK, 0, iEventMask)
Call SendMessage(frmGeneric.hwnd, WM_SETREDRAW, 1, 0&)

All of my declarations are correct, I tried using the last param of SendMessage as both Long and Any and both have the same results which are iEventMask being 0 after the get and the form not re-painting after the last statement. The only way I can refresh it is by dragging it off the screen and back on again. frmGeneric.Refresh doesn't work.

Any help would be gratefully appreciated!
Avatar of JohnBPrice
JohnBPrice

hmmm, using the WinAPI seems like overkill.  Normally I just ensure that the form is loaded before my apps call form.show.

But if you are using the API, I'd suggest you try using InvalidateRect to ask windows to repaint the form.
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of c0ldfyr3

ASKER

I found this http://www.vbaccelerator.com/home/vb/Tips/Force_An_Area_of_a_Window_To_Repaint/article.asp

So I called RepaintWindow frmGenric after I unsuccesfully set redraw 1 and it still doesn't repaint it >.<
Thanks Idle_Mind, worked like a charm :)