<br><br>Q: 如何打开一个应用程序? ShellExecute(this->m_hWnd,"open","calc.exe","","", SW_SHOW );<br>或 ShellExecute(this->m_hWnd,"open","notepad.exe",<br> "c://MyLog.log","",SW_SHOW );<br>正如您所看到的,我并没有传递程序的完整路径。<br>Q: 如何打开一个同系统程序相关连的文档? ShellExecute(this->m_hWnd,"open",<br> "c://abc.txt","","",SW_SHOW );<br>Q: 如何打开一个网页? ShellExecute(this->m_hWnd,"open",<br> "http://www.google.com","","", SW_SHOW );<br>Q: 如何激活相关程序,发送EMAIL? ShellExecute(this->m_hWnd,"open",<br> "mailto:nishinapp@yahoo.com","","", SW_SHOW );<br>Q: 如何用系统打印机打印文档? ShellExecute(this->m_hWnd,"print",<br> "c://abc.txt","","", SW_HIDE);<br>Q: 如何用系统查找功能来查找指定文件? ShellExecute(m_hWnd,"find","d://nish",<br> NULL,NULL,SW_SHOW);<br>Q: 如何启动一个程序,直到它运行结束? SHELLEXECUTEINFO ShExecInfo = {0};<br>ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);<br>ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;<br>ShExecInfo.hwnd = NULL;<br>ShExecInfo.lpVerb = NULL;<br>ShExecInfo.lpFile = "c://MyProgram.exe"; <br>ShExecInfo.lpParameters = ""; <br>ShExecInfo.lpDirectory = NULL;<br>ShExecInfo.nShow = SW_SHOW;<br>ShExecInfo.hInstApp = NULL; <br>ShellExecuteEx(&ShExecInfo);<br>WaitForSingleObject(ShExecInfo.hProcess,INFINITE);<br>或: PROCESS_INFORMATION ProcessInfo; <br>STARTUPINFO StartupInfo; //This is an [in] parameter<br>ZeroMemory(&StartupInfo, sizeof(StartupInfo));<br>StartupInfo.cb = sizeof StartupInfo ; //Only compulsory field<br>if(CreateProcess("c://winnt//notepad.exe", NULL, <br> NULL,NULL,FALSE,0,NULL,<br> NULL,&StartupInfo,&ProcessInfo))<br>{ <br> WaitForSingleObject(ProcessInfo.hProcess,INFINITE);<br> CloseHandle(ProcessInfo.hThread);<br> CloseHandle(ProcessInfo.hProcess);<br>} <br>else<br>{<br> MessageBox("The process could not be started...");<br>}<br><br>Q: 如何显示文件或文件夹的属性? SHELLEXECUTEINFO ShExecInfo ={0};<br>ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);<br>ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST ;<br>ShExecInfo.hwnd = NULL;<br>ShExecInfo.lpVerb = "properties";<br>ShExecInfo.lpFile = "c://"; //can be a file as well<br>ShExecInfo.lpParameters = ""; <br>ShExecInfo.lpDirectory = NULL;<br>ShExecInfo.nShow = SW_SHOW;<br>ShExecInfo.hInstApp = NULL; <br>ShellExecuteEx(&ShExecInfo);<br><br> <br>