发送消息:
#include <winapi.au3>
$hwnd = WinGetHandle('Msg_Catcher')
$message = 'some text'
$struct = DllStructCreate('char var1[1000]')
DllStructSetData($Struct,1,$message)
$pStruct = DllStructGetPtr($struct)
$struct2 = DllStructCreate('dword;dword;ptr')
DllStructSetData($struct2,1,0)
DllStructSetData($struct2,2,1000)
DllStructSetData($struct2,3,$pStruct)
$pStruct2 = DllStructGetPtr($struct2)
_SendMessage($hwnd, 0x4A, 0, $pStruct2)
接收消息:
;receiver
#include <winapi.au3>
GUICreate('Msg_Catcher')
GUIRegisterMsg(0x4A, '_Func')
While 1
Sleep(1000)
WEnd
Func _Func($hWnd, $iMsg, $iwParam, $ilParam)
$a = DllStructCreate('dword var1;dword var2;ptr var3', $ilParam)
$b = DllStructGetData($a, 3)
$c = DllStructCreate('char var1[1000]',$b)
$d = DllStructGetData($c, 1)
MsgBox(0, 'receiver', $d)
EndFunc
这个方法显示中文出现了问题,类似的毛病以前也遇到过,应该是au3的bug
[ 本帖最后由 zcbenz 于 2008-8-24 18:32 编辑 ] |