Solved

CreateProcess()

Posted on 1999-01-10
7
268 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java inner class, for the sole use of parameter passing 21 77
thread-safe code in c++ 2 115
Unresolved External Symbols 3 103
Arduino EDI - Programming language 3 103
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

839 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