ralph
4/3/2012 8:31:00 PM
On Tue, 03 Apr 2012 09:27:59 -0700, BeeJ <nospam@spamnot.com> wrote:
>I was hoping for a one liner API to open the .LNK
>But now I am going to rip open the .LNK and get all the parameters and
>shell path+args that way.
>
A .LNK file is NOT an executable. One needs to use a shell interpreter
to launch ("open"?) one, either the Windows Shell or the Command Line
parser will do. [VB's Shell() executes the latter.]
Other showed you how to do that.
Since you wanted to know if the command succeeds then
ShellExecuteWait() should be satisfactory.
A link file is essentially a short-cut for a Shell to save typing by
packaging lengthy command strings, allowing 'drag 'n drop', and a
single thingy to 'click' within a single file. They can be used to
package practically anything - executables, documents, folders, links,
.... . They can exhibit polymorphic behavior by defining "verbs" and
passing that to the link via the ShellExecute/Wait().
..LNK files are a tad notorious, in that they can be easily corrupted,
often deleted, occasionally out-of-date, often found in assorted
locations. [Most of them are back-upped in the Registry, but without
deliberating running a tool there is no guarantee the Registry and
current .lnk files are in synch.]
Considering the specificity of their design and application, and how
easy it is to launch, create, and then use, (or mess one up <g>), and
how easy it is to retrieve information from other likely more reliable
sources, it is difficult to understand why anyone would feel the need
to "rip" one open?
What is the 'real' issue?
-ralph