| View previous topic :: View next topic |
| Author |
Message |
maxLOL Grandmaster Cheater
Reputation: 0
Joined: 27 May 2008 Posts: 636 Location: noitacoL
|
Posted: Tue Dec 23, 2008 3:46 am Post subject: Start a Program with C++ |
|
|
Hey whats the code to (in C++) start another program? and can you please give an example?
thanks
_________________
Looking to create a Maple Story Dev team. PM me if interested. |
|
| Back to top |
|
 |
ShurikeN Advanced Cheater
Reputation: 0
Joined: 09 Jan 2008 Posts: 84
|
Posted: Tue Dec 23, 2008 3:50 am Post subject: |
|
|
ShellExecute()?
_________________
| Code: | XXXXXX XXXXXX
XXXXX XXXXX
XXXXXXXX
D I R E C T
XXXXXXXX
XXXXX XXXXX
XXXXXX XXXXXX
GameDev
|
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
|
| Back to top |
|
 |
maxLOL Grandmaster Cheater
Reputation: 0
Joined: 27 May 2008 Posts: 636 Location: noitacoL
|
Posted: Tue Dec 23, 2008 4:07 pm Post subject: |
|
|
so would adding
| Code: |
CreateProcess(iexplore.exe)
|
work?
_________________
Looking to create a Maple Story Dev team. PM me if interested. |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Tue Dec 23, 2008 4:43 pm Post subject: |
|
|
Um... No..
Did you even read the CreateProcess MSDN link?
1. The first parameter is LPCTSTR (String)
2. There are more then just 1 parameter.
_________________
|
|
| Back to top |
|
 |
maxLOL Grandmaster Cheater
Reputation: 0
Joined: 27 May 2008 Posts: 636 Location: noitacoL
|
Posted: Tue Dec 23, 2008 6:32 pm Post subject: |
|
|
Hey could you give an example? im not getting this.
_________________
Looking to create a Maple Story Dev team. PM me if interested. |
|
| Back to top |
|
 |
arigity Advanced Cheater
Reputation: 0
Joined: 03 Jul 2008 Posts: 65 Location: middle of nowhere.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Dec 23, 2008 10:58 pm Post subject: |
|
|
| Code: | #include <windows.h>
char target[] = "\\what.exe";
char path[MAX_PATH];
STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi = { 0 };
int main(){
si.cb = sizeof(STARTUPINFO);
GetCurrentDirectory((MAX_PATH - sizeof(target)), &path);
lstrcat(&path, &target);
CreateProcess(&path, NULL, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
return 0;
} |
would start 'what.exe' in the same directory.
i'm sure you can use your imagination to expand on it.
|
|
| Back to top |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Wed Dec 24, 2008 1:24 am Post subject: |
|
|
I don't understand why people have to make something like this so much more difficult than it has to be.
| Code: | ShellExecute(0,"open","c:\\windows\\system32\\notepad.exe",0,0,0);
//change "c:\\windows\\system32\\notepad.exe" to whatever you want to shell.. quite obviously. |
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Wed Dec 24, 2008 1:59 am Post subject: |
|
|
| talker0 wrote: | I don't understand why people have to make something like this so much more difficult than it has to be.
| Code: | ShellExecute(0,"open","c:\\windows\\system32\\notepad.exe",0,0,0);
//change "c:\\windows\\system32\\notepad.exe" to whatever you want to shell.. quite obviously. |
|
ShellExecute() < CreateProcess().
|
|
| Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Wed Dec 24, 2008 5:18 am Post subject: |
|
|
| Zerith wrote: | | talker0 wrote: | I don't understand why people have to make something like this so much more difficult than it has to be.
| Code: | ShellExecute(0,"open","c:\\windows\\system32\\notepad.exe",0,0,0);
//change "c:\\windows\\system32\\notepad.exe" to whatever you want to shell.. quite obviously. |
|
ShellExecute() < CreateProcess(). |
That's right, but sometimes ShellExecute is preferred for example if you want to launch a website, then it'll automatically use the user's browser, or if you want to open a document it'll open the user's text editor and so on.
|
|
| Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Wed Dec 24, 2008 10:34 pm Post subject: |
|
|
ya...use shellexecute.
_________________
|
|
| Back to top |
|
 |
|