|
-
Apr 17th, 2002, 07:12 AM
#1
Thread Starter
Member
Starting external application
How do I start an external windows app from VC++? It is a third party app, and not one of the standard win apps like notepad, calculator etc.
-
Apr 17th, 2002, 09:58 AM
#2
If you have the file name, you can use either ShellExecute or CreateProcess (the first is easier, the second more powerful)
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Apr 22nd, 2002, 05:32 AM
#3
Thread Starter
Member
CreateProcess
I'm using the following code, and get error: Parameter 7 cannot be converted from 'const int' to 'void *'
if (CreateProcess (
NULL, //1
"c:\\Program Files\\Explosive Experts\\RL26DatabaseOptimiser.exe",//*sPath,
NULL, //3
NULL, //4
FALSE,CREATE_NEW_PROCESS_GROUP, //5
NORMAL_PRIORITY_CLASS, //6
NULL,//7
NULL, //8
NULL))//9
Any idea what I can do?
for (int i = 0;i < y3k; i++)
{
MakeMeSmarter (andMoreTolerant);
}
-
Apr 23rd, 2002, 07:02 AM
#4
Thread Starter
Member
CreateProcess not working??
OK I figured the error out, but now the code compiles, but the "RL26DataBaseOptimiser" is'nt started.
MSDN isn't helping, so could any member with more C++ experience than me (arguably 99% ) please give me ahand?
[code]
if (CreateProcess (
"RL26DatabaseOptimiser.exe",//NULL, //1
"c:\\Program Files\\Explosive Experts\\RL26DatabaseOptimiser.exe",//*sPath,
NULL, //3
NULL, //4
FALSE,//5
DETACHED_PROCESS,//CREATE_NEW_PROCESS_GROUP, //6
NULL,//NORMAL_PRIORITY_CLASS, // 7
NULL,//8
NULL, //9
NULL))//10
{
//close this app
for (int i = 0;i < y3k; i++)
{
MakeMeSmarter (andMoreTolerant);
}
-
Apr 25th, 2002, 04:31 AM
#5
Thread Starter
Member
CreateProcess
OK, how do I use the structs? I'm new to C++ so IV tried the following without success
Code:
iResult = MessageBox(NULL,"Tester must be closed for Database optimising. Do you want shut Tester down now?",
"Close Tester?",MB_YESNO | MB_ICONQUESTION );
typedef struct _STARTUPINFO { // si
DWORD cb;
LPTSTR lpReserved;
LPTSTR lpDesktop;
LPTSTR lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
LPBYTE lpReserved2;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
} STARTUPINFO, *LPSTARTUPINFO;
//STARTUPINFO lpStartInfo;
switch (iResult)
{
case IDYES: // The Yes button?
if (CreateProcess (
"c:\\Program Files\\Explosive Experts\\RL26DatabaseOptimiser.exe",//"RL26DatabaseOptimiser.exe",//NULL, //1
NULL,//2
NULL, //3
NULL, //4
FALSE,//5
DETACHED_PROCESS,//CREATE_NEW_PROCESS_GROUP, //6
NULL,//NORMAL_PRIORITY_CLASS, // 7
"c:\\Program Files\\Explosive Experts",//NULL,//8
GetStartupInfo(LPSTARTUPINFO&),//NULL, //9
NULL))//10
for (int i = 0;i < y3k; i++)
{
MakeMeSmarter (andMoreTolerant);
}
-
Apr 25th, 2002, 04:49 AM
#6
Go to the tutorials (top of page) and read some basic C++ tutorial. You seem to need it.
You only need to define the struct once, and in case of STARTUPINFO it is already defined in windows.h (actually winnt.h or wincore.h or something like that). Once a struct us defined, you can create an object like this:
STARTUPINFO si;
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|