Shortcuts (.lnk)
Shortcuts (.lnk)
I looked all over the place and I couldn’t find anything that retrieves Target Info from Shortcuts (.lnk)….
Are there any posts that I could be referred to?
Thanks in Advanced...
Are there any posts that I could be referred to?
Thanks in Advanced...
OK this is stupid, i spoke to soon...
I thought i had it because using
It returns with Target rather then the .lnk but when i use OpenFile() it returns with .lnk.... I'm stumped 
I thought i had it because using
Code: Select all
Debug OpenFileRequester("Choose file","","",0)

I found this document that explains how the LNK file format works, perhaps you could have a read then make some sort of interpreter in PB?
http://www.the7soft.com/file-formats/fi ... /lnk_c.zip
http://www.the7soft.com/file-formats/fi ... /lnk_c.zip
Try this:
Target$ = ShortcutTarget(Shortcut$)
Timo
Target$ = ShortcutTarget(Shortcut$)
Code: Select all
Procedure.s ShortcutTarget(ShortcutFile$)
Result$ = ""
CoInitialize_(0)
If CoCreateInstance_(?CLSID_ShellLink, 0, 1,?IID_IShellLink, @ShellLink.IShellLinkA) = #S_OK
If ShellLink\QueryInterface(?IID_IPersistFile, @LinkFile.IPersistFile) = #S_OK
*buffer = AllocateMemory(1000)
If *buffer
MultiByteToWideChar_(#CP_ACP, 0, @ShortcutFile$, -1, *buffer, 1000)
If LinkFile\Load(*buffer, 0) = #S_OK
If ShellLink\Resolve(0, 1) = #S_OK
RtlZeroMemory_(*buffer, 1000)
ShellLink\GetPath(*buffer, 1000, 0, 0)
Result$ = PeekS(*buffer)
EndIf
EndIf
FreeMemory(*buffer)
EndIf
LinkFile\Release()
EndIf
ShellLink\Release()
EndIf
CoUninitialize_()
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
quidquid Latine dictum sit altum videtur