Code: Select all
Macro DEFINE_GUID(Name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
CompilerIf Defined(Name, #PB_Variable)
If SizeOf(Name) = SizeOf(GUID)
Name\Data1 = l
Name\Data2 = w1
Name\Data3 = w2
Name\Data4[0] = b1
Name\Data4[1] = b2
Name\Data4[2] = b3
Name\Data4[3] = b4
Name\Data4[4] = b5
Name\Data4[5] = b6
Name\Data4[6] = b7
Name\Data4[7] = b8
Else
Debug "Error - variable not declared as guid"
EndIf
CompilerEndIf
EndMacro
Procedure CreateShortcut(Path.s, Link.s, WorkingDir.s = "", Argument.s = "", ShowCommand.l = #SW_SHOWNORMAL, Description.s = "", HotKey.l = #Null, IconFile.s = "|", IconIndex.l = 0)
Protected psl.IShellLinkW, ppf.IPersistFile, Result
Protected.GUID CLSID_ShellLink, IID_IShellLink, IID_IPersistFile
DEFINE_GUID(CLSID_ShellLink, $00021401, $0000,$0000, $C0, $00, $00, $00, $00, $00, $00, $46) ; {00021401-0000-0000-C000-000000000046}
DEFINE_GUID(IID_IShellLink, $000214F9, $0000,$0000, $C0, $00, $00, $00, $00, $00, $00, $46) ; {000214F9-0000-0000-C000-000000000046}
DEFINE_GUID(IID_IPersistFile, $0000010B, $0000,$0000, $C0, $00, $00, $00, $00, $00, $00, $46); {0000010b-0000-0000-C000-000000000046}
If IconFile = "|" : IconFile = Path : EndIf
CoInitialize_(0)
If CoCreateInstance_(@CLSID_ShellLink, 0, 1, @IID_IShellLink, @psl) = #S_OK
Set_ShellLink_preferences:
psl\SetPath(Path)
psl\SetArguments(Argument)
psl\SetWorkingDirectory(WorkingDir)
psl\SetDescription(DESCRIPTION)
psl\SetShowCmd(ShowCommand)
psl\SetHotkey(HotKey)
psl\SetIconLocation(IconFile, IconIndex)
ShellLink_SAVE:
If psl\QueryInterface(@IID_IPersistFile, @ppf) = #S_OK
ppf\Save(Link, #True)
result = 1
ppf\Release()
EndIf
psl\Release()
EndIf
CoUninitialize_()
ProcedureReturn result
EndProcedure
listptr = 0
result$=Space(270)
SHGetSpecialFolderLocation_(0,#CSIDL_STARTUP,@listptr)
SHGetPathFromIDList_(listptr,@result$)
Path$ = Trim(result$)
CreateShortcut("C:\pb_player\pb_player.exe",Path$+"\rashad.lnk","","",#SW_SHOWMAXIMIZED,"",#Null,"%SystemRoot%\system32\SHELL32.dll",12)