Article ID: 168204 - Last Review: July 1, 2004 - Revision: 3.1 How To Kill an Application with System Menu Using VBThis article was previously published under Q168204 On This PageSUMMARY
Microsoft Visual Basic for Windows can use the Microsoft Windows API
SendMessage function to close any active window that has a system menu
(referred to as the Control Box within Visual Basic for Windows) with the
Close option.
MORE INFORMATION
This sample program uses the Windows API SendMessage function to post a
message to any window in the environment, provided the handle to the window
is known. The API FindWindow function is used to determine the handle
associated with the window the user wants to close. To use FindWindow, you
must know either the ClassName or the Caption (if any) of that window.
Please see the REFERENCES section below for more information.
Steps to Create Example Program
REFERENCES
For more information on the FindWindow and SendMessage functions, query on
the following words in the Microsoft Knowledge Base:
FindWindow and Visual Basic or SendMessage and Visual Basic
For information on a different sample application that returns assorted information for a windowed application, please see the following article in the Microsoft Knowledge Base: 112649
(http://support.microsoft.com/kb/112649/EN-US/
)
: How to Get a Window's Class Name and Other Window Attributes
APPLIES TO
| Article Translations
|
Back to the top
