[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

wm_copydata how to use it

Posted on 2002-03-23
3
Medium Priority
?
1,261 Views
Last Modified: 2012-06-27
hi,

i was wondering what wm_copydata and copydatastruct does can anyone give me an example?

cheers
classic_gaming
0
Comment
Question by:classic_gaming
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6891000
Not an example at hand, but it is easy.
The whole data block is copead by Windows from the address space of the sending apllication to the address space of the receiving application.
So all data has to be in a single block of memory and you have to state the length of the data.
This means no Pascal strings among other things.
0
 
LVL 17

Accepted Solution

by:
inthe earned 400 total points
ID: 6891012
hi,
you use WM_COPYDATA  to send data to another app,for
an example make 2 projects:

put a edit in the first and the following ( listener ) :


  public
    { Public declarations }
    procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMCopyData(var Msg: TWMCopyData);
begin
 Edit1.Text := PChar(Msg.CopyDataStruct^.lpData);
end;



in the second project ( the sender ) put a button and a edit and the following :

procedure TForm1.Button1Click(Sender: TObject);
var
 copydata: TCopyDataStruct;
begin
 with copydata do
  begin
   dwData := 0;
   cbData := Length(Edit1.Text) + 1;
   GetMem(lpData, cbData);
   StrCopy(lpData, PChar(Edit1.Text));
  end;
SendMessage(HWND_BROADCAST,WM_COPYDATA,WPARAM(Form1.Handle),LParam(@copydata));
 FreeMem(copydata.lpData);
end;



clicking the button on app2 will send the edits data to the edit on app 1.
hopefully that is of some use :)

Regards Barry
0
 

Author Comment

by:classic_gaming
ID: 7211067
sorry i kept it so long forgot about it :)

cheers
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question