|
-
Sep 25th, 2002, 02:43 PM
#1
Thread Starter
Junior Member
How can I close an application and receive QueryUnload event
I like to close application via an API call.
I think it is possible using the PostMessage API, but all examples use WM_Close, for example:
RetVal = PostMessage(winHwnd, WM_CLOSE, 0&, 0&)
This always results in immediatly closing the application without the form_QueryUnload and form_unload events taking place.
So unfinished business stays unfinished.
The application I like to close needs to have the ability to reject my request to close it. Hence I need the Query_unload event.
Thanks for answer.
-
Sep 25th, 2002, 03:25 PM
#2
Software Eng.
try:
SendMessage hwnd, WM_SYSCOMMAND, SC_CLOSE, 0
-
Sep 25th, 2002, 04:25 PM
#3
Thread Starter
Junior Member
Correct my previous statement.
Although I have tested this problem many times (I always had the same results), Microsoft does use WM_CLOSE in an (now) excellent example.
For those who are interested, it has the code Q242308 and can be found on their site. (try this url: http://support.microsoft.com/default...;en-us;Q242308)
-
Sep 26th, 2002, 09:28 AM
#4
Software Eng.
So WM_CLOSE worked?
-
Sep 27th, 2002, 05:38 AM
#5
Thread Starter
Junior Member
Yep, but what I don't know, why it did not work previously.
Ah well...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|