Solved

Using SendMessage to minimise another app

Posted on 2002-04-16
4
1,313 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

770 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