Jump to content

Recommended Posts

Posted

but it doesent work right...

only the 'int' part of the struct is forwarded

Server:

Global Const $WM_USER = 0x400
Global Const $UM_AU3MESSAGE = $WM_USER + 0x125
Global Const $STRUCTDEF_AU3MESSAGE = "char[256];int"

$hWnd_Main = GUICreate("Au3MessageServer")
GUIRegisterMsg($UM_AU3MESSAGE,"_Au3Message")
Func _Au3Message($hWnd, $MsgID, $WParam, $LParam)
; $WParam = Pointer
    $Au3Message2 = DllStructCreate($STRUCTDEF_AU3MESSAGE,$LParam)
    MsgBox(0,"Server","Struct Size = " & DllStructGetSize($Au3Message2))
    MsgBox(0,"Server","Struct 1 = " & DllStructGetData($Au3Message2,1))
    MsgBox(0,"Server","Struct 2 = " & DllStructGetData($Au3Message2,2))
    Return @AutoItPID
EndFunc
While 1
    Sleep(250)
WEnd
Client:
Global Const $WM_USER = 0x400
Global Const $UM_AU3MESSAGE = $WM_USER + 0x125
Global Const $STRUCTDEF_AU3MESSAGE = "char[256];int"

$hWnd_Server = WinGetHandle("Au3MessageServer")
$Au3Message1 = DllStructCreate($STRUCTDEF_AU3MESSAGE)
DllStructSetData($Au3Message1,1,"Test Blah Blah ...")
DllStructSetData($Au3Message1,2,7568)
MsgBox(0,"Client","Struct Size = " & DllStructGetSize($Au3Message1))
$r = DllCall("user32.dll","int","SendMessage", _
            "hWnd",$hWnd_Server, _
            "int",$UM_AU3MESSAGE, _
            "int",0, _
            "int",DllStructGetPtr($Au3Message1))
$Au3Message1 = 0
MsgBox(0,"Client","Server Return (Pid) = " &$r[0])
; Kill Server
ProcessClose($r[0])

any idea why DllStructGetData($Au3Message1,1) doesent return "Test Blah Blah ..." ?

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

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
  • Recently Browsing   0 members

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