CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    133

    [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
    Louis-Philippe Frenette
    Arobas Informatique Granby
    http://www.arobasinformatique.com

  2. #2
    Join Date
    Aug 2005
    Posts
    133

    Resolved 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
    Louis-Philippe Frenette
    Arobas Informatique Granby
    http://www.arobasinformatique.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured