zoukankan      html  css  js  c++  java
  • delphi 开发扩展(二)

    library plug_in;

    uses
      SysUtils,
      Classes,
      Unit3 in 'H:\test\Unit3.pas' {Form3};

    exports GetForm,GetName;

    {$R *.res}

    begin
    end. 

    {要加载的窗体}

    unit Unit3;


    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls,ADODB, DB, Grids, DBGrids;

    type
      TForm3 = class(TForm)
        Button1: TButton;
        ADOQuery1: TADOQuery;
        DBGrid1: TDBGrid;
        DataSource1: TDataSource;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form3: TForm3;
      ADO: TADOConnection;

      function GetName:string;StdCall;
      function GetForm(AHandle:THandle;adoconn:TADOConnection;ACaption:String):BOOL;StdCall;


    implementation

    {$R *.dfm}

    function GetName:string;
    begin
      result:='my dll';
    end;

    function GetForm(AHandle:THandle;adoconn:TADOConnection;ACaption:String):BOOL;
      var
        ShowForm:TForm3;
      begin
        Application.Handle:=AHandle;
        ADO:= adoconn;
        ShowForm :=TForm3.Create(Application);
        try
            if ACaption<>'' then
            ShowForm.Caption:=ACaption;
            ShowForm.ShowModal;
            Result:=False;
        finally  
            ShowForm.Free;
        end;  
      end;

    procedure TForm3.Button1Click(Sender: TObject);
    begin
      self.ADOQuery1.Connection:=ADO;
      with  self.ADOQuery1 do
      begin
         Connection:=ADO;
         close;
         SQL.Clear;
         SQL.Add('select top 1 * from master');
         open;
      end;
    end;

    end.
  • 相关阅读:
    docker添加sudo权限
    服务器出口ip
    flask
    ACM-奇特的立方体
    ACM-牛喝水
    ACM-可乐兑换
    ACM-Work Assignment
    ACM-DFS Template
    ACM-Checker Challenge
    ACM-Divide Tree
  • 原文地址:https://www.cnblogs.com/azhai/p/1595114.html
Copyright © 2011-2022 走看看