Opens, explores, or prints a specified file or folder.
x% = ShellExec(file$ [, parameters$][, directory$])
x% = ShellExec([operation$][, file$][, parameters$][, directory$] [,show%])
ShellExec file$ [, parameters$][, directory$]
ShellExec [operation$][, file$][, parameters$][, directory$] [,show%]
Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise.
ShellExec uses the Window handle of the current active Form. This window receives any message boxes that an application produces. For example, an application may report an error by producing a message box. Null is passed when IsNothing(Me) is true.
All arguments are optional, but to differentiate between the three parameter and the five parameter version the five parameters version must be made explicit, by including enough (3) comma's. To use the five parameter version, you could use:
ShellExec ,file$, , [,]
operation$ specifies the operation to perform. The following operation strings are valid:
"open" - The function opens the file specified by the File$ parameter. The file can be an executable file or a document file. It can also be a folder. | |
"print" - The function prints the file specified by File$. The file should be a document file. If the file is an executable file, the function opens the file, as if "open" had been specified. | |
"explore" - The function explores the folder specified by File$. |
When this parameter is omitted, NULL is passed. In that case, the function opens the file specified by File$. To open the Window Explorer use the five parameter version: ShellExec "explore", ".", ,.
file$ specifies the file to open or print or the folder to open or explore. The function can open an executable file or a document file. The function can print a document file. If file$ specifies a document file, show should be zero. Use the three parameter version.
parameters$ specifies the parameters to be passed to the application, when the File$ parameter specifies an executable file. If File$ specifies a document file, Parameters$ should omitted.
directory$ specifies the default directory.
show specifies how the application is to be shown when it is opened. This is one of the SW_ constants, see ShowW.
ShellExec "", "notepad", , , SW_MAXIMIZE
~ShellExec("explore", "d:", , , )
{Created by Sjouke Hamstra; Last updated: 23/10/2014 by James Gaite}