Get Shortcut?

Blitz3D Forums/Blitz3D Programming/Get Shortcut?

John Blackledge(Posted 2014) [#1]
I'm trying to get the contents of a dropped shortcut (-got the dropped bit working).
Unfortunately this causes a MAV, and I don't understand the code well enough.
Can anybody help?

Graphics 800,600
pszLinkto$ = "C:\Documents and Settings\John\Desktop\Lifestory.doc.lnk" ; test shortcut
pszDir$ = Chr$(0) ;= String$(" ",512) ; neither of these make any difference
pszName$ = String$(" ",512)
; \/ This causes a MAV
api_SHGetNewLinkInfo% (pszLinkto$, pszDir$, pszName$, pfMustCopy%, uFlags%) ; : User32 "SHGetNewLinkInfoA"
Print pszLinkto$
Print pszDir$
Print pszName$
WaitKey()
End


RGR(Posted 2014) [#2]
Without testing it ... just looking into the Code ...

http://msdn.microsoft.com/en-us/library/windows/desktop/bb762193(v=vs.85).aspx

It's not a User32 Function ... It should be in Shell32 (decls)
Maybe that's the reason?


John Blackledge(Posted 2014) [#3]
Sorry - my mistake.

Not User32.... it was already in Shell32.decls.

But that doesn't change the fact that it MAV's.

Maybe I need to drop this into the Win forum.


RGR(Posted 2014) [#4]
.lib "shell32.dll"
SHGetNewLinkInfo%(pszLinkto$, pszDir$, pszName*, pfMustCopy*, uFlags%)




There were Pointers missing in the decls file
See here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb762193(v=vs.85).aspx

Don't know what the function should do - so I do not know if it works now. Anyway - It does not MAV anymore ;-) And you can build on it.

RGR
.


John Blackledge(Posted 2014) [#5]
I think you're right about the decls definition.
Thanks for the new one, it does not MAV.

Unfortunately this line now MAVs:

Dummy=PeekByte(Bank,Zlr)


John Blackledge(Posted 2014) [#6]
I've spent 3 days trying to understand DLLs.
I got fed up and handcoded it in an hour:-
http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=3104
Don't you just love Blitz!