Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using SendMessage to minimise another app

Posted on 2002-04-16
4
Medium Priority
?
1,355 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 400 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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

971 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