用友通登录

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComObj, WordXP,StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
clsLogin1:Variant;

    LoginSu:Boolean;
    FWord: Variant;
  FDoc: Variant;


implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
  begin
   clsLogin1:=CreateOleObject('UFLoginSQL.Login');
    Try
    {ST:库存管理,WA:工资管理,DP:控制台}
      LoginSu:=clsLogin1.Login('DP');
    Except
      clsLogin1.ShutDown;
      Exit;
    end;
    if not LoginSu then
      begin
      Caption:='调用不成功';
        clsLogin1.ShutDown;
        Exit;
      end;
      memo1.Lines.Clear;
      memo1.Lines.Add('1操作员:'+clsLogin1.Cusername);
      memo1.Lines.Add('2账套名:'+clsLogin1.cAccname);
      memo1.Lines.Add('3会计年度:'+clsLogin1.CIYear);
      memo1.Lines.Add('4服务器:'+clsLogin1.cServer);
      memo1.Lines.Add('5用户ID:'+clsLogin1.CuserId);
      memo1.Lines.Add('6密码:'+clsLogin1.cUserPassword);
      memo1.Lines.Add('7数据库密码:'+clsLogin1.SysPassword);
      memo1.Lines.Add('8连接字符串:'+clsLogin1.Ufdbname);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   clsLogin1.ShutDown;
end;

end.

原文地址:https://www.cnblogs.com/martian6125/p/9631478.html