首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

WshShell.Run 不能运行快捷方式了解决办法

2012-01-22 
WshShell.Run 不能运行快捷方式了set WshShell WScript.CreateObject(WScript.Shell)WshShell.Run c:

WshShell.Run 不能运行快捷方式了
set WshShell = WScript.CreateObject("WScript.Shell") 
WshShell.Run "c:\a.lnk",1 


WSHom.Ocx 已经注册过了.....

以下的也不行....怎么回事啊....

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 Const SW_HIDE = 0
Private Const SW_NORMAL = 1
Private Const SW_MAX = 10
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWDEFAULT = 10
Private Sub Command1_Click()
  ShellExecute Me.hwnd, "open", "C:\a.lnk", vbNullString, vbNullString, 1

End Sub




[解决办法]
上面我用C:\lin.lnk测试,正常.

Set WshShell = CreateObject("Wscript.Shell") 
WshShell.Run "c:\lin.lnk", 1 
也正常
我用的文件名是c:\lin.lnk,道理一样

热点排行