xcall MIAMEX, MX_SHORTCUT, target$, lnkspec$ {, descr$, workdir$, icon$, iconidx, status}
target$ (Str) [in]
should be set to the object or command line that the shortcut links to. Any %ENV% vars will be pre-resolved, i.e. at the time the link is created (rather than when it is clicked on). Examples:
TARGET$ = """%MIAME%\bin\ashw32.exe"" -i ""%MIAMEFILE% abc"""
TARGET$ = "http://www.microsabio.com"
TARGET$ = """c:\company shared folders\readme.txt"""
Note: as shown above in the first and third example, you must supply literal quotes as needed to enclose any path compoents of the TARGET$ command line that may contain embedded spaces. (In the first example, we don't know if %MIAME% or %MIAMEFILE% will contain embedded spaces, so we quote them to be safe.)
lnkspec$ (Str) [in]
should be set the full filespec of the shortcut itself. The default extension is ".lnk"; any other extension may fail to be recognized by the Explorer as a shortcut (or "Shell Link"). LNKSPEC$ does not require literal quoting even if contains embedded spaces. Example:
LNKSPEC$ = "C:\vm\miame\test shortcut.lnk"
Note that the filename (minus the .lnk extension and directory) will appear under the icon when in icon view, i.e. "test shortcut" in the above example.
To put the icon on the user's desktop, you can use the %USERPROFILE% environment variable, e.g.:
LNKSPEC$ = "%USERPROFILE%\Desktop\check this out.lnk"
(For the common or "all users" desktop, use "%ALLUSERSPROFILE% instead of %USERPROFILE%, but beware that the operation may be blocked by a variety of security restrictions, and will require elevation under Vista.)
descr$ (Str) [in]
may specify a description to be embedded within the shortcut properties.
workdir$ (Str) [in]
may specify the starting working directory for the process when the TARGET$ is launched. It does not require quoting.
icon$ (Str) [in]
may specify a separate file from which the display icon should be taken. It does not require quoting. If not specified, then the first icon of the executable associated with the TARGET$ will be used. (If you want to user another icon from that executable, you must specify the module name again here.)
iconidx$ (Num) [in]
may specify the icon index (0,1,2,...) of the icon within the file (default is 0, the first icon). Ignored unless ICON$ is not blank.
status (F) [out]
the return status. 0=ok. Positive numbers are Windows system error codes. (See MX_ERRNOMSG to display text). -1 indicates no GUI support available (requires Windows or ATE).