【发布时间】:2015-11-21 09:49:12
【问题描述】:
我有两个使用一个通用 DLL 的应用程序。从应用程序“A”我发送了一条带有字符串参数的消息,如下所示
txt := 'Test String'
SendMessage(Handle, MyMessage, 0, lParam(PChar(txt)));
在同一个 DLL 中,我有另一个函数来读取该消息,但我收到了一条空消息。我不知道我在哪里做错了。
procedure MyClass.WndMethod(var Msg: TMessage);
var
Str: string;
begin
case Msg.Msg of
MyMessage:
begin
Str := string(PChar(Msg.LParam));
ShowMessage(Str); // Empty message
end;
end;
【问题讨论】:
-
是否适用于使用
WM_COPYDATA,如此处所述stackoverflow.com/questions/10126342/…? -
@SevenEleven 我也这样做了,但我收到了一条空消息。
标签: delphi dll sendmessage