PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
CreateShortcut (Function)
In French: CréeRaccourci
Creates a shortcut on the Windows desktop, in the "Start" menu of Windows or in a specific directory. This shortcut can be associated with any type of file: executable, document, etc.
Note: In Windows Vista and later, to create a shortcut, the application must be started in "Administrator" mode.
// Vista/7...: Administrator privileges required
// Creates the "Test" shortcut for the "C:\Test\Test.exe" program
// on the desktop (of all users), with Ctrl+Alt+A as shortcut
IF CreateShortCut(shortcutDesktop, "Test", "C:\Test\Test.exe", "",  swsNormal, "A") = False THEN
Error("Failure creating the shortcut in" + SysDir(srCommonDesktop) + ...
", check your rights (administrator privileges required)", ErrorInfo())
ELSE
Info("The shortcut was created")
END
// Vista/7...: Administrator privileges required
// Create the shortcut in "Start/Programs/Accessories" of all the users
IF CreateShortCut(shortcutProgram, "Test", "C:\Test\Test.exe", ...
"Accessories", swsNormal, "A") = False THEN
Error("Failure creating the shortcut in" + SysDir(srCommonPrograms) + ...
", check your rights (administrator privileges required)", ErrorInfo())

ELSE
Info("The shortcut was created")
END
Syntax
<Result> = CreateShortcut(<Location> , <Name> , <Command Line> [, <Shortcut Path> [, <Opening Mode> [, <Shortcut Key> [, <Working Directory> [, <Icon>]]]]])
<Result>: Boolean
  • True if the shortcut was created,
  • False if a problem occurred.
<Location>: Integer constant
Shortcut location:
shortcutDesktop
(Default value)
Shortcut created on the Windows desktop for all the users of the computer.
To create a shortcut on the desktop of Windows Vista (and later), the application that creates the shortcut must have an administrator manifest.
To create a shortcut on the desktop of the current user, use the shortcutFree constant then use SysDir(srDestop) in <Shortcut Path>. In this case, the application that creates the shortcut requires no administrator manifest.
Windows Mobile This constant is not available.
Versions 22 and later
shortcutUserDesktop
New in version 22
shortcutUserDesktop
shortcutUserDesktop
Shortcut created on the Windows desktop for the current user of the computer.
Windows Mobile This constant is not available.
Versions 22 and later
shortcutStartup
New in version 22
shortcutStartup
shortcutStartup
Shortcut created in the "Start .. Programs .. Startup" menu of Windows for all the users of the computer.
Windows Mobile This constant is not available.
Versions 22 and later
shortcutUserStartup
New in version 22
shortcutUserStartup
shortcutUserStartup
Shortcut created in the "Start .. Programs .. Startup" menu of Windows for the current user of the computer.
Windows Mobile This constant is not available.
Versions 22 and later
shortcutStart
New in version 22
shortcutStart
shortcutStart
Shortcut created in the "Start" menu of Windows for all the computer users.
Windows Mobile This constant is not available.
Versions 22 and later
shortcutUserStart
New in version 22
shortcutUserStart
shortcutUserStart
Shortcut created in the "Start" menu of Windows for the current user of the computer.
Windows Mobile This constant is not available.
shortcutQuickLaunchShortcut created in the quick launch bar (Windows 98 and later).
Windows Mobile This constant is not available.
shortcutFreeShortcut created in the directory specified by <Path>.
shortcutProgramShortcut created in the "Start .. Programs" menu of Windows for all the users of the computer.
To create a shortcut in the "Start .. Programs" menu in Windows Vista (and later), the application that creates the shortcut must have an administrator manifest.
To create a shortcut on the Programs menu of the current user, use the shortcutFree constant then use SysDir(srPrograms) in <Shortcut Path>. In this case, the application that creates the shortcut requires no administrator manifest.
Versions 22 and later
shortcutUserProgram
New in version 22
shortcutUserProgram
shortcutUserProgram
Shortcut created in the "Start .. Programs" menu of Windows for the current user of the computer.
Windows Mobile This constant is not available.
Versions 18 and later
shortcutFindWindows8
New in version 18
shortcutFindWindows8
shortcutFindWindows8
Shortcut created for the search in Windows 8 for all the users of the computer. The shortcut is not found on the home screen.
If the system used is not Windows 8, the shortcut is created in the "Start .. Programs" menu of Windows for all the users of the computer.
Windows Mobile This constant is not available.
<Name>: Character string (with quotes)
Name of shortcut.
<Command Line>: Character string (with quotes)
Full command line associated with the shortcut. This command line will be run when a double click is performed on the link. The paths of the files containing space characters must be enclosed in quotes.
In the shortcut properties, the command line corresponds to the target.
<Shortcut Path>: Optional character string (with quotes)
Directory into which the shortcut must be created (directory relative to <Location>). The shortcut can be created in a "Directory" (or group of programs) of the "Start .. Programs" menu or in a folder on the desktop.
If <Location> = shortcutFree, the path is absolute (the disk is specified) ; otherwise, the path is relative to the specified location.
If this parameter is not specified or if it corresponds to an empty string (""), the shortcut will be created in the specified <Location>.
The paths containing space characters must be enclosed in quotes.
<Opening Mode>: Optional integer constant
Mode for opening the main window of the application associated with the link. The color of the selection bar will be modified for this control (table, list box or combo box).
swsNormal
(Default value)
Open in standard size.
swsIconicOpen the minimized window.
swsMaximizeOpen the maximized window.
Windows Mobile This parameter is not available.
<Shortcut Key>: Optional character string
Key (or combination of keys) allowing you to run the shortcut. Each key is represented by one or more characters. There is no need to specify "Ctrl-Alt" that is automatically added. No shortcut key is specified by default.
  • To use a single keyboard character, all you have to do is use the character itself. For example, to represent the letter A, assign the value "A" to <Shortcut Key>.
    Caution: A special meaning is assigned by the function to the following characters:
    • plus (+),
    • insertion (^),
    • percentage (%),
    • brackets ( ).
    To use one of these characters, the character must be enclosed in curly brackets. For example, to use the plus sign (+), type {+}. To use curly brackets, use the {{} and {}} characters.
  • When using special characters, specific codes are required to identify:
    • the characters with no action on the screen (the Enter key for example)
    • the characters corresponding to an action (the function keys for example).
    You must use the following codes:
    KeyCodeKeyCode
    BACKSPACE{RA}PAUSE{PAUSE}
    CAPSLOCK{VERRMAJ}DEL{SUPPR}
    DOWN{DOWN}END{END}
    ENTER{ENTER}ESC{ECHAP}
    HELP{HELP}HOME{HOME}
    INSERT{INS}LEFT{LEFT}
    NUMLOCK{NUMLOCK}PGDN{PGDN}
    PGUP{PGUP}PRNT. SCREEN{PRTSC}
    RIGHT{RIGHT}SCROLLLOCK{SCROLLLOCK}
    TAB{TAB}TOP{TOP}
    F1{F1}F2{F2}
    F3{F3}F4{F4}
    F5{F5}F6{F6}
    F7{F7}F8{F8}
    F9{F9}F10{F10}
    F11{F11}F12{F12}
    F13{F13}F14{F14}
    F15{F15}F16{F16}
  • To specify a key combination with SHIFT, CTRL or ALT, the standard code of the key must be preceded by one or more codes chosen among the following ones:
    KeyCode
    SHIFT+
    CTRL^
    ALT%
  • To specify that the SHIFT, CTRL and/or ALT keys must be kept down while another key is pressed: for example, if you want the SHIFT key to be kept down while pressing the E key, use "+E".
Windows Mobile This parameter is not available.
<Working Directory>: Optional character string (with quotes)
Working directory associated with the program run. No working directory is specified by default. The paths containing space characters must be enclosed in quotes.
Windows Mobile This parameter is not available.
<Icon>: Optional character string (with quotes)
Name and path of the icon associated with the shortcut. The icon of the executable is used by default (or the icon associated with the type of file).
Windows Mobile This parameter is not available.
Components
WINDEVReports and Queries wd230std.dll
Windows Mobile wp230std.dll
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment