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,049 of 17,273    |
|    Schugo to R.Wieser    |
|    Re: How to create a relative shortcut ?    |
|    03 Sep 25 21:32:25    |
      XPost: comp.os.ms-windows.programmer.win32, alt.windows7.general       From: schugo@schugo.de              On 03.09.2025 19:19, R.Wieser wrote:       > Schugo,       >       >> If the file is a known filetype with a registered       >> standard app, then ShellExecute(...) or "start" in a       >> .bat should open the file just fine, even folders.       >> (just tried with start foldername)       >       > Thanks for the suggestion.       >       > I'm still hoping someone knows how to create a relative shortcut though.              I haven't found any code example to add the StringData structure.       Looks like you have to create the .lnk file by yourself.              IShellLinkA::SetRelativePath doesn't seem to do this:       https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_cor       /nf-shobjidl_core-ishelllinka-setrelativepath                     This is from the LNK file format:              2.1.1 LinkFlags       The LinkFlags structure defines bits that specify which shell link structures       are present in the file format after the ShellLinkHeader structure.              HasRelativePath (0x00000008)       The shell link is saved with a relative path string. If this bit is set, a       RELATIVE_PATH StringData structure (section 2.4) MUST be present              2.4 StringData       RELATIVE_PATH: An optional structure that specifies the location of the link       target relative to the file that contains the shell link. When specified, this       string SHOULD be used when resolving the link.              ...       Example:       Because HasRelativePath is set, the RELATIVE_PATH StringData structure       follows:               CountCharacters: (2 bytes), 0x0007 Unicode characters.        String (14 bytes), the Unicode string: ".\a.txt".              ciao...              --- 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