Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running a shortcut from within Foxpro
Message
 
To
23/04/2003 12:11:30
Len Wooden
Statistical Resources, Inc
Baton Rouge, Louisiana, United States
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00780657
Message ID:
00780709
Views:
12
>Anyone know if you can run a shortcut within VFP? For whatever reason I have a user that would like to have the ability to execute a known shortcut (.lnk) file instead of executing whatever is in the Target field of the shortcut..
>
>The part that stumps me is that the shortcut can be run from DOS but it cant be run from the RUN command within VFP. I've took a look at WshShell and nothing appears to work there either. The WshShell.Run allows you to tap into the programs that are responsible for opening other files but it still doesnt allow you to run the .lnk file.
>
>Any ideas?
>
Len,

The WSH Shell object does have problems running some lnk files. You'll get an "Access Denied" error with the more complex (3 Kb) short cut links. Another way to identify them is to check the shortcut tab of the properties dialog. The target area is shown as read-only. There's no problem with the standard lnk file and the run method.

If you're not getting the message above, but rather one that says that the file can't be located, then it's probably being caused by a long file name, not enclosed in quotes.

One alternative workaround would be to use the WSH to get an object reference to the shortcut, and then pass the TargetPath member to the Run method. To do this you'd use the WSH's Shell object's CreateShortcut method passing the lnk file name.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform