writeprocessmemory写入不成功问题
dim a1 as long
dim b1 as long
a1 = &H65f010
b1 = &H65f00c
请教一下writeprocessmemory hprocess,byval a1, "100 ",2,0能写入成功,为什么writeprocessmemory hprocess,byval a1,b1,2,0(b1 = 100)又不能写入呢?
[解决办法]
Private Declare Function WriteProcessMemory Lib "kernel32.dll " (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
对于api函数声明 As Any 的参数,调用时要按数值传递,增加byval
writeprocessmemory hprocess,byval a1,byval b1,2,0(b1 = 100)
[解决办法]
writeprocessmemory hprocess,byval a1, "100 ",2,0 <-这里写入字符串 "100 "
writeprocessmemory hprocess,byval a1,b1,2,0 <-这里写入整数 100