Click to See Complete Forum and Search --> : destroy another window
conan
July 30th, 1999, 03:52 AM
Hi!
I want to destroy another windows.
I coded it.
==================================
HWND hWnd;
hWnd = ::FindWindow(NULL,"test");
::DestroyWindow(hWnd);
==================================
But I can't destroy "test window".
What's wrong there? or How do I destroy window?
Buy..^-^ <: <: ....
Burlacu Ovidiu
July 30th, 1999, 04:16 AM
I'm not sure will work but try this:
HWND hWnd;
hWnd = ::FindWindow(NULL,"test");
CWnd* pWnd = FromHandle( hWnd );
if( NULL != pWnd )
{
::DestroyWindow(hWnd);
delete pWnd;
}
Let me know if this help you
Regards,
Ovidiu
ChristianM
July 30th, 1999, 07:40 AM
u can try this but i thinks that is the same..
PostMessage(hWnd,WM_DESTROY,NULL,NULL);
i found it in MSDN : "A thread cannot use DestroyWindow to destroy a window created by a different thread."
maybe for your is better to use this if u want close other window..:
PostQuitMessage(hWnd,WM_CLOSE,NULL,NULL);
cube01
July 30th, 1999, 08:30 AM
This works jus' fine fer me....
CString strTitle = "Input your title here"
HWND hWnd;
hWnd = ::FindWindow(strTitle);
::PostMessage(hWnd,WM_CLOSE,NULL,NULL);
ChristianM
July 30th, 1999, 08:33 AM
yep its that.. i made mistake.. sorry..
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.