谁能帮我把VB语句转换成VS2012 VB代码?谢谢
DimWshShell,ttplayPathSetWshShell=CreateObject("WScript.Shell")OnErrorResumeNextGSCSP...
Dim WshShell, ttplayPath
Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
GSCSPath = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\QQQ.exe\")
If Err Then
Shell "QQQ.exe"
Else
MsgBox "已经安装,请先卸载"
End If
=================================================================================
Dim WshShell, GSCSPath
Dim s As String
Dim i
Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
GSCSPath = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\QQQ.exe\")
If Err Then
MsgBox "您没有安装QQQ"
Else
i = InStrRev(GSCSPath, "\")
GSCSPath = Left$(GSCSPath, i - 1)
Shell "taskkill /f /im QQQ.exe", vbMinimizedNoFocus
Shell GSCSPath & "\UninsHs.exe"
Dim WehShell, a
Set WehShell = CreateObject("WScript.Shell")
aa = WehShell.SpecialFolders("Desktop")
Kill aa & "\QQQ.lnk"
End If 展开
Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
GSCSPath = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\QQQ.exe\")
If Err Then
Shell "QQQ.exe"
Else
MsgBox "已经安装,请先卸载"
End If
=================================================================================
Dim WshShell, GSCSPath
Dim s As String
Dim i
Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
GSCSPath = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\QQQ.exe\")
If Err Then
MsgBox "您没有安装QQQ"
Else
i = InStrRev(GSCSPath, "\")
GSCSPath = Left$(GSCSPath, i - 1)
Shell "taskkill /f /im QQQ.exe", vbMinimizedNoFocus
Shell GSCSPath & "\UninsHs.exe"
Dim WehShell, a
Set WehShell = CreateObject("WScript.Shell")
aa = WehShell.SpecialFolders("Desktop")
Kill aa & "\QQQ.lnk"
End If 展开
1个回答
展开全部
Dim Reg As Microsoft.Win32.RegistryKey
Reg = My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\QQQ.exe")
If Reg IsNot Nothing Then
With Reg.GetValue("Path", "")
If .ToString <> "" AndAlso IO.File.Exists(.ToString) Then
For Each i As Process In Process.GetProcesses
If i.ProcessName = "QQQ.exe" Then i.Kill()
Next
Call Shell(IO.Path.GetDirectoryName(.ToString) & "\UninsHs.exe")
Dim DesktopDirectory As String
DesktopDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
DesktopDirectory &= "\QQQ.lnk"
If IO.File.Exists(DesktopDirectory) Then
My.Computer.FileSystem.DeleteFile(DesktopDirectory)
End If
End If
End With
Else
MsgBox("没有安装QQQ.exe!!!")
End If
Reg = My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\QQQ.exe")
If Reg IsNot Nothing Then
With Reg.GetValue("Path", "")
If .ToString <> "" AndAlso IO.File.Exists(.ToString) Then
For Each i As Process In Process.GetProcesses
If i.ProcessName = "QQQ.exe" Then i.Kill()
Next
Call Shell(IO.Path.GetDirectoryName(.ToString) & "\UninsHs.exe")
Dim DesktopDirectory As String
DesktopDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
DesktopDirectory &= "\QQQ.lnk"
If IO.File.Exists(DesktopDirectory) Then
My.Computer.FileSystem.DeleteFile(DesktopDirectory)
End If
End If
End With
Else
MsgBox("没有安装QQQ.exe!!!")
End If
追答
我的路径是通过注册表获取的。对照我的注册表。
在注册表QQQ.EXE目录下,有一个子键path,它的值应该是QQQ。exe的路径。
如果你写入注册表的方式并非这样,肯定运行不起来。
把SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\QQQ.exe这部分注册表的截图发来看看。
——把path删除,只留下双引号试试。即获取注册表qqq.exe目录下的默认键和它的值。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询