Quick question:
How can i destroy a window that has been created by another thread?
Posted on 2001-12-20 15:45:37 by darester
Use DestroyWindow function. This function uses as parameter the handle of the window you wanna destroy.
Posted on 2001-12-20 17:31:16 by CodeLover
Use DestroyWindow function.

Or, if you want to be a lot nicer, send a WM_CLOSE message to that window :) DestroyWindow cannot be used to kill a window created in another thread.
Posted on 2001-12-20 22:03:03 by sluggy
Woot, my post counter just hit triple figures :alright:
Posted on 2001-12-20 22:04:12 by sluggy
you can't use DestroyWindow to destroy a window that was created by another thread. that's why i'm asking how to do that. if it was that easy... :p
Posted on 2001-12-21 03:42:04 by darester
that's why i'm asking how to do that.

Go back and read my post.... Use SendMessage to post a WM_QUIT or WM_CLOSE message to the window which you want to close.

If you do not have the handle to the window, there is a variety of functions you can use to find it, like FindWindow, GetWindow, EnumWindows, or EnumChildWindows.
Posted on 2001-12-21 05:07:14 by sluggy
thanks a lot. it works fine now :p
Posted on 2001-12-21 12:40:34 by darester