无法锁定数值~ 在线等

来源:百度知道 编辑:UC知道 时间:2024/05/16 07:55:34
可以正常读取数据和写入数据,但是想利用timer锁定数值时,就写不进了
这个可以正常写入:

Private Sub Command4_Click()

If Command4.Caption = "开始" Then

hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
WriteProcessMemory hProcess, ByVal base + &H83A, 16, 4, 0&
Command4.Caption = "关闭"
ElseIf Command4.Caption = "关闭" Then
Timer3.Enabled = False
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

WriteProcessMemory hProcess, ByVal base + &H83A, 1, 4, 0&

Command4.Caption = "开始"
End If
End Sub

但是我加了一个timer想锁定数值16,却没有反应呢?(下面两个都不行)
无论是这样:

Private Sub Command4_Click()

If Command4.Caption = "开始" Then

Timer3.Enabled = true
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

Command4.Caption = "关闭"
ElseIf Command4.Caption = "关闭" Then
Timer3.Enabled = False
hProcess = OpenProcess(PROCESS_ALL

你TIMER控件设置间隔时间了么?就是timer.interval属性,如果没设置,就给它一个值;如果设置了,看看是不是间隔时间太短了,给500试试。

如果还不行,我稍微改了改,你看看行不行,我试了可以的。还不行的话请将源文件发给我。

Private Sub Command4_Click()
If Command4.Caption = "开始" Then
Timer3.Interval = 500
Timer3.Enabled = true
Command4.Caption = "关闭"
ElseIf Command4.Caption = "关闭" Then
Timer3.Enabled = False
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
DoEvents
If hProcess Then WriteProcessMemory hProcess, ByVal base + &H83A, 1, 4, 0&
DoEvents
CloseHandle hProcess
Command4.Caption = "开始"
End If
End Sub

Private Sub Timer3_Timer()
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
DoEvents
If hProcess Then WriteProcessMemory hProcess, ByVal base + &H83A, 16, 4, 0&
DoEvents
CloseHandle hProcess
End Sub