Check validity of HWND after window is closed?
-
Hi I have a VC++6 application in which I continuously update the display for a certain time after the user clicks a button. I accomplished this by creating a separate thread the sends a message to the window via the window's HWND. This way, my app won't 'hang' when the user switches window. However, when this thread is still active, there's a possibility that the user may close the window, invalidating its HWND. Is there a way for the thread to check whether the HWND is still valid? Thanks!
-
Hi I have a VC++6 application in which I continuously update the display for a certain time after the user clicks a button. I accomplished this by creating a separate thread the sends a message to the window via the window's HWND. This way, my app won't 'hang' when the user switches window. However, when this thread is still active, there's a possibility that the user may close the window, invalidating its HWND. Is there a way for the thread to check whether the HWND is still valid? Thanks!
First off, don't use
SendMessage
to send messages from a thread to a window, usePostMessage
to post them instead. To check if a window is still valid useIsWindow(HWND)
.
[
](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!