Jump to content
Sign in to follow this  

What's the equivalent for A3LMemory.au3 library

Recommended Posts



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?

#include <A3LMemory.au3>

Global Const $WM_RUNSCRIPTCODE = 0x08C7
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
; 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

; 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)

$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)

_Mem_CtrlFree($tMemMap);release the memory


Edited by silvercover

The more I learn the less I know!

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.