Der Pfad des Executables ist während der Laufzeit ja einfach zu ermitteln, mir unklar (da wohl WinAPI notwendig

Hoffe es kann jemand helfen, da Suche + CodeArchiv leider erfolglos.
Code: Alles auswählen
Structure EMID
cb.b
abID.b[1]
EndStructure
Structure ITEMIDLIST
mkid.EMID
EndStructure
Procedure CreateShortcut(Path.s, Link.s, WorkingDir.s, Argument.s, ShowCommand.l, Description.s, HotKey.l, IconFile.s, IconIndex.l)
CoInitialize_(0)
If CoCreateInstance_(?CLSID_ShellLink,0,1,?IID_IShellLink,@psl.IShellLinkA) = 0
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.IPersistFile) = 0
mem.s = Space(1000)
MultiByteToWideChar_(#CP_ACP, 0, Link, -1, mem, 1000)
hres = ppf\Save(@mem,#True)
Result = 1
ppf\Release()
EndIf
psl\Release()
EndIf
CoUninitialize_()
ProcedureReturn Result
DataSection
CLSID_ShellLink:
Data.l $00021401
Data.w $0000,$0000
Data.b $C0,$00,$00,$00,$00,$00,$00,$46
IID_IShellLink:
Data.l $000214EE
Data.w $0000,$0000
Data.b $C0,$00,$00,$00,$00,$00,$00,$46
IID_IPersistFile:
Data.l $0000010B
Data.w $0000,$0000
Data.b $C0,$00,$00,$00,$00,$00,$00,$46
EndDataSection
EndProcedure
Procedure.s GetAppName()
AppName.s = Space(#MAX_PATH)
GetModuleFileName_(GetModuleHandle_(0), @AppName, #MAX_PATH)
ProcedureReturn AppName
EndProcedure
Procedure.s GetSpecialeFolder(folder.l)
*itemid.ITEMIDLIST = #Null
If SHGetSpecialFolderLocation_ (0, folder, @*itemid) = #NOERROR
location.s = Space (#MAX_PATH)
If SHGetPathFromIDList_ (*itemid, @location)
If Right(location, 1) <> "\" : location + "\" : EndIf
ProcedureReturn location
EndIf
EndIf
EndProcedure
#CSIDL_DESKTOP = 0
#CSIDL_PROGRAMS = 2
Debug GetSpecialeFolder(#CSIDL_DESKTOP)
Debug GetSpecialeFolder(#CSIDL_PROGRAMS)
Debug GetAppName()
Code: Alles auswählen
CreateShortcut("C:\Windows\System32\Notepad.exe","C:\Super Notepad.lnk","","NotePAD is a lightweight editor","",#SW_SHOWMAXIMIZED,"%SystemRoot%\system32\SHELL32.dll",12)