Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close one program Open another

Status
Not open for further replies.

AlanArons

Programmer
Aug 1, 2002
91
US
I have two separate programs both compiled exes. I would like to click a button on one and have the window minimize (this is not my problem) and at the same time have the other program which is typically running maximize.

Is there a command (WinAPI?) that will allow me to do this?

Your help is appreciated

Alan Arons[ponder]
 
Did you know captions of both applications you want to manage?
If yes you could use:
FindWindow()
and ShowWindow() APIs to Maximise and Minimise windows:
Code:
#define SW_SHOWNORMAL       1
#define SW_SHOWMINIMIZED    2
#define SW_SHOWMAXIMIZED    3
ChangeWindowState([Application1], SW_SHOWMINIMIZED)
ChangeWindowState([Application2], SW_SHOWMAXIMIZED)


FUNCTION ChangeWindowState(lcCaption, lnState)
    DECLARE INTEGER FindWindow IN WIN32API STRING, STRING
    DECLARE INTEGER ShowWindow IN WIN32API INTEGER, INTEGER
    LOCAL lnHwnd
    lnHwnd = FindWindow(NULL,lcCaption)
    IF lnHwnd > 0
       ShowWindow(lnHwnd, lnState)
    ENDIF
RETURN
Something like that. Not tested

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top