Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Closing a window

Posted on 1998-08-10
5
Medium Priority
?
166 Views
Last Modified: 2010-04-30
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.
0
Comment
Question by:harryq
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:peterwest
ID: 1468502
Hi there,

Try using PostMessage instead of SendMessage

Pete

0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1468503
Where is the reference to "CleanHousehWnd" ?

Shay.
0
 

Author Comment

by:harryq
ID: 1468504
pete, postmessage does it, finally, thanks,
answer for points.
0
 

Author Comment

by:harryq
ID: 1468505
Shay, just the name for the hwnd to close, thanks for help
0
 
LVL 2

Accepted Solution

by:
peterwest earned 200 total points
ID: 1468506
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question