Jed Posted April 9, 2010 Posted April 9, 2010 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
KaFu Posted April 9, 2010 Posted April 9, 2010 Take a look at my Enforce Single Instance UDF for an example how to send and receive WM_COPYDATA infos in autoit. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now