先用API获得进程句柄,然后获得权限以后直接修改.........当初API入门的时候怀念i
ng.........
- Private Sub Command1_Click()
- If ToKen <> 0 Then
- Text1 = ""
- Dim PID As Long, Num_Reset As Long, HStr As String
- HStr = Right$("00000000" & Hex(Val(Text2)), 8)
- Num_Reset = "&H" & HStr
- PID = GetPid(vbNullString, "Form1")
- Text1 = "如果数据过大可能结果出错"
- Text1 = Text1 & vbCrLf & "权限已提至最高" '获取最高权限
- Text1 = Text1 + vbCrLf & "Form1的进程PID(进程标识符): " & PID
- Text1 = Text1 & vbCrLf & "初始数值:" & GetData(PID, &H145C84, 2)
- If SetData(PID, &H145C84, Num_Reset, 2) Then
- Text1 = Text1 & vbCrLf & "修改成功!"
- Text1 = Text1 & vbCrLf & "目前对应数值:" & GetData(PID, &H145C84, 2)
- End If
- Else
- Exit Sub
- Text1 = "修改失败!"
- End If
- End Sub
- '模块:
- Option Explicit
- '查找窗体写内存等
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
- Private