Reputation: 21
I need to send a short string, (less than 30 bytes, but sent every second), from one VB application, to a Delphi application.. is this possible, using CopyDataStruct, WM_COPYDATA and SendMessage functions in Windows?
Upvotes: 1
Views: 948
Reputation: 156
This sounds like the kind of thing that you would use DDE to accomplish. Another way would be to write a string into a temporary area in the registry and then call the other program to read it and delete the temporary registry key once finished. You could also pass the string as a parameter in the command line and just exec the program.
Upvotes: 0
Reputation: 612854
I would say that WM_COPYDATA is the perfect way to do this. You just need to get your Delphi main form, say, to implement a message handler for WM_COPYDATA.
At the Delphi end it looks something like this:
TMyMainForm = class(TForm)
protected
procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
end;
procedure TMyMainForm.WMCopyData(var Msg: TWMCopyData);
begin
//do something with Msg.lpData
end;
Your VB code will need to obtain the window handle of your Delphi main form.
Upvotes: 3