Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Using SendMessage to minimise another app

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…

829 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