Jump to content

Recive WM_COPYDATA message?


 Share

Recommended Posts

I want to recive messages from another program. I got a Delphi Pascal example as follow.

type

TCopyDataType = (cdtRpt = 1, cdtRptRT = 2);

TReceiverForm = class(TForm)

private

procedure WMCopyData(var Msg : TWMCopyData); message WM_COPYDATA;

procedure HandleCopyDataString(copyDataStruct : PCopyDataStruct);

public

end;

procedure TReceiverForm.HandleCopyDataString(copyDataStruct: PCopyDataStruct);

var

s : string;

begin

s := PChar(copyDataStruct.lpData);

end;

procedure TReceiverForm.WMCopyData(var Msg: TWMCopyData);

var

copyDataType : TCopyDataType;

begin

copyDataType := TCopyDataType(Msg.CopyDataStruct.dwData);

case copyDataType of

cdtRpt, cdtRptRT:

HandleCopyDataString(Msg.CopyDataStruct);

end;

end;

Then I try to wrote some autoit code below, but I can't finish it. Could anyone help me?

#include <GUIConstants.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Autoit Form", 508, 579, 193, 125)
GUIRegisterMsg($WM_COPYDATA, "MY_WM_COPYDATA")
$Edit1 = GUICtrlCreateEdit("", 0, 0, 505, 577)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func MY_WM_COPYDATA($hWnd, $MsgID, $WParam, $LParam)

?????

EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...