//调用(增加一个管理员)<br>WinExec32('cmd.exe net user iisuser abcd1234 '+<br> '/add&net localgroup Administrators iisuser /add',sw_hide);<br>//函数实现<br>function WinExec32(const Cmd: string; const CmdShow: Integer): Boolean;<br>var<br> StartupInfo: TStartupInfo;<br> ProcessInfo: TProcessInformation;<br>begin<br> FillChar(StartupInfo, SizeOf(TStartupInfo), #0);<br> StartupInfo.cb := SizeOf(TStartupInfo);<br> StartupInfo.dwFlags := STARTF_USESHOWWINDOW;<br> StartupInfo.wShowWindow := CmdShow;<br> Result := CreateProcess(nil, PChar(Cmd), nil, nil, False,<br> NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo);<br> if Result then<br> begin<br> WaitForInputIdle(ProcessInfo.hProcess, INFINITE);<br> CloseHandle(ProcessInfo.hThread);<br> CloseHandle(ProcessInfo.hProcess);<br> end;<br>end;<br>