• Delphi CreateProcess函数调用示例


    procedure TfmMain.Login;
    var
      si:STARTUPINFO;
      pi:PROCESS_INFORMATION;
      CommandLine:String;
      ProcessFileName:string;
    begin
      if (Trim(edtLoginName.Text)='') or (Trim(edtPassword.Text)='') then
      begin
        MsgBoxError(Handle,'请输入用户名及密码!');
        Exit;
      end;
      if not SemsClientApp.LoginManager.ValidateLogin(edtLoginName.Text,edtPassword.Text) then
      begin
        MsgBoxError(Handle,'用户名或密码错误,请重新输入!');
        Exit;
      end;
      try
        FillChar(si,SizeOf(si),0);
        FillChar(pi,SizeOf(pi),0);
        si.cb:=SizeOf(si);
        ProcessFileName:=SemsClientApp.AppPath+'\sems.bin';
        CommandLine:='"'+ProcessFileName+'" /S"'+Application.ExeName+'" /L"'+edtLoginName.Text+'" /P"'+edtPassword.Text+'"';
        if CreateProcess(PAnsiChar(ProcessFileName),PAnsiChar(CommandLine),nil,nil,False,0,nil,nil,si,pi) then
        Close;
      except
        MsgBoxError(Handle,'启动程序失败!');
      end;
    end
  • 相关阅读:
    【矩阵】
    关于集合的思路
    TSQL生成Combguid
    ServiceLocator是反模式
    使用表达式树创建对象
    TeamCity配置笔记
    AutoMapper映射ExpressionTree
    Automapper扩展方法
    Cache&Session Viewer
    Orchard源码:Logging
  • 原文地址:https://www.cnblogs.com/MaxWoods/p/1299328.html
Copyright © 2020-2023  润新知