Thread: CreateProcess

  1. #1

    Question CreateProcess

    I would like to use CreateProcess to start an app minimised but I just can't get it to work.
    As a test, I set up the CreateProcess parameters and STARTUPINFO structure with the following lines;

    CString m_Process = "C:\\WINDOWS\\NOTEPAD.EXE";
    char *vip = "C:\\WINDOWS\\NOTEPAD.EXE";
    memset(&suInfo, 0, sizeof(suInfo));
    suInfo.cb = sizeof(suInfo);
    suInfo.dwFlags = STARTF_USESHOWWINDOW;
    suInfo.wShowWindow = SW_MINIMIZE;

    And then on the press of a key, I called the CreateProcess thus;

    I thought this code would start notepad minimised but it starts as a normal window... any ideas on what is wrong?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Personally, if I have to do this sort of thing I will go for ShellExecute....its easier and is more than sufficient for this sort of deal;

    Nothing easier!!!!

    CreateProcess is much more complicated and allows greater power ( and how the process is created - such as with a console....), but for this need to get complex

  3. #3
    I considered ShellExecute but as you say, CreateProcess is more powerful. I am trying to use CreateProcess so that I then get the information required to kill the process whenever I want.
    All I need is a hint on what I am doing wrong in setting up the call.

  4. #4


    Thanks for tryin but looks like I've figured it out now
    The first two arguments of CreateProcess are Application Name and Command Line. By setting the above Command Line value to NULL (ie replacing the 'vip' with NULL), the example now works.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CreateProcess() + Command Line
    By IndioDoido in forum Windows Programming
    Replies: 20
    Last Post: 11-14-2008, 07:35 PM
  2. CreateProcess with arguments
    By Niara in forum Windows Programming
    Replies: 14
    Last Post: 09-08-2007, 05:41 AM
  3. CreateProcess with Resource of executable, not the Filename
    By Ktulu in forum Windows Programming
    Replies: 4
    Last Post: 11-04-2006, 01:07 AM
  4. question on CreateProcess() redirection
    By ac251404 in forum Windows Programming
    Replies: 13
    Last Post: 07-18-2006, 11:06 AM
  5. CreateProcess()
    By Newfie in forum C++ Programming
    Replies: 2
    Last Post: 05-07-2002, 07:31 AM