pb创建快捷方式

来源:互联网 发布:这个世界的真相知乎 编辑:程序博客网 时间:2024/06/05 09:16
OLEObject lole_WshShell,lole_ShellLink
Integer li_rc
 
lole_WshShell = CREATE OLEObject
li_rc = lole_WshShell.ConnectToNewObject("WScript.Shell"
IF li_rc < 0 THEN     
    DESTROY lole_WshShell
    MessageBox("连接OLE失败""错误代号: " + String(li_rc)) 
    Return 
END IF
 
lole_ShellLink = lole_WshShell.CreateShortcut("D:\QQ.lnk")//快捷方式文件名称
lole_ShellLink.TargetPath = "C:\Program Files (x86)\Tencent\QQ\Bin\QQScLauncher.exe"//目标文件
lole_ShellLink.WindowStyle = 1
lole_ShellLink.Description = "QQ"//快捷方式描述
lole_ShellLink.WorkingDirectory = "C:\Program Files (x86)\Tencent\QQ\Bin\"//工作路径
lole_ShellLink.Save//保存快捷方式
          
destroy lole_ShellLink
DESTROY lole_WshShell
OLEObject lole_WshShell,lole_ShellLinkInteger li_rc lole_WshShell = CREATE OLEObjectli_rc = lole_WshShell.ConnectToNewObject("WScript.Shell") IF li_rc < 0 THEN         DESTROY lole_WshShell    MessageBox("连接OLE失败", "错误代号: " + String(li_rc))     Return END IF lole_ShellLink = lole_WshShell.CreateShortcut("D:\QQ.lnk")//快捷方式文件名称lole_ShellLink.TargetPath = "C:\Program Files (x86)\Tencent\QQ\Bin\QQScLauncher.exe"//目标文件lole_ShellLink.WindowStyle = 1lole_ShellLink.Description = "QQ"//快捷方式描述lole_ShellLink.WorkingDirectory = "C:\Program Files (x86)\Tencent\QQ\Bin\"//工作路径lole_ShellLink.Save//保存快捷方式          destroy lole_ShellLinkDESTROY lole_WshShell

原创粉丝点击