PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Minimize acting strange

I would like to know if I'm doing or assuming something wrong here. I'm working on an ipaq pocket pc and I took a sample code project (GapiDraw35RC1Eval\samples\win32\Simple\evc4) and replaced the code in ProcessNextFrame with this:

Code:

HRESULT CMyApplication::ProcessNextFrame(CGapiSurface* pBackBuffer, DWORD dwFlags)
{
static bool onOne = true;

if (onOne)
{
TCHAR szBuffer[_MAX_PATH];
OPENFILENAME lpOfn;

memset(&lpOfn;, 0, sizeof(OPENFILENAME));
szBuffer[0] = '\0';
lpOfn.lStructSize = sizeof(OPENFILENAME);
lpOfn.lpstrFile = szBuffer;
lpOfn.hwndOwner = m_hWnd;

GetOpenFileName(&lpOfn;);

onOne = false;
}


return S_OK;
}


The open browser opens - however I have this problem:

When the open dialog is closed by cancel or choosing a file, my application is not restored.

Please, can anyone help me...
Does my question not make sense or does no one have an answer?
What happens is that your application looses focus when you bring up the FileOpen dialog. If you check the source code to GapiApplication.cpp in WinProc you will see that the application then will halt all rendering to the display once focus is lost.

You need to restore focus to the application once you are done with your dialog.
Thanks for replying - I carefully traced through the message loop and found the problem.

If anyone cares:
When the GetOpenFileName function is called, Minimize() is called which sets m_bAppShouldMinimize = TRUE, but then theres a wait for GetOpenFileName to finish(press cancel or select a file) which causes the WM_USER_MINIMIZE message to not be posted until after the open file dialog is closed. So all I do now is set m_bAppShouldMinimize = FALSE after GetOpenFileName.

If anyone is still listening - my real problem however are shell windows which create a new process and then run on their own. Since the minimize button doesn't have a message I never know when the shell window is closed and cannot tell my application to begin drawing again. I was told to try subclassing the taskbar and find when the minimize button rectangle is hit - but I can't get it to be subclassed........

I attached a small (9kB) windows ce 4.0 project which just sets up a basic window and tries to subclass the taskbar that if anyone would look at I would be quite grateful as I'm very stuck at this point.
Attachments:
SubClassTheTaskBar.zip (10 KB)
doesn't anyone want a challenge?
Please help
Would money inspire anyone to help with this problem?
Johan already answered your question: simply restore focus to your main window when the dialog is dismissed.

ie: ShowWindow( hwnd, SW_SHOWNORMAL );
I wish that was all it was, I suppose I should have started a new message. I got the problem with the common dialog box worked out with what he said, however I also need to create new processes to start iexplore.exe and peghelp.exe. The problem is that I can't find out when the user closes those apps(since they're only minimized) so that I can start drawing my app again. I was told to try subclassing the taskbar to catch when the user presses the minimize button - but I can't get it to work. This is a poor hack I suppose, but I don't know of any better way.

Above I attached a small (9kB) windows ce 4.0 project which just sets up a basic window and tries to subclass the taskbar.
If your (active) app spawns IE (or anything else), it should become active again when the spawned app is minimized. Isn't that the case?
No - the shell window creation causes my app to minimize, but when the shell window is closed my app never gets a message of any kind letting it know that the window was closed - so my app just loops in MainLoop() forever...
Your app doesn't receive WM_ACTIVATE? I am perplexed.
It only receives WM_ACTIVATE when the process is created, which causes my app to minimize - but when the shell window is minimized no message is ever sent back to my app :(

Try it:

PROCESS_INFORMATION pi;
CreateProcess(TEXT("iexplore.exe"), NULL, NULL, NULL, FALSE, 0, NULL, NULL, NULL, π);
WaitForSingleObject() won't work because the spawned process is minimized (it is not closed).
Yep, I tried it already :(

So is it hopeless?