User Tools

Site Tools


creating_20a_20shortcut

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
creating_20a_20shortcut [2018/03/31 13:19] – external edit 127.0.0.1creating_20a_20shortcut [2024/01/05 00:22] (current) – external edit 127.0.0.1
Line 1: Line 1:
 =====Creating a shortcut===== =====Creating a shortcut=====
  
-//by Richard Russell, June 2007//\\ \\  If you want to create a shortcut (link) to a file or a folder, you can do it using the **PROCshortcut** routine listed below. You would call the routine using code similar to the following:\\ +//by Richard Russell, June 2007//\\ \\  If you want to create a shortcut (link) to a file or a folder, you can do it using the **PROCshortcut** routine listed below. You would call the routine using code similar to the following: 
 + 
 +<code bb4w>
         PROCshortcut("C:\Documents and Settings\RTR\Desktop\Test Shortcut.lnk", \         PROCshortcut("C:\Documents and Settings\RTR\Desktop\Test Shortcut.lnk", \
         \            "C:\Program Files\BBC BASIC for Windows\bbcwin.exe", \         \            "C:\Program Files\BBC BASIC for Windows\bbcwin.exe", \
         \            "C:\Program Files\BBC BASIC for Windows\Examples\", \         \            "C:\Program Files\BBC BASIC for Windows\Examples\", \
         \            "Test shortcut created by BBC BASIC for Windows")         \            "Test shortcut created by BBC BASIC for Windows")
-The first parameter is the path and filename of the shortcut to be created; it must have the extension **".lnk"**.\\  The second parameter is the target of the shortcut; it can be the name of a file or the path to a folder.\\  The third parameter specifies the working directory, if the shortcut refers to an executable program.\\  The fourth parameter is a comment describing the shortcut.\\ \\  Of course you should ideally not specify the locations of the shortcut and files using explicit paths, such as shown above, but instead determine the correct locations using the [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwine.html#specialfolders|FNspecialfolder()]] function from the main Help documentation:\\ +</code> 
 + 
 +The first parameter is the path and filename of the shortcut to be created; it must have the extension **".lnk"**.\\  The second parameter is the target of the shortcut; it can be the name of a file or the path to a folder.\\  The third parameter specifies the working directory, if the shortcut refers to an executable program.\\  The fourth parameter is a comment describing the shortcut.\\ \\  Of course you should ideally not specify the locations of the shortcut and files using explicit paths, such as shown above, but instead determine the correct locations using the [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwine.html#specialfolders|FNspecialfolder()]] function from the main Help documentation: 
 + 
 +<code bb4w>
   CSIDL_DESKTOPDIRECTORY = 16   CSIDL_DESKTOPDIRECTORY = 16
   CSIDL_PROGRAM_FILES = 38   CSIDL_PROGRAM_FILES = 38
Line 13: Line 19:
   start$ = FNspecialfolder(CSIDL_PROGRAM_FILES) + "BBC BASIC for Windows\Examples\"   start$ = FNspecialfolder(CSIDL_PROGRAM_FILES) + "BBC BASIC for Windows\Examples\"
   PROCshortcut(link$, target$, start$, "Test shortcut created by BBC BASIC")   PROCshortcut(link$, target$, start$, "Test shortcut created by BBC BASIC")
-To make the shortcut available to all users rather than just the current user change **CSIDL_DESKTOPDIRECTORY** to **CSIDL_COMMON_DESKTOPDIRECTORY**.\\ \\  Here is the **PROCshortcut** routine itself:\\ +</code> 
 + 
 +To make the shortcut available to all users rather than just the current user change **CSIDL_DESKTOPDIRECTORY** to **CSIDL_COMMON_DESKTOPDIRECTORY**.\\ \\  Here is the **PROCshortcut** routine itself: 
 + 
 +<code bb4w> 
         REM PROCshortcut - uses the Shell's IShellLink and IPersistFile interfaces         REM PROCshortcut - uses the Shell's IShellLink and IPersistFile interfaces
         REM                to create and store a shortcut to the specified object.         REM                to create and store a shortcut to the specified object.
Line 85: Line 95:
         SYS `CoUninitialize`         SYS `CoUninitialize`
         ENDPROC         ENDPROC
 +</code>
 +
 For information about how to read (dereference) a short cut see the article on [[/Reading%20a%20shortcut|reading a shortcut]]. For information about how to read (dereference) a short cut see the article on [[/Reading%20a%20shortcut|reading a shortcut]].
creating_20a_20shortcut.1522502353.txt.gz · Last modified: 2024/01/05 00:18 (external edit)