views:

677

answers:

2

Hi

I'm an old hand at embedded programming but new to CE and having a lot of trouble doing reasonably simple things, because I am not familiar with the API and struggling to understand the obscure MSDN docs.

All I want to do is minimize and maximise two separate applications that are running from one of the applications.

E.g. Application A decides that now it is time for it to appear and then minimises application B (App B being a third party application e.g. Notepad, no access to source code etc) and then at a later stage maximising B and minimising itself.

Application A would be written by myself.

I'm sure this must be very simple, but where to find answers.. :)

Thanks in advance. EOI

+1  A: 

Firstly you will need to locate the window handle (hwnd) using the FindWindow API function or some alternate means. Next use the ShowWindow API function specifying either SW_HIDE or SW_SHOW to hide or show the window respectively. Note that Windows CE 5.0 does not technically support the Win32 window states like SW_MINIMIZE, SW_MAXIMIZE, etc.

A simple example would be:

HWND hWnd = ::FindWindow( _T("Notepad"), NULL); 
::ShowWindow(hWnd, SW_HIDE);
Craig Nicholson
A: 

You may also find SetForegroundWindow and SetWindowPos useful.

This is how I've used them to show and hide applications:

SetWindowPos(windowToHide, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);
SetWindowPos(windowToShowInFullScreen, HWND_TOP, 0, 0, 240, 320, SWP_SHOWWINDOW);
SetForegroundWindow(windowToShow);
kgiannakakis