none
CreateProcess won't start the application RRS feed

  • Question

  • Hi,

    I'm trying to start an application with CreateProcess but it doesn't work and I really don't know why since if I try opening any other application with the same code it works perfectly. When I'm trying to start it via the command line console, it doesn't work neither.

    So I was wondering if there's any way to force the application to start or to simulate a start like I would have double-clicked it's icon in Windows. I'd also like to know what's the Windows procedure to start application since it clearly doesn't only call CreateProcess like I thought.

    Thanks a lot for any answers !!!

    Thursday, September 30, 2010 1:45 AM

Answers

  •  

    Hi,

     

    I think it's cause by the name of your application, so here are some tips:

     

    1.did you run Visual Studio as Administrator?

    2.try to change your application name and folder name.

     

    Regards!

    Jesse


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, October 6, 2010 3:13 AM
    Moderator
  • Hi,

    My another 2 cents is that the application you are trying to run return immediately if there is no any command line argument. Have you tried to debug this application(client.exe) with windbg(I think it is quite easy to set windbg to begin automatically if this application is begin to run)?

    And the way you determine if ShellExecute return success is incorrect. From MSDN, if ShellExecute successfully, it return a value greater than 32.

     

    RenJie

    Wednesday, October 6, 2010 4:15 AM

All replies

  • You should get familiarized with some basics first.
    1. Whiter than the white is UV bright! 2. Eat your vegetables or you are going to turn in to fat dumb asses! 3. Fruits won't cut it 4 wheel drive with levers to lock differentials was a hack
    Thursday, September 30, 2010 2:21 AM
  • try ShellExecuteEx or ShellExecute. Some time CreateProcess doesn't work with UAT enabled on Vista or Win7.

     

    renjie

    • Edited by renjieluo Thursday, September 30, 2010 4:52 AM
    Thursday, September 30, 2010 3:10 AM
  • Check this other thread, which deals with the creation of process. There are other threads too, you can search them and see if any of them are matching with your context.

    Also, check this link on the MSDN for detailed information on CreateProcess() API and related.

     


    akx Solutions

    Vote if helpful (or) Mark it Answered if answered your query.
    Thursday, September 30, 2010 4:36 AM
  • >When I'm trying to start it via the command line console, it doesn't work neither.

     

    If application can't be started it is an invalid image. Invalid image means there is no way for CPU to process it and it is therefore impossible to start it.


    1. Whiter than the white is UV bright! 2. Eat your vegetables or you are going to turn in to fat dumb asses! 3. Fruits won't cut it 4 wheel drive with levers to lock differentials was a hack
    Thursday, September 30, 2010 4:45 AM
  • What does GetLastError say??
     
    M

    Hi,

    I'm trying to start an application with CreateProcess but it doesn't work and I really don't know why since if I try opening any other application with the same code it works perfectly. When I'm trying to start it via the command line console, it doesn't work neither.

    So I was wondering if there's any way to force the application to start or to simulate a start like I would have double-clicked it's icon in Windows. I'd also like to know what's the Windows procedure to start application since it clearly doesn't only call CreateProcess like I thought.

    Thanks a lot for any answers !!!

    Thursday, September 30, 2010 6:00 PM
  • GetLastError() says (literary translation):

    • There's no more file, if I use CreateProcess() or system() to try to start the application (which is Carbon poker btw)
    • Operation successul, if I use ShellExecute()  ...but the application doesn't start neither.

     

    Here's the code I'm trying:

    	PROCESS_INFORMATION pInfo;
    	STARTUPINFO sInfo;
    
    	memset(&pInfo, 0, sizeof
    
    (pInfo));
    	memset(&sInfo, 0, sizeof
    
    (sInfo));
    
    	sInfo.dwFlags = STARTF_USESTDHANDLES;
    	sInfo.cb = sizeof
    
    (STARTUPINFO);
    
    
    	char
    
    * ch = "C:\\Program Files (x86)\\CarbonPoker\\client.exe"
    
    ;
    	//char* ch = "C:\\Program Files (x86)\\Cake Poker\\cake.exe";
    
    
    
    /*
    	if(!CreateProcess(ch, NULL, NULL, NULL, false, 0, NULL, NULL, &sInfo, &pInfo))
    		exit(1);
    */
    
    
    
    	if
    
    (!ShellExecute(NULL, NULL, ch, NULL, NULL, SW_SHOW))
    		exit(1);
    
    	//system("C:\\Program Files (x86)\\CarbonPoker\\client.exe");
    
    
     
    

     

    As you can see I tryed with another application (Cake poker) and everything is working fine, it's clearly because Carbon poker is a weird/crappy application.

    Thanks for the posts !

    Friday, October 1, 2010 6:49 PM
  •  

    Hi,

     

    I think it's cause by the name of your application, so here are some tips:

     

    1.did you run Visual Studio as Administrator?

    2.try to change your application name and folder name.

     

    Regards!

    Jesse


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, October 6, 2010 3:13 AM
    Moderator
  • Hi,

    My another 2 cents is that the application you are trying to run return immediately if there is no any command line argument. Have you tried to debug this application(client.exe) with windbg(I think it is quite easy to set windbg to begin automatically if this application is begin to run)?

    And the way you determine if ShellExecute return success is incorrect. From MSDN, if ShellExecute successfully, it return a value greater than 32.

     

    RenJie

    Wednesday, October 6, 2010 4:15 AM