用vb制作的程序如何获取自己的安装路径?

2024-11-29 21:21:34
推荐回答(2个)
回答(1):

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
Dim WSH As Object, QQPath As String
Set WSH = CreateObject("Wscript.Shell")
QQPath = WSH.RegRead("HKLM\SOFTWARE\Tencent\PlatForm_Type_List\1\TypePath")
Set WSH = Nothing
ShellExecute 0&, "open", QQPath, vbNullString, vbNullString, 0&
End Sub

Private Sub Form_Load()
Command1.Caption = "QQ"
End Sub

回答(2):

print app.path
即可得到程序运行路径