VB如何创建快捷方式?

2025-03-01 19:01:41
推荐回答(5个)
回答1:

不用API的源码!

如下:

'**********************VB.VBS***********************
Set WshShell = CreateObject("Wscript.shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oMyShortcut = WshShell.CreateShortcut(strDesktop + "\女孩.lnk") '此处为快捷名称
oMyShortcut.IconLocation = "" '此处为快捷图标
oMyShortcut.TargetPath = "%windir%\system32\cmd.exe" '此处为源文件
oMyShortcut.Hotkey = "ALT+CTRL+C" ''此处为快捷热键
oMyShortcut.Save

'***************************************************

‘如果要删除此快捷方式,只需将里面的各选项设为空,再次执行该源码就好

回答2:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'先设置 Form1.KeyPreview = True
    If KeyCode = vbKeyD And Shift = 2 Then'CTRL+D
        End 'or Unload Me
    End If
End Sub

回答3:

Private Declare Function fCreateShellLink Lib "vb5stkit.dll" _
(ByVal Forder As String, ByVal ShortCutName As String, _
ByVal ExePath As String, ByVal Params As String) As Long

Dim ret As Long
'放在DeskTop
ret = fCreateShellLink("..\..\Desktop", "MyName", "c:\tools\spe3\pe2.exe", "")
'放在开始功能表
ret = fCreateShellLink("..", "MyName", "c:\tools\spe3\pe2.exe", "")
'放在程式集功能表
ret = fCreateShellLink(".", "MyName", "c:\tools\spe3\pe2.exe", "")

回答4:

系统自带的没办法实现!

回答5:

你想问的是什么问题?