Closing a window

Im having trouble closing certain windows with vb5. By closing I mean like right clicking x top right of window.

This closes notepad  but not internet explorer?
 lRes = SendMessage(CleanHousehWnd, WM_CLOSE, 0, 0)
How could I close internet explorer?
 
This only minimizes windows
 lRes = SendMessageLong(CleanHousehWnd, WM_QUIT, 0, 0)  

I am trying to automate quiting all applications.
harryqAsked:
Who is Participating?
 
peterwestConnect With a Mentor Commented:
Hi,

Glad to hear that it worked - it took me a while to figure out how to achieve this aim; when I was looking into the problem the manuals said I needed to send a WM_CLOSE to the window - unfortunately they didn't explain which command to use to send the message.

Glad to hear it works for you.

Pete
0
 
peterwestCommented:
Hi there,

Try using PostMessage instead of SendMessage

Pete

0
 
a111a111a111Commented:
Where is the reference to "CleanHousehWnd" ?

Shay.
0
 
harryqAuthor Commented:
pete, postmessage does it, finally, thanks,
answer for points.
0
 
harryqAuthor Commented:
Shay, just the name for the hwnd to close, thanks for help
0
All Courses

From novice to tech pro — start learning today.