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

📄 udllform.pas

📁 Dll进程注入 一种简单的方法隐藏进程 在dll中运行代码
💻 PAS
字号:
unit uDllForm;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

procedure fShowForm; stdcall;
procedure fRunApp;stdcall;

implementation

{$R *.dfm}
procedure fShowForm;
begin
 {if you simply create a form, you need to show it as modal or it
  will just flash briefly and close immediately.
  You could just as well put any other code here.

  NOTE : If the form is still open when host app is closed,
  it will cause an error message to appear.
  
  This problem *will not happen* if you don't show/create any
  forms, even if the thread is still running when host process
  terminates (though the thread will get terminated too).}

 Form1:=tform1.Create(application);
 form1.ShowModal;
 form1.Free;
end;

procedure fRunApp;stdcall;
begin
 {Run as usual, but don't forget to free the form
  Same notes apply as for fShowForm (see above).
  You might also consider looking for Application.Handle in Delphi Help...}
 Application.Initialize;
 Application.CreateForm(TForm1,Form1);
 Application.Run;
 Form1.Free;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 //just show a message
 Showmessage('It works! :)');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 //show some interesting info
 memo1.Lines.Add('Application.ExeName : '+application.ExeName);
 memo1.Lines.Add('Paramstr(0) : '+paramstr(0));
 memo1.Lines.Add('Current process ID : '+inttostr(GetCurrentProcessId));
 memo1.lines.Add('Module name : '+GetModuleName(GetModuleHandle(nil)));
 memo1.lines.Add('Application.Handle : '+inttostr(Application.Handle));
end;

end.

⌨️ 快捷键说明

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