注册 登录
编程论坛 Delphi论坛

屏蔽 Ctrl+Alt+Del

yangguofa 发布于 2005-01-12 13:52, 1265 次点击
function WinExecAndWait32(FileName:String; Visibility : integer):integer;   //9X中
var
  zAppName:array[0..512] of char;
  zCurDir:array[0..255] of char;
  WorkDir:String;
  StartupInfTStartupInfo;
  ProcessInfTProcessInformation;
  tmp :DWORD;
begin
  StrPCopy(zAppName,FileName);
  GetDir(0,WorkDir);
  StrPCopy(zCurDir,WorkDir);
  FillChar(StartupInfo,Sizeof(StartupInfo),#0);
  StartupInfo.cb := Sizeof(StartupInfo);
  StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
  StartupInfo.wShowWindow := Visibility;
  if not CreateProcess(nil,
    zAppName,                      { pointer to command line string }
    nil,                           { pointer to process security attributes }
    nil,                           { pointer to thread security attributes }
    false,                         { handle inheritance flag }
    CREATE_NEW_CONSOLE or          { creation flags }
    NORMAL_PRIORITY_CLASS,
    nil,                           { pointer to new environment block }
    nil,                           { pointer to current directory name }
    StartupInfo,                   { pointer to STARTUPINFO }
    ProcessInfo) then
    Result := -1 { pointer to PROCESS_INF }
  else
    begin
      WaitforSingleObject(ProcessInfo.hProcess,INFINITE);
      GetExitCodeProcess(ProcessInfo.hProcess,tmp);
      Result := tmp;
    end;
end;
1 回复
#2
dldf2005-01-16 14:59
要这么多啊
1