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

📄 mainunit.pas

📁 Delphi窗体动态库,可对窗体各类资源进行仿问。
💻 PAS
字号:
unit MainUnit;

interface

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

type
  InvokeDLLForm = function(App: TApplication; Scr: TScreen;Instr:string;Inint:integer): TForm;
  TfrmMain = class(TForm)
    MainMenu1: TMainMenu;
    M_Invoke: TMenuItem;
    mi_inDLL: TMenuItem;
    mi_inGeneral: TMenuItem;
    m_Windows: TMenuItem;
    N4: TMenuItem;
    N5: TMenuItem;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    procedure mi_inDLLClick(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure mi_inGeneralClick(Sender: TObject);
    procedure N3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;
  DLLForm: TForm;
implementation

uses GeneralFormUnit, AboutUnit;

{$R *.dfm}

procedure TfrmMain.mi_inDLLClick(Sender: TObject);
var
  DLLHandle: THandle;
  DLLSub: InvokeDLLForm;
  //CreateDLLForm:function(App: TApplication; Scr: TScreen;Instr:string;dw:string;Inint:integer):TForm;
begin
  DLLHandle := LoadLibrary('prjDLL.dll');
  try
    if DLLHandle <> 0 then
    begin
      @DLLSub:=GetProcAddress(DLLHandle, 'CreateDLLForm');
      if Assigned(DLLSub) then
      begin
        DLLForm := DLLSub(Application, Screen,'dfg12313123',0);
      end;
    end;
  finally
    FreeLibrary(DLLHandle);
  end;
end;


{var
  DLLHandle: THandle;
  DLLSub: InvokeDLLForm;

begin
  DLLHandle := LoadLibrary('prjDLL.dll');
  if DLLHandle <> 0 then
  begin
    @DLLSub := GetProcAddress(DLLHandle, 'CreateDLLForm');
    if Assigned(DLLSub) then
    begin
      DLLForm := DLLSub(Application, Screen,'dfg12313123',0);
    end;
    //FreeLibrary(DLLHandle); //调用完毕收回DLL占用的资源
  end;

end; }

procedure TfrmMain.N2Click(Sender: TObject);
begin
  Showmessage('看看内容');
end;

procedure TfrmMain.mi_inGeneralClick(Sender: TObject);
begin
  Application.CreateForm(TfrmGeneralForm, frmGeneralForm);
end;

procedure TfrmMain.N3Click(Sender: TObject);
begin
 // Application.CreateForm(TfrmAbout, frmAbout);
 // frmAbout.Showmodal;
end;

end.

⌨️ 快捷键说明

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