Solved

Using SendMessage to minimise another app

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
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…
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…

771 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

10 Experts available now in Live!

Get 1:1 Help Now