参见ShellApi.pas,<br>这是一份前人的文档<br>深入浅出ShellExecute <br><br>作者:徐景周<br><br><br><br>Q: 如何打开一个应用程序?<br><br>ShellExecute(this-&gt;m_hWnd,"open","calc.exe","","", SW_SHOW );<br><br>或<br><br>ShellExecute(this-&gt;m_hWnd,"open","notepad.exe",<br><br>"c:/MyLog.log","",SW_SHOW );<br><br><br><br><br><br>Q: 如何打开一个同系统程序相关连的文档?<br><br>ShellExecute(this-&gt;m_hWnd,"open",<br><br>"c:/abc.txt","","",SW_SHOW );<br><br><br><br>Q: 如何打开一个网页?<br><br>ShellExecute(this-&gt;m_hWnd,"open",<br><br>"http://www.google.com","","", SW_SHOW );<br><br><br><br>Q: 如何激活相关程序,发送EMAIL?<br><br>ShellExecute(this-&gt;m_hWnd,"open",<br><br>"mailto:nishinapp@yahoo.com","","", SW_SHOW );<br><br><br><br>Q: 如何用系统打印机打印文档?<br><br>ShellExecute(this-&gt;m_hWnd,"print",<br><br>"c:/abc.txt","","", SW_HIDE);<br><br><br><br>Q: 如何用系统查找功能来查找指定文件?<br><br>ShellExecute(m_hWnd,"find","d:/nish",<br><br>NULL,NULL,SW_SHOW);<br><br><br><br>Q: 如何启动一个程序,直到它运行结束?<br><br>SHELLEXECUTEINFO ShExecInfo = {0};<br><br>ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);<br><br>ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;<br><br>ShExecInfo.hwnd = NULL;<br><br>ShExecInfo.lpVerb = NULL;<br><br>ShExecInfo.lpFile = "c:/MyProgram.exe"; <br><br>ShExecInfo.lpParameters = ""; <br><br>ShExecInfo.lpDirectory = NULL;<br><br>ShExecInfo.nShow = SW_SHOW;<br><br>ShExecInfo.hInstApp = NULL; <br><br>ShellExecuteEx(&ShExecInfo);<br><br>WaitForSingleObject(ShExecInfo.hProcess,INFINITE);<br><br>或:<br><br>PROCESS_INFORMATION ProcessInfo; <br><br>STARTUPINFO StartupInfo; //入口参数<br><br>ZeroMemory(&StartupInfo, sizeof(StartupInfo));<br><br>StartupInfo.cb = sizeof StartupInfo ; //分配大小<br><br>if(CreateProcess("c:/winnt/notepad.exe", NULL, <br><br>NULL,NULL,FALSE,0,NULL,<br><br>NULL,&StartupInfo,&ProcessInfo))<br><br>{ <br><br>WaitForSingleObject(ProcessInfo.hProcess,INFINITE);<br><br>CloseHandle(ProcessInfo.hThread);<br><br>CloseHandle(ProcessInfo.hProcess);<br><br>} <br><br>else<br><br>{<br><br>MessageBox("The process could not be started...");<br><br>}<br><br><br><br><br><br>Q: 如何显示文件或文件夹的属性?<br><br>SHELLEXECUTEINFO ShExecInfo ={0};<br><br>ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);<br><br>ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST ;<br><br>ShExecInfo.hwnd = NULL;<br><br>ShExecInfo.lpVerb = "properties";<br><br>ShExecInfo.lpFile = "c:/"; //也可以是文件<br><br>ShExecInfo.lpParameters = ""; <br><br>ShExecInfo.lpDirectory = NULL;<br><br>ShExecInfo.nShow = SW_SHOW;<br><br>ShExecInfo.hInstApp = NULL; <br><br>ShellExecuteEx(&ShExecInfo);<br>