Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WSH to close specific windows by window title?
Message
From
04/08/2000 10:32:00
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00400866
Message ID:
00401053
Views:
19
>>>< snipped >
>>>>
>>>>WM_QUIT should tell the App to shut down, as opposed to WM_CLOSE, which tells the Window to close. Closing the top-level Window of an SDI app through WM_CLOSE should shut it down; WM_CLOSE to an MDI app shuts down the Window, but can leave other top-levels running.
>>>
>>>Thanks. I tried this on Outlook and SDK Help so my guess is both are SDI applications. Although, I still don't know why they didn't QUIT. Mystery of nature...
WM_QUIT
>>The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero.
>>
>>A window receives this message through its WindowProc function.

>>BTW, the recommendation is to use PostQuitMessage() rather than PostMessage().
>
>After some more reading and some more testing, it seems SendMessage doesn't add a message to the message queue, it expects something to be listening 100% of the time to act on it. For whatever reason, the WindowProc function ignored repeated messages of this type. It prcessed them because control did return to my program and I did get the expected return value of 0.
>
>The WM_CLOSE message appears to be a proactive message that tells a window it needs to do something.
>
>Also, I was playing with the PostMessage and PostQuitMessage. It appears that PostQuitMessage is scoped to the current thread. If you want to quit your app from within your app, then use PostQuitMessage otherwise, use PostMessage with the WM_QUIT meesage. This does work to kill the application.

Yep.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform