Solved

Using SendMessage to minimise another app

Posted on 2002-04-16
4
1,307 Views
Last Modified: 2008-03-17
Hi all,

I'm trying to co-ordinate the windows of a multi-exe application.

From one exe, I can launch another exe (via Shell(), and work out the hWnd from the PID) and then kill it again using SendMessage(hWnd, WM_CLOSE).

What I want to do is minimise the windows of both exe at the same time (eg, when one is minimised, it tells the other one to minimise as well).

I can't find a suitable WM_ message in the API.
Suggestions anyone?
0
Comment
Question by:FaffMan
4 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 100 total points
ID: 6944861
Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_MINIMIZE = 6

Call ShowWindow(hWnd, SW_MINIMIZE)
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6944869
try this :

Declare Function CloseWindow& Lib "user32" (ByVal hwnd As Long)

Minimizes the specified window. The window is not destroyed.


p.s you can shell with minimize option.
0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 6944872
CloseWindow

VB Declaration

Declare Function CloseWindow& Lib "user32" (ByVal hwnd As Long)

Description

Minimizes the specified window. The window is not destroyed.

Use with VB

Use the WindowState property to minimize VB forms.

Parameter     Type/Description
hwnd     Long—Handle of the window to minimize.

Return Value
Long – Nonzero on success, zero on failure. Sets GetLastError.

Platform

Windows 95, Windows NT, Win16

Comments

This function has no effect on popup and child windows.

All of the material presented here is copyrighted by either Desaware or Macmillan. No part of this material may be used or reproduced in any fashion (except in brief quotations used in critical articles and reviews) without prior consent.
0
 

Author Comment

by:FaffMan
ID: 6944907
Nice one! Exactly what I needed.

I assumed (incorrectly...) that there would be a WM_MINIMIZE, like the WM_CLOSE.

Thanks very much to everyone who contributed.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel object stays open 19 71
Getting warning: You are about to delete 1 row(s) 9 43
Visual Studio 2005 text editor 10 35
Problem to With line 4 43
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

864 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

24 Experts available now in Live!

Get 1:1 Help Now