Solved

CreateProcess()

Posted on 1999-01-10
7
242 Views
Last Modified: 2012-05-04
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);
0
Comment
Question by:ahTri
  • 4
  • 3
7 Comments
 
LVL 6

Accepted Solution

by:
thresher_shark earned 50 total points
ID: 1181838
Use this instead:

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

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

Expert Comment

by:thresher_shark
ID: 1181839
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
 

Author Comment

by:ahTri
ID: 1181840
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:ahTri
ID: 1181841
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
 

Author Comment

by:ahTri
ID: 1181842
this is what I write:
ShellExecute(NULL, "open", "notepad.exe", NULL, NULL, NULL);
      
and it doesnt do anything, please help thanks
0
 

Author Comment

by:ahTri
ID: 1181843
thanks I figure it out at last
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1181844
Sorry for not responding, I was not on the internet :-) I am glad you got it working.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now