Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Closing a window

Posted on 1998-08-10
5
Medium Priority
?
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

670 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