VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Create a shortcut with the Windows Scripting Host (no VB6STKIT)

RJ Solutions  (1 Submission)   Files/File Controls/Input/Output   Visual Basic 3.0   Beginner   Wed 3rd February 2021

I wanted code that used components that were mostly likely to be found on a user's machine. VB5STKIT, VB4STKIT, and VB6STKIT all could be used for creating shortcuts, but there is a good chance they weren't already on the user's machine, meaning I'd have to include it in my install package. The Windows Scripting Host is a default installation on Windows 98 and higher, and is likely on a Windows 95 machine. Plus you can include an object test to easily verify the user has the Scripting Host installed.

Inputs
Shortcut path (including the ".lnk" part of the filename), pop-up description, target path (the file to execute), command-line arguments, working directory, Hot Key to execute shortcut, Icon path, Window Style.

Assumes
Arguments, Working Directory, hot key, icon location, and window style are all optional. This code is a simple adaptation of the Windows Scripting Documentation, which can be found on Microsoft's site. The default window style is to run in a normal window. Other values allow Minimized and Maximized operation. This can be used for URL shortcuts as well. This code verifies that the Scripting Host is installed, and if not, it returns False (no error produced).

Returns
Boolean (True or False) as to whether it was successful.

API Declarations
None!

Rate Create a shortcut with the Windows Scripting Host (no VB6STKIT) (11(11 Vote))
Create a shortcut with the Windows Scripting Host (no VB6STKIT).bas

Create a shortcut with the Windows Scripting Host (no VB6STKIT) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters