ReadMemory v1 to v2

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
lightright
Posts: 11
Joined: 13 Mar 2023, 19:20

ReadMemory v1 to v2

Post by lightright » 27 Mar 2023, 03:39

Code: Select all

ReadMemory(MADDRESS,PROGRAM,byte := 4)
{
	pid := WingetID("ahk_id" PROGRAM)
	VarSetCapacity(MVALUE,4,0)  ;<<<< error
	ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
	DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
	Loop (byte)
	result += *(&MVALUE + A_Index-1) << 8*(A_Index-1) ;<<<<< error
	return, result
}
I need help as my code, which used ReadMemory function in AutoHotkey v1, is not working after I migrated it to v2.

Return to “Ask for Help (v2)”