在DLL中无法用GetCurrentProcess函数获得调用它的EXE的句柄,是不是没有办法获得。还是通过EXE获得,传如DLL?

解决方案 »

  1.   

    project-options-package-build with runtime...打勾
      

  2.   

    不需要阿,我这里能够得到
    exe文件unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    procedure CallModule;stdcall;external 'project2.dll' name 'CallModule';
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      caption:=inttostr(GetCurrentProcess);
      CallModule;
    end;end.dll文件library Project2;
    uses
      SysUtils,dialogs,windows,
      Classes;
    {$R *.res}
    procedure CallModule;
    begin
      showmessage(inttostr(GetCurrentProcess));
    end;
    exports
      CallModule;
    begin
    end.