Solved

CreateProcess()

Posted on 1999-01-10
7
252 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

896 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

15 Experts available now in Live!

Get 1:1 Help Now