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;useswindows,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.
在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;useswindows,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.
解决方案 »
- 把源码贴出来,请高手帮忙修改吓
- 跪求!制造业ERP的需求说明书或流程说明,百分相送,谢谢
- case语句提示变量有问题
- 请教delphi如何实现在Word中加入图片?
- 关于使用StringGrid控件的问题!
- 50分求Lotus ScreenCam软件
- 大家不要笑,一个最最基础问题
- 一年前的这个时候第一次接触DELPHI,一年后的今天发布一个新软件,请大家帮助测试!谢谢~~~新年快乐!!!^_^
- 這個問題怎么辦﹕Undeclared identifier: 'IOleInPlaceActiveObject'
- 咋样对图像翻转,如翻转90度
- 这样的数据库如何设计?----人事管理
- D7中,表Column的可见控制失灵??????????????????
其中明明有消息映射机制就是不行,MFC也不太熟悉,就发贴子问最终也没结果。
后来这样处理的:继承一个CStatic类(或者CButton总之能接收消息的CWnd)CStaticWnd,动态创建不可见的CStaticWnd控件,在CStaticWnd中处理消息。
你可以创建一个隐含窗体来处理消息,希望对你有所帮助。
WM_MyMessage := RegisterWindowMessage('test'); // 两端都这么写,WM_MyMessage就可以通用了The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system. The returned message value can be used when calling the SendMessage or PostMessage function. UINT RegisterWindowMessage( LPCTSTR lpString // address of message string
);
ParameterslpStringPoints to a null-terminated string that specifies the message to be registered. Return ValuesIf the message is successfully registered, the return value is a message identifier in the range 0xC000 through 0xFFFF.
If the function fails, the return value is zero.
const
AppName='mywin';
var
cls: TWndClass;
begin
FillChar (cls, sizeof (cls), 0);
cls.lpfnWndProc := @DummyWindowProc;
cls.hInstance := hInstance;
cls.lpszClassName := AppName;
RegisterClass (cls); //为什么只要引用Classes单元,这句就会无法编译。