Call notepad. Webpage
Winexec ("notepad.exe", sw_show );// Open notepad
Winexec ("d :\\ Program Files \ test \ test.exe", sw_showmaximized); // open test.exe in simplified format.
ShellExecute (null, "open", "C: \ test.txt", null, null, sw_shownormal); // open the c: \ test.txt File
ShellExecute (null, "open", "iexplore.exe", "http://www.google.com ",/Null, null, sw_shownormal); // open the webpage www.google.com
ShellExecute (null, "Explore", "d: \ c ++", null, null, sw_shownormal); // open the Directory D: \ c ++
ShellExecute (null, "print", "C: \ test.txt", null, null, sw_hide); // print the file c: \ test.txt
ShellExecute does not support targeted output.
Winexec ("d :\\ Program Files \ test \ test.exe", sw_showmaximized );
ShellExecute (null, "open", "C: \ test.txt", null, null, sw_shownormal );
Bool fret = CreateProcess ("D: \ putty.exe", null, null, false, null, & Si, & PI );
How to call an EXE file in a VC program
ShellExecute (this-> m_hwnd, "open", "notepad.exe ",
"C: \ Scandisk. log", "", sw_show );
Create an independent sub-process. The sub-processes created by the following code are independent.
Bool ret; process_information PI; startupinfo Si; SI. CB = sizeof (SI); SI. wshowwindow = sw_shownormal; ret = CreateProcess (_ T ("C: \ xx.exe"), null, null, false, 0, normal_priority_class, null, null, & Si, & PI ); if (RET) {closehandle (Pi. hthread); closehandle (Pi. hprocess);} // show in notepadprocess_information PI; startupinfo Si; // initialization variable memset (& Si, 0, sizeof (SI); SI. CB = sizeof (SI); SI. wshowwindow = sw_show; SI. dwflags = startf_us Eshowwindow; // open the Notepad program cstring myexe = "notepad.exe" + errfile; lpstr pexe; pexe = (lpstr) (lpctstr) (myexe); bool fret = CreateProcess (null, // "C :\\ winnt \ notepad.exe disterror. err ", pexe, null, null, false, normal_priority_class | create_new_console, null, null, Si, Pi); If (! Fret) {// creation failed. The error message MessageBox ("error: An error occurred while outputting the result to the file! "," Output result ", mb_iconerror );}