如何截取DLL发送的消息?
project1.exe是一个无窗口程序,只有PROJECT1.DPR一个文件!
在PROJECT1.exe中调用Project2.dll的INSTALL函数,INSTALL函数负责发送自定义消息,请问在PROJECT.EXE如何截取这个消息?
program Project1;
uses
Messages,
Windows;
var
install:Procedure (han:THandle);stdcall;
{$R *.res}
begin
//主程序
lib:=loadlibrary(Pchar('project2.dll'));
try
if lib<>0 then
begin
install:=GetProcAddress(Lib,'InsTALL');
if @install<>nil then install(hInstance);
end;
Finally
FreeLibrary(lib);
end;
{如何截取project2.dll发送来的自定义消息}
end.
//................................................................//
library Project2;
uses
windows,messages;
{$R *.res}
Procedure install(Han:THandle);stdcall;
var
i:Integer;
begin
Postmessage(Han,Wm_USER,1,2);
end;
exports
install index 1;
begin
end.