首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

writeprocessmemory写入不成功有关问题

2012-01-12 
writeprocessmemory写入不成功问题dima1aslongdimb1aslonga1&H65f010b1&H65f00c请教一下writeprocessmem

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

热点排行