08-25-2006, 07:27 AM
Hi,
I'm doing some moderately complicated file manipulations, and have run across a problem. I strongly suspect this is a Windows issue, but perhaps there’s a QuickMacros trick to get around Windows’ problems.
Many of the files I’m working with aren't really files, but rather Windows shortcuts (.lnk files). When the macro encounters a .lnk file, it resolves it using GetShortcutInfoEx.
The problem? Sometimes, GetShortcutInfoEx fails. This seems to happen when the target of the shortcut file has been moved. That’s not especially surprising. More interesting, though, is that Windows Explorer doesn’t have this same problem — If I double click the file in Explorer, it will correctly find the file it refers to, even if I moved it. (Perhaps it does a quick search, or maybe Microsoft has wised up and started to use file ID numbers instead of paths.)
Since it could be relevant, this is with Windows XP Home SP2 on an NTFS volume, and (just to confuse things) the .lnk files as well as the referred-to files are all located within a particular shared folder and its subfolders.
So here’s the question — Is it possible to coax GetShortcutInfoEx into acting like Windows Explorer, and get it to be more successful at resolving shortcuts? One (probably false) trail might be the "param" field of the SHORTCUTINFO structure — I don’t know what parameters can be passed using that field. (The help file uses "-p" as an example, but I don’t know what the -p tells the function to do.)
Thanks!
P.S. Edited to remove reference to "GetShortcutInfo," which doesn't exist.
I'm doing some moderately complicated file manipulations, and have run across a problem. I strongly suspect this is a Windows issue, but perhaps there’s a QuickMacros trick to get around Windows’ problems.
Many of the files I’m working with aren't really files, but rather Windows shortcuts (.lnk files). When the macro encounters a .lnk file, it resolves it using GetShortcutInfoEx.
The problem? Sometimes, GetShortcutInfoEx fails. This seems to happen when the target of the shortcut file has been moved. That’s not especially surprising. More interesting, though, is that Windows Explorer doesn’t have this same problem — If I double click the file in Explorer, it will correctly find the file it refers to, even if I moved it. (Perhaps it does a quick search, or maybe Microsoft has wised up and started to use file ID numbers instead of paths.)
Since it could be relevant, this is with Windows XP Home SP2 on an NTFS volume, and (just to confuse things) the .lnk files as well as the referred-to files are all located within a particular shared folder and its subfolders.
So here’s the question — Is it possible to coax GetShortcutInfoEx into acting like Windows Explorer, and get it to be more successful at resolving shortcuts? One (probably false) trail might be the "param" field of the SHORTCUTINFO structure — I don’t know what parameters can be passed using that field. (The help file uses "-p" as an example, but I don’t know what the -p tells the function to do.)
Thanks!
P.S. Edited to remove reference to "GetShortcutInfo," which doesn't exist.
9: ) Lindsey Dubb