03-10-2009, 08:29 PM
For QM 2.3.0 and older. It is available in QM 2.3.1 as __ProcessMemory.
Macro
Macro
;Allocates, writes and reads memory in context of other process.
;Use this instead of function share(), which is too limited and unsafe.
;EXAMPLES
out
#compile CProcessMemory
CProcessMemory m
int w1=win("Form1")
m.Alloc(w1 4*1024) ;;4 KB
;m.Alloc(ProcessNameToId("explorer") 4*1024 1)
;WriteStr/ReadStr
m.WriteStr("test")
str s
m.ReadStr(s 4)
out s
;WriteStr/ReadStr UTF-16
m.WriteStr("test" 0 1)
str s4
m.ReadStr(s4 8 0 1)
out s4
;Write/Read with str
int n=1024
str s2.all(n 2 'm')
m.Write(s2 n)
str s3.all(n 2)
m.Read(s3 n)
out s3
;Write/Read with variable
LVITEM li li2
li.lParam=15
m.Write(&li sizeof(li) 500)
m.Read(&li2 sizeof(li) 500)
out li2.lParam