Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by poojo hackma
Tue, 27 Feb 2007 19:23
Sending WM_PAINT parameters
Author: poojo hackma
Date: Tue, 27 Feb 2007 19:23
Date: Tue, 27 Feb 2007 19:23
15 lines
1379 bytes
1379 bytes
I've got a thread that needs to send a paint message back to the parent. Right now, I am using: SendMessage(hParent, WM_PAINT, (WPARAM)0, (LPARAM)0); It works, but it does not repaint the entire region. The InvalidateRgn (API?) takes a BOOL bErase parameter that forces the background to erase before painting. How can I modify either WPARAM or LPARAM so that my WM_PAINT message will force my OnPaint event handler to repaint the entire region? Thanks, PJ
Re: Sending WM_PAINT parameters
Author: poojo hackma
Date: Tue, 27 Feb 2007 19:53
Date: Tue, 27 Feb 2007 19:53
11 lines
1351 bytes
1351 bytes
My mistake! I just found that I should *never* use SendMessage (or PostMessage) with WM_PAINT. I found a different way to handle this by using an Invalidate() from within my main thread then calling UpdateWindow(hParent) from my other thread. Sorry for taking up your time. Don't worry. I'm sure I'll have other stupid questions to ask.
Re: Sending WM_PAINT parameters
Author: danzer
Date: Tue, 27 Feb 2007 22:09
Date: Tue, 27 Feb 2007 22:09
25 lines
1664 bytes
1664 bytes
poojo hackma wrote: > My mistake! > > I just found that I should *never* use SendMessage (or PostMessage) with > WM_PAINT. > > I found a different way to handle this by using an Invalidate() from within > my main thread then calling UpdateWindow(hParent) from my other thread. > > Sorry for taking up your time. > > Don't worry. I'm sure I'll have other stupid questions to ask. > > Using hParent in your "other thread" is not thread-safe. See Gambit's explanation to me. http://groups.google.com/group/borland.public.cppbuilder.vcl.components.using/browse_thread/thread/10b36291929e5d80/1cdbd4452defe29c?lnk=st&q=&rnum=6&hl=en#1cdbd4452defe29c or http://tinyurl.com/2yunb5 Danzer
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads