hab euch mal wieder was gebastelt. Wenn ihr den unteren Code ausführt, achtet darauf, dass ihr den Dateinamen in
Code: Alles auswählen
GetShellLinkInfo("C:\Dokumente und Einstellungen\Daniel\Desktop\Trillian.lnk", @SLI.ShellLinkInfo)
Code: Alles auswählen
Structure ShellLinkInfo
;Longs
IconIndex.l
ShowCmd.l
Hotkey_VK.l
Hotkey_MOD.l
;Strings
Target.s
Description.s
WorkingDirectory.s
Arguments.s
IconLocation.s
EndStructure
Procedure.l LowByte(Word.w)
ProcedureReturn PeekB(@Word )
EndProcedure
Procedure.l HighByte(Word.w)
ProcedureReturn PeekB(@Word+1)
EndProcedure
Procedure GetShellLinkInfo(ShellLink.s, *p.ShellLinkInfo)
Dim LinkFile.w(Len(ShellLink))
MultiByteToWideChar_(#CP_ACP, 0, ShellLink, -1, LinkFile(), Len(ShellLink)) ;We need a WideChar version of the ShellLink.s
*Buf = AllocateMemory(1024)
Hotkey.w = 0
Result = 0
If *Buf <> 0
CoInitialize_(0)
If CoCreateInstance_(?CLSID_ShellLink,0,1,?IID_IShellLink,@psl.IShellLinkA) >= 0
If psl\QueryInterface(?IID_IPersistFile, @ppf.IPersistFile) >= 0
If ppf\Load(@LinkFile(), 1) >= 0 ;Icon loaded?
;Get the target
psl\GetPath(*Buf, 1024, 0, 0)
*p\Target = PeekS(*Buf)
RtlFillMemory_(*Buf, 1024, 0)
;Get the description
psl\GetDescription(*Buf, 1024)
*p\Description = PeekS(*Buf)
RtlFillMemory_(*Buf, 1024, 0)
;Get the working directory
psl\GetWorkingDirectory(*Buf, 1024)
*p\WorkingDirectory = PeekS(*Buf)
RtlFillMemory_(*Buf, 1024, 0)
;Get the arguments
psl\GetArguments(*Buf, 1024)
*p\Arguments = PeekS(*Buf)
RtlFillMemory_(*Buf, 1024, 0)
;Get the hotkey
psl\GetHotkey(@Hotkey)
*p\Hotkey_VK = LowByte (Hotkey)
*p\Hotkey_MOD = HighByte(Hotkey)
;Get the showcommand
addr = *p
psl\GetShowCmd(addr+4)
;Get the icon file and the icon index
psl\GetIconLocation(*Buf, 1024, *p)
*p\IconLocation = PeekS(*Buf)
;RtlFillMemory_(*Buf, 1024, 0) ;<- We don't need this here
;Result will be 1 because we have finished the processing
Result = 1
EndIf
ppf\Release()
EndIf
psl\Release()
EndIf
CoUninitialize_()
FreeMemory(*Buf)
EndIf
ProcedureReturn Result
DataSection
CLSID_ShellLink:
; 00021401-0000-0000-C000-000000000046
Data.l $00021401
Data.w $0000,$0000
Data.b $C0,$00,$00,$00,$00,$00,$00,$46
IID_IShellLink:
; DEFINE_SHLGUID(IID_IShellLinkA, 0x000214EEL, 0, 0)
; C000-000000000046
Data.l $000214EE
Data.w $0000,$0000
Data.b $C0,$00,$00,$00,$00,$00,$00,$46
IID_IPersistFile:
; 0000010b-0000-0000-C000-000000000046
Data.l $0000010b
Data.w $0000,$0000
Data.b $C0,$00,$00,$00,$00,$00,$00,$46
EndDataSection
EndProcedure
GetShellLinkInfo("C:\Dokumente und Einstellungen\Daniel\Desktop\Trillian.lnk", @SLI.ShellLinkInfo)
Debug SLI\Target
Debug SLI\Description
Debug SLI\WorkingDirectory
Debug SLI\Arguments
Debug SLI\IconLocation
Debug SLI\IconIndex