Solved

Closing a window

Posted on 1998-08-10
5
148 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 50 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

816 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now