I'm new to Delphi and I try to write an experimental plugin for a program in Lazarus. I found a free source code from a different plugin and I try to base on it. My plugin should received the message sent by the program and insert a string into an edit line. So far I have managed to implement a handler to the program. However, I stuck with CopyDataStruct, which works with a message sent by the main program.
UPDATE I think the feedback from Marco van de Voort might explain the source of the problem. I did some research after finding a tutorial and it seems that those messages are simply lost.
So that I rewrite my code including:
function WndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam; lParam: LParam):LRESULT; stdcall;
begin
case uMsg of WM_COPYDATA:
begin
Result := TForm1.WMCopyData();
exit;
end;
else
Result := CallWindowProc(PrevWndProc, Ahwnd, uMsg, WParam, LParam);
end;
end;
as well as
PrevWndProc:=Windows.WNDPROC(SetWindowLongPtr(Self.Handle,GWL_WNDPROC,PtrInt(@WndCallback)));
in FormCreate section.
Now, I got an error with Result := TForm1.WMCopyData(); I'm not sure what parameters should be passed into this function. It is declared as: TForm1.WMCopyData(var Msg: TCopyDataStruct); but neither 'Msg' nor 'TCopyDataStruct' works. Could you help me with it?