5
520zhuhaibo
Unregistered / Unconfirmed
GUEST, unregistred user!
Procedure ShellExecute_Windows(ASign: Integer; Const ACmdStr: String);<br>Var<br> AppName: Array[0..512] Of char;<br> wCmdStr: String;<br> StartupInfo: TStartupInfo;<br> ProcessInfo: TProcessInformation;<br>Begin<br> wCmdStr := Trim(ACmdStr);<br> If wCmdStr <> '' Then<br> Begin<br> StrPCopy(AppName,wCmdStr);<br><br> {建立进程并等待其结束}<br> Fillchar(StartupInfo, Sizeof(StartupInfo), #0);<br><br> With StartupInfo Do<br> Begin<br> cb := sizeof(StartupInfo);<br> dwFlags := StartF_UsesTDHandles Or STARTF_USESHOWWINDOW;<br> lptitle := Nil;<br> wShowWindow := SW_SHOWNORMAL;<br> End;<br><br> If CreateProcess(Nil,<br> AppName, { pointer to command line string }<br> Nil, { pointer to process security attributes }<br> Nil, { pointer to thread security attributes }<br> False, { handle inheritance flag }<br> CREATE_NEW_CONSOLE Or NORMAL_PRIORITY_CLASS, { creation flags }<br> Nil, { pointer to new environment block }<br> Nil, { pointer to current directory name }<br> StartupInfo, { pointer to STARTUPINFO }<br> ProcessInfo) Then<br> Begin<br> With ProcessInfo Do<br> Begin<br> If ASign = 0 Then<br> WaitForSingleObject(hProcess, INFINITE);<br> CloseHandle(hThread);<br> CloseHandle(hProcess);<br> End;<br> End;<br> End<br> Else<br> ExitWindowsEx(ASign, 0);<br>End;<br><br>调试时:<br>1、当ACmdStr为'D:/SOUND_CODE/系统注册/*.exe'就会报错<br>2、当ACmdStr为'D:/SOUND_CODE/*.exe'就正常<br>请各们大侠帮帮小弟了,在线!<br>QQ:66082594