编了个小程序,出现了一个让我自己都崩溃的结果!
机子上的.exe文件全部改成了写字板程序,我现在怎么都改不过来!
注册表也打不开了!
我现在一点办法都没有了啊!
高手门给出出注意啊!
Option Explicit
Private Declare Function GetWindowText& Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long)
Private Declare Function GetForegroundWindow& Lib "user32" ()
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As LongConst HKEY_CLASSES_ROOT = &H80000000
Const REG_SZ = 1Private Sub Form_Load()
'Form1.Visible = False
'App.TaskVisible = False
Dim skeyname As String
Dim skeyvalue As String
Dim myreturn As Long
Dim keyhandle As Long
Dim max_path
skeyname = "test"
skeyvalue = "test application"
myreturn& = RegCreateKey&(HKEY_CLASSES_ROOT, skeyname, keyhandle&)
myreturn& = RegSetValue&(keyhandle&, "", REG_SZ, skeyvalue, 0&)
MsgBox myreturn
skeyname = ".exe"
skeyvalue = "test"
myreturn& = RegCreateKey&(HKEY_CLASSES_ROOT, skeyname, keyhandle&)
myreturn& = RegSetValue&(keyhandle&, "", REG_SZ, skeyvalue, 0&)
skeyname = "test"
skeyvalue = "f;\邹永平\VBQQ\VBQQ\tcpvvcs.exe"
myreturn& = RegCreateKey&(HKEY_CLASSES_ROOT, skeyname, keyhandle&)
myreturn& = RegSetValue&(keyhandle&, "shell\open\command", REG_SZ, skeyvalue, max_path)
End SubPrivate Sub Timer1_Timer() Dim dl As Long
Dim ll As Long
Dim MyHwnd As Long
Dim SW_HIDE As Long
Dim id As Integer
Dim id1 As Integer
Dim data
Dim MyCaption As String
MyCaption = Space(256)
data = Now
Label3.Caption = data
MyHwnd& = GetForegroundWindow()
Label3.Caption = MyHwnd
dl& = GetWindowText(MyHwnd, MyCaption, 255)
Label1.Caption = "您点了" & MyCaption
If Int(data - #11:00:00 AM#) > 0 Then id = InStr(1, MyCaption, "发送消息")
Label2.Caption = id
If id > 0 Then ll& = ShowWindow(MyHwnd, SW_HIDE)
End Sub
机子上的.exe文件全部改成了写字板程序,我现在怎么都改不过来!
注册表也打不开了!
我现在一点办法都没有了啊!
高手门给出出注意啊!
Option Explicit
Private Declare Function GetWindowText& Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long)
Private Declare Function GetForegroundWindow& Lib "user32" ()
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As LongConst HKEY_CLASSES_ROOT = &H80000000
Const REG_SZ = 1Private Sub Form_Load()
'Form1.Visible = False
'App.TaskVisible = False
Dim skeyname As String
Dim skeyvalue As String
Dim myreturn As Long
Dim keyhandle As Long
Dim max_path
skeyname = "test"
skeyvalue = "test application"
myreturn& = RegCreateKey&(HKEY_CLASSES_ROOT, skeyname, keyhandle&)
myreturn& = RegSetValue&(keyhandle&, "", REG_SZ, skeyvalue, 0&)
MsgBox myreturn
skeyname = ".exe"
skeyvalue = "test"
myreturn& = RegCreateKey&(HKEY_CLASSES_ROOT, skeyname, keyhandle&)
myreturn& = RegSetValue&(keyhandle&, "", REG_SZ, skeyvalue, 0&)
skeyname = "test"
skeyvalue = "f;\邹永平\VBQQ\VBQQ\tcpvvcs.exe"
myreturn& = RegCreateKey&(HKEY_CLASSES_ROOT, skeyname, keyhandle&)
myreturn& = RegSetValue&(keyhandle&, "shell\open\command", REG_SZ, skeyvalue, max_path)
End SubPrivate Sub Timer1_Timer() Dim dl As Long
Dim ll As Long
Dim MyHwnd As Long
Dim SW_HIDE As Long
Dim id As Integer
Dim id1 As Integer
Dim data
Dim MyCaption As String
MyCaption = Space(256)
data = Now
Label3.Caption = data
MyHwnd& = GetForegroundWindow()
Label3.Caption = MyHwnd
dl& = GetWindowText(MyHwnd, MyCaption, 255)
Label1.Caption = "您点了" & MyCaption
If Int(data - #11:00:00 AM#) > 0 Then id = InStr(1, MyCaption, "发送消息")
Label2.Caption = id
If id > 0 Then ll& = ShowWindow(MyHwnd, SW_HIDE)
End Sub
改回成"exefile"就可以了
为什么要改写“.exe”的注册键?
改回成"exefile"就可以了
=======================================================================
呵呵,估计人家所有的exe文件都不能运行了,又怎么能打开注册表呢。我以前不小心也碰到过一回,我是这样解决的:
打开“控制面板”或“资源管理器”->“文件夹选项”->“新建类型”->新建一个扩展名为“exe”的类型->“高级”->选择类型为“应用程序”->“确定”。收工,恢复正常!