Private 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 Form_Load() ShellExecute Me.hwnd, "open", "c:\qq.lnk", vbNullString, vbNullString, vbNormalFocus End Sub
不会吧 ?? 我这怎么不可以 winxp sp1
来个简单点的~ winxp sp1 +vb6sp6通过测试 Option ExplicitPrivate Sub Command1_Click() Shell GetTargetPath("C:\Documents and Settings\bafony\桌面\RealOne.lnk") End SubFunction GetTargetPath(ByVal FileName As String)Dim Obj As Object Set Obj = CreateObject("WScript.Shell")Dim Shortcut As Object Set Shortcut = Obj.CreateShortcut(FileName) GetTargetPath = Shortcut.TargetPath Shortcut.SaveEnd Function
Private Sub Form_Load()
ShellExecute Me.hwnd, "open", "c:\qq.lnk", vbNullString, vbNullString, vbNormalFocus
End Sub
winxp sp1
winxp sp1 +vb6sp6通过测试
Option ExplicitPrivate Sub Command1_Click()
Shell GetTargetPath("C:\Documents and Settings\bafony\桌面\RealOne.lnk")
End SubFunction GetTargetPath(ByVal FileName As String)Dim Obj As Object
Set Obj = CreateObject("WScript.Shell")Dim Shortcut As Object
Set Shortcut = Obj.CreateShortcut(FileName)
GetTargetPath = Shortcut.TargetPath
Shortcut.SaveEnd Function