silvercover Posted November 26, 2008 Share Posted November 26, 2008 (edited) Hi, I found below code somewhere on the net and it seems it's belong to 2007. so when I want to compile the code I get error message for UDFs. What's the equivalent for A3LMemory.au3 library and functions used in this code? expandcollapse popup#include <A3LMemory.au3> Global Const $WM_RUNSCRIPTCODE = 0x08C7 Global Const $RUNSCRIPTCODE_LOUD = 1 Global Const $RUNSCRIPTCODE_QUIET = 0 Local $iItem, $pMemory, $tMemMap, $pText ; get handle of MMB window (just insert MMB title as a parameter) $hwnd = WinGetHandle("Welcome!") ; autoit variable containing MMB function/variable, which you want to run from AutoIt ; for example Message box $stringToSend='Message("","OK")' ; or AutoIt variable send to MMB variable ; $AutoItVar = "This is an AutoIt variable" ; $stringToSend="test$='" & $AutoItVar & "'" ;and this is an example of passing AutoIt variable to MMB variable ;$stringToSend="test$='OK'" ; get length of passed string $slen = stringlen($stringToSend) +1 $str = "char[" & $slen & "]"; structure item must be "char" $struct= DllStructCreate($str); create a struct for the string so we can get a pointer to it if @error Then MsgBox(0,"","Error in DllStructCreate " & @error) exit endif $iItem = DllStructGetSize($struct); get structure size $pMemory = _Mem_CtrlInit($hwnd, $iItem, $tMemMap); init memory and return pointer to initialized memory in target app DllStructSetData($struct, 1, $stringToSend); set string to structure $pointer = DllStructGetPtr($struct,1); pointer to string in structure _Mem_CtrlWrite($tMemMap, $pointer, $pMemory, $iItem); write string pointer to application memory $result = DllCall("user32.dll","int","SendMessage","hWnd",$hwnd ,"int",$WM_RUNSCRIPTCODE,"int",$RUNSCRIPTCODE_LOUD,"ptr",$pMemory) If @error Then MsgBox(0,"_ToggleMonitor", "_SendMessage Error: " & @error) Exit EndIf _Mem_CtrlFree($tMemMap);release the memory Thanks Edited November 26, 2008 by silvercover The more I learn the less I know! Link to comment Share on other sites More sharing options...
Zedna Posted November 26, 2008 Share Posted November 26, 2008 #include <Memory.au3> Also look at Memory UDF on the forum. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
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