PocketMatrix forums

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

createprocess troubles

Hello,

I'm using CreateProcess to open a help file from my application, however my application is getting minimized and I'm having a hard time getting it back after I close the help window.

If the user presses a button in my app then I do this to show the help file:

[/code]m_pDisplay->SuspendDisplay();

PROCESS_INFORMATION pi;
CreateProcess(TEXT("peghelp.exe"), TEXT("file:help.htm#Main_Contents"), NULL, NULL, FALSE, 0, NULL, NULL, NULL, π);
WaitForSingleObject(pi.hProcess,INFINITE);
SetForegroundWindow(m_hWnd);
m_pDisplay->ResumeDisplay();
Code:



However, this causes the application to freeze and never stop waiting on the thread.


So can anyone tell me how I should go about this?
I'm trying that again:

Hello,

I'm using CreateProcess to open a help file from my application, however my application is getting minimized and I'm having a hard time getting it back after I close the help window.

If the user presses a button in my app then I do this to show the help file:


Code:

m_pDisplay->SuspendDisplay();

PROCESS_INFORMATION pi;
CreateProcess(TEXT("peghelp.exe"), TEXT("file:help.htm#Main_Contents"), NULL, NULL, FALSE, 0, NULL, NULL, NULL, π);
WaitForSingleObject(pi.hProcess,INFINITE);
SetForegroundWindow(m_hWnd);
m_pDisplay->ResumeDisplay();



However, this causes the application to freeze and never stop waiting on the thread.


So can anyone tell me how I should go about this?
Guest · 05 Nov 2004, 01:18 UTC — harvey
Maybe I should be taking a break from this problem, but maybe I can be more specific. If I don't use the previously posted code, but rather I create a process for the help file to be executed and let my application be minimized by the windows procedure in gapiapplication. Then the help file shows up, however when I close it I don't know how to get my application back up.

Where should this be done?
Are you sure your help process ends? Clicking the "X" or "OK" button on the title bar doesn't actually send a WM_CLOSE message to your app... It simply minimizes it.
harvey p. · 05 Nov 2004, 01:39 UTC — please help harvey
You're right, so do you or anyone else know of how I
can find out if the process I created was minimized?

I've tried something like this:

DWORD dwStatus;
while (WaitForSingleObject(pi.hProcess, 100) == WAIT_TIMEOUT)
GetExitCodeProcess(pi.hProcess,&dwStatus;);

but, dwStatus never changes even when I minimize the help process.
Why don't you simply trap the "x" button in your help process and terminate the thing yourself?

I am sure www.pocketpcdn.com has an article on trapping the thing.
that sounds like a good idea. I checked out what pocketpcdn had to say and they had an article about hooking the taskbars message function and catching a minimize press. I think I can do basically the same thing, however they use this function:

g_hWndTask = ::FindWindow(_T("HHTaskBar"), NULL);

you wouldn't happen to know how to find the string to put in the first parameter of this function would you?
I just wanted to add that the string is in what microsoft calls the "atom table", but I can't seem to find a way to see whats in the table. They only provide a way to search for things that you already know the name of.
I found the a way to get these strings - use remote spy(if you're using visual embedded).

:)