Jump to content
Sign in to follow this  

How to receive WM_COPYDATA?

Recommended Posts


Hi, I'm trying to use the Audiosurf API (see here) command

ascommand registerlistenerwindow MyWindowTitle

(see near the bottom of the top post for more info), so I can get the title and artist of the song that is being played, but I am totally confused as to how to receive WM_COPYDATA from another program. I have looked at several examples on the forum, but I need further explanation about how to use it, specifically for what I'm trying to do.


Share this post

Link to post
Share on other sites

This should receive and display a string send via WM_COPYDATA.

#include <windowsconstants.au3>

HotKeySet("{ESC}", "_Exit")

Global $sWM_COPYDATA_Received_String

$hgui = GUICreate("Receiving hWnd")

While 1
    If $sWM_COPYDATA_Received_String Then
        MsgBox(0, "Received String via WM_COPYDATA", $sWM_COPYDATA_Received_String)
        $sWM_COPYDATA_Received_String = ""

Func WM_COPYDATA($hWnd, $MsgID, $wParam, $lParam)
    ; http://www.autoitscript.com/forum/index.php?showtopic=105861&view=findpost&p=747887
    ; Melba23, based on code from Yashied

    Switch $hWnd
        Case $hgui
            Local $tCOPYDATA = DllStructCreate("dword;dword;ptr", $lParam)
            Local $tMsg = DllStructCreate("char[" & DllStructGetData($tCOPYDATA, 2) & "]", DllStructGetData($tCOPYDATA, 3))
            $sWM_COPYDATA_Received_String = DllStructGetData($tMsg, 1)


    Return True

EndFunc   ;==>WM_COPYDATA

Func _Exit()
EndFunc   ;==>_Exit

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.