-
September 21st, 2007, 07:58 AM
#1
[RESOLVED] Hide other program
Hi i'm using mixed MFC and managed C++ in my program.
I want to start another program(Using Process::Start) -> already done
and Hide it. -> TODO
I tried
startInfo->WindowStyle = ProcessWindowStyle::Minimized;
but it's not working.
here's my code
Code:
srvPathName.Append("\\MAINTCP.EXE");
ProcessStartInfo *startInfo = new ProcessStartInfo(srvPathName);
startInfo->WindowStyle = ProcessWindowStyle::Minimized;
startInfo->CreateNoWindow = true;
startInfo->WorkingDirectory = srvPath;
Process* p = Process::Start(startInfo);
ShowWindow((HWND)p->MainWindowHandle.ToPointer(), SW_FORCEMINIMIZE);
Thanks
-
September 21st, 2007, 08:19 AM
#2
Re: Hide other program
Finaly found how to do it.
startInfo->WindowStyle = ProcessWindowStyle::Hidden;
is still not working. So i have to do it with the showWindow function, but to make it work, i have to wait for the program window to be on the screen.
Here's the working code
Code:
ProcessStartInfo *startInfo = new ProcessStartInfo(srvPathName);
startInfo->WorkingDirectory = srvPath;
Process* p = Process::Start(startInfo);
while(!p->WaitForInputIdle());
ShowWindow((HWND)p->MainWindowHandle.ToPointer(), SW_HIDE);
Thanks anyway
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|