Passing WM_PAINT to dll from EXE
-
I'm trying to have my EXE pass an WM_PAINT message to a dll with no luck. The last idea I had was to use the following m_SpellCastingBar.SendMessage(WM_PAINT); however this did not work as well. I have tried Invalidating the rectangle however I'm not sure if I'm even reaching the dll with this call as the WM_PAINT message is not getting retrieved by the dll. Might there be something I am missing? Thanks! "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."
-
I'm trying to have my EXE pass an WM_PAINT message to a dll with no luck. The last idea I had was to use the following m_SpellCastingBar.SendMessage(WM_PAINT); however this did not work as well. I have tried Invalidating the rectangle however I'm not sure if I'm even reaching the dll with this call as the WM_PAINT message is not getting retrieved by the dll. Might there be something I am missing? Thanks! "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."
You should not pass WM_PAINT messages to windows. Windows will ignore them anyway. Windows only generates paint messages itself if the message queue for that thread is empty. Even then the target window needs to have an invalid area on it window rect for a paint message to be generated. When you were looking to invalidate the rect of the window that is more along the lines of what you need to do. If you want to force a repaint of the window use the RedrawWindow function. Here is an example.
m_SpellCastingBar.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_UPDATENOW);
The first two nulls indicate that you want the entire window to be updated. The flags say that you are invalidating the update region of your window because you can validate the window as well and prevent WM_PAINT messages from being called. RDW_NOERASE says do not generate a WM_ERASEBKGND message, and the RDW_UPDATENOW flag says expedite this request, and send the WM_PAINT message before the function call ends. Coincidentally, these two function calls will do the equivalent of the RedrawWindow function above.
m_SpellCastingBar.InvalidateRect(NULL);
m_SpellCastingBar.UpdateWindow();
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!