Jan 19, 2005 #1 M Moof Full Member level 2 Joined Nov 21, 2003 Messages 149 Helped 7 Reputation 14 Reaction score 3 Trophy points 1,298 Location Argentina Activity points 1,230 Visual C++ problem How can i execute an external exe from visual c++, for example notepad.exe??
Jan 19, 2005 #2 Ace-X Advanced Member level 2 Joined Jan 25, 2002 Messages 529 Helped 41 Reputation 82 Reaction score 14 Trophy points 1,298 Location Germany Activity points 5,151 Re: Visual C++ problem Moof said: How can i execute an external exe from visual c++, for example notepad.exe?? Click to expand... Code: #include <process.h> char* argv[]={"param1","param2"}; // command-line parameters for notepad.exe void main(void) { _execvp("notepad.exe",argv); // will search for notepad.exe in current folder and in PATH }
Re: Visual C++ problem Moof said: How can i execute an external exe from visual c++, for example notepad.exe?? Click to expand... Code: #include <process.h> char* argv[]={"param1","param2"}; // command-line parameters for notepad.exe void main(void) { _execvp("notepad.exe",argv); // will search for notepad.exe in current folder and in PATH }
Jan 25, 2005 #3 S sshahid47 Full Member level 1 Joined Nov 5, 2004 Messages 99 Helped 15 Reputation 30 Reaction score 2 Trophy points 1,298 Activity points 974 Visual C++ problem Hi, Use the CreateProcess() windows API, its recommended by microsoft for launching any new applications. Read more on CreateProcess on msdn.
Visual C++ problem Hi, Use the CreateProcess() windows API, its recommended by microsoft for launching any new applications. Read more on CreateProcess on msdn.
Jan 25, 2005 #4 bilgekaan Full Member level 2 Joined Nov 18, 2004 Messages 125 Helped 15 Reputation 30 Reaction score 1 Trophy points 1,298 Location Turkiye Activity points 1,300 Re: Visual C++ problem simple way SHELLEXECUTEINFO ShExecInfo = {0}; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; ShExecInfo.hwnd = NULL; ShExecInfo.nShow = SW_SHOW; ShExecInfo.lpVerb = NULL; ShExecInfo.lpFile = "Notepad.exe" ShExecInfo.lpParameters = "c:\\text.txt"; ShExecInfo.lpDirectory = NULL; ShExecInfo.hInstApp = NULL; ShellExecuteEx(&ShExecInfo);
Re: Visual C++ problem simple way SHELLEXECUTEINFO ShExecInfo = {0}; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; ShExecInfo.hwnd = NULL; ShExecInfo.nShow = SW_SHOW; ShExecInfo.lpVerb = NULL; ShExecInfo.lpFile = "Notepad.exe" ShExecInfo.lpParameters = "c:\\text.txt"; ShExecInfo.lpDirectory = NULL; ShExecInfo.hInstApp = NULL; ShellExecuteEx(&ShExecInfo);
Jan 25, 2005 #5 S sshahid47 Full Member level 1 Joined Nov 5, 2004 Messages 99 Helped 15 Reputation 30 Reaction score 2 Trophy points 1,298 Activity points 974 Visual C++ problem Simpler Way CreateProcess("Notepad.exe",NULL,NULL,NULL,FALSE,0,NULL,NULL,NULL,NULL);
Visual C++ problem Simpler Way CreateProcess("Notepad.exe",NULL,NULL,NULL,FALSE,0,NULL,NULL,NULL,NULL);