CreateProcess()

This is a discussion on CreateProcess() within the C++ Programming forums, part of the General Programming Boards category; I need some help with the CreateProcess() function. Currently I am using WinExec("pbrush.exe", SW_SHOW); to open another application but I ...

  1. #1
    Registered User Newfie's Avatar
    Join Date
    Dec 2001
    Posts
    1

    Question CreateProcess()

    I need some help with the CreateProcess() function. Currently I am using

    WinExec("pbrush.exe", SW_SHOW);

    to open another application but I was told I should be using

    CreateProcess( ??????);

    What arguments are used in this function?

    Thx in advance.

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Something like -

    Code:
    	STARTUPINFO si={0};
    	si.cb = sizeof(STARTUPINFO);
    	PROCESS_INFORMATION pi = {0};
    	
    	if(!CreateProcess(NULL,"notepad.exe",0,0,FALSE,0,0,0,&si,&pi))
    		cout << "Unable to start process\n";
    zen

  3. #3
    Unregistered
    Guest

    Question CreateProcess and minimized, maximised, etc?

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

    STARTUPINFO suInfo;
    PROCESS_INFORMATION procInfo;
    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;
    CreateProcess(m_Process,vip,NULL,NULL,FALSE,NORMAL _PRIORITY_CLASS,NULL,NULL,&suInfo,&procInfo);

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

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, 06: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, 12: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 Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 05-12-2002, 06:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21