Re: How to create a relative shortcut ?

"R.Wieser" <[email protected]> Thu, 4 Sep 2025 08:50:16 +0200
Newsgroups comp.os.ms-windows.programmer.win32,alt.comp.os.windows-xp,alt.windows7.general
Organization A noiseless patient Spider
Message-ID <[email protected]>
JJ,

> Shortcut file strictly use absolute path.

Really ?  (don't worrry, just some ribbing)

From your own quoting :

> The *relative path part* of it (set by SetRelativePath),

(bolding mine)

And by the way, thats *not* a relative path (so much for descriptive names 
and descriptions). From the MS docs  :

"The address of a buffer that contains the *fully-qualified path* of the 
shortcut file, ... *It should be a file name* "

(bolding mine)

And yes, I got confused by that methods name too - it has exactly zero to do 
with the other, very similar name (just no "Relative" in it).

> Even if a relative path is used to set the (normal) Path field,

You can't do that, I tried (duh).  The only thing you will get is an error 
(or, in case of vbscript, having it silently combined/prepended with the C:\ 
drive).

> the Shell Link API will expand it to a full path.

See above, thats not my experience.

> Also, SetIDList only accept absolute IDList.

Well, thats easy : I'll just remove that list ! :-)  But yes, that was 
another thing crossing my mind.

> The only way to create a shortcut file with its Path field set
> to a relative path, is to craft the shortcut file without using
> Shell Link API.

Yep, it looks like it.

> Though, I'm not sure about the actual result when such shortcut
> file is used, since the Shell Link API is expecting absolute paths
> for all fields.

:-))  I just replied to Shugo with the same doubt.

Regards,
Rudy Wieser