⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uusers.pas

📁 Delphi面向对象编程思想附书源码 好用哦!
💻 PAS
字号:
unit uUsers;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  Windows, ActiveX, Classes, ComObj, UserComSvr_TLB, StdVcl ,
  Variants;

type
  TUser = class(TTypedComObject, IUser)
  protected
    procedure getDepList(out Deps: OleVariant); stdcall;
    procedure getUserList(const strName: WideString; out vData: OleVariant);
      stdcall;
    procedure UpdateUserData(var vData: OleVariant; out nErr: SYSINT); stdcall;
    {Declare IUser methods here}
  end;

implementation

uses ComServ, uUserMaint;

procedure TUser.getDepList(out Deps: OleVariant);
var
  UserMaint:TUserMaint;
  DepLst:TStrings;
  i:Integer;
begin
  UserMaint:=TUserMaint.Create;
  try
    DepLst:=UserMaint.GetDepList;
    Deps:=VarArrayCreate([0,(DepLst.Count-1)],varVariant);
    for i:=0 to DepLst.Count-1 do
    begin
      Deps[i]:=DepLst.Strings[i];
    end;
  finally
    UserMaint.Free;
  end;
end;

procedure TUser.getUserList(const strName: WideString;
  out vData: OleVariant);
var
  UserMaint:TUserMaint;
begin
  UserMaint:=TUserMaint.Create;
  try
    vData:=UserMaint.GetUserList(strName);
  finally
    UserMaint.Free;
  end;
end;

procedure TUser.UpdateUserData(var vData: OleVariant; out nErr: SYSINT);
var
  UserMaint:TUserMaint;
begin
  UserMaint:=TUserMaint.Create;
  try
    UserMaint.UpdateUserData(vData,nErr);
  finally
    UserMaint.Free;
  end;
end;

initialization
  TTypedComObjectFactory.Create(ComServer, TUser, Class_User,
    ciMultiInstance, tmApartment);
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -