home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.comp.os.windows-xp      Actually wasn't too bad for a M$-OS      17,273 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,046 of 17,273   
   JJ to R.Wieser   
   Re: How to create a relative shortcut ?   
   04 Sep 25 03:01:29   
   
   XPost: comp.os.ms-windows.programmer.win32, alt.windows7.general   
   From: jj4public@outlook.com   
      
   On Tue, 2 Sep 2025 11:36:46 +0200, R.Wieser wrote:   
   > Hello all,   
   >   
   > I'm trying to create relative shortcuts* (for use on a removable USB   
   > harddisk) and can't seem to find out how it works.   
   >   
   > * the target of the link is relative to the location of the link itself.   
   >   
   > I'm programming against the IShellLink interface (   
   > https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_c   
   re/nn-shobjidl_core-ishelllinka) ,   
   > which suggests a relative path is possible (SetRelativePath), but I'm not   
   > able to get it to work or find code explaining how to do it.   
   >   
   > I did find this :   
   > https://devblogs.microsoft.com/oldnewthing/20171019-00/?p=97247 , but I'm   
   > not even sure if that is what I'm after ... :-|   
   >   
   > Question: does someone have an example to what I'm supposed to do to make it   
   > happen ?   
   >   
   > Regards,   
   > Rudy Wieser   
      
   Shortcut file strictly use absolute path.   
      
   The relative path part of it (set by SetRelativePath), is only use as a hint   
   on resolving broken link.   
      
   SetRelativePath documentation's remark:   
   "The SetRelativePath method can be used to help the link resolution process   
   find its target based on a common path prefix between the target and the   
   relative path."   
      
   Even if a relative path is used to set the (normal) Path field, the Shell   
   Link API will expand it to a full path. Also, SetIDList only accept absolute   
   IDList.   
      
   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. 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.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca