CreateProcess()

I am doing a project and need to call another program to open a data file that created by the current program. I try with Notepad to open a file and most of the parameters are NULL the exercuteable notepad is in project directory and debug directory but cannot make it work, no compile error nor any error message, the process just doesnt run

CreateProcess("Notpad", "data.txt", NULL, NULL, TRUE ... NULL);
ahTriAsked:
Who is Participating?
 
thresher_sharkConnect With a Mentor Commented:
Use this instead:

ShellExecute (NULL, "open", "data.txt", NULL, NULL, NULL);

If you have additional questions, please feel free to ask.  Thanks!
0
 
thresher_sharkCommented:
Note that if it still doesn't work, make sure the "data.txt" file is in the correct directory, because I can guarentee it will work if that is the case.  If you run your program from within DevStudio, make sure data.txt is in the project directory.  If you run your program from the "debug" directory, make sure data.txt is also in the debug directory.
0
 
ahTriAuthor Commented:
this is what your answer:
Use this instead:

   ShellExecute (NULL, "open", "data.txt", NULL, NULL, NULL);

   If you have additional questions, please feel free to ask.  Thanks!

------------
but doesnt work at all, no compile error, but nothing happen ! what u mean by "open" is it the string name of the execute file ?
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
ahTriAuthor Commented:
Ohh sorry I find out how to use ShellExecute but what I need is to run an application and tell it some parameter

with ShellExecute I can only "open" and "notepad.exe" and no place for parameter

thanks
0
 
ahTriAuthor Commented:
this is what I write:
ShellExecute(NULL, "open", "notepad.exe", NULL, NULL, NULL);
      
and it doesnt do anything, please help thanks
0
 
ahTriAuthor Commented:
thanks I figure it out at last
0
 
thresher_sharkCommented:
Sorry for not responding, I was not on the internet :-) I am glad you got it working.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.