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
If sFile specifies an executable
file, sArgs specifies the parameters to be passed to the
application. If sFile specifies a document file, make sArgs as
Specifies the default directory.
Specifies the operation to perform.
The following operation strings are valid:
open - Opens the file
specified by the lpFile 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 lpFile. The file has to 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 lpFile. This parameter can be "".
In that case, the function opens the file specified by lpFile.
If sFile specifies an executable
file, iShowCmd specifies how the application is to be shown when it
is opened. This parameter can be one of the following values:
SW_HIDE (=0) - Hides the
window and activates another window.
SW_MAXIMIZE (=3) - Maximizes
the specified window.
SW_MINIMIZE (=6) - Minimizes
the specified window and activates the next top-level window in the
SW_RESTORE (=9) - Activates
and displays the window. If the window is minimized or maximized,
Windows restores it to its original size and position. An
application should specify this flag when restoring a minimized
SW_SHOW (=5) - Activates the
window and displays it in its current size and position.
SW_SHOWDEFAULT (=10) - Sets
the show state based on the SW_ flag specified in the STARTUPINFO
structure passed to theCreateProcess function by the program that
started the application. An application should call ShowWindow with
this flag to set the initial show state of its main window.
SW_SHOWMAXIMIZED (=3) -
Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED (=2) -
Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE (=7) -
Displays the window as a minimized window. The active window
SW_SHOWNA (=8) - Displays
the window in its current state. The active window remains
SW_SHOWNOACTIVATE (=4) -
Displays a window in its last size and position. The active window
SW_SHOWNORMAL (=1) -
Activates and displays a window. If the window is minimized or
maximized, Windows restores it to its original size and position.
An application should specify this flag when displaying the window
for the first time. If sFile specifies a document file, nShowCmd
should be zero.
Returns a value greater than 32 if successful, or
an error value that is less than or equal to 32 otherwise. The
following table lists the error values.
ERROR_FILE_NOT_FOUND (=2) - The
specified file was not found.
ERROR_PATH_NOT_FOUND (=3) - The
specified path was not found.
ERROR_BAD_FORMAT (=17) - The .exe
file is invalid (non-Win32® .exe or error in .exe image).
SE_ERR_ACCESSDENIED (=5) - The
operating system denied access to the specified file.
SE_ERR_ASSOCINCOMPLETE (=27) -
The file name association is incomplete or invalid.
SE_ERR_DDEBUSY (=30) - The DDE
transaction could not be completed because other DDE transactions
were being processed.
SE_ERR_DDEFAIL (=29) - The DDE
transaction did not succeed.
SE_ERR_DDETIMEOUT (=28) - The DDE
transaction could not be completed because the request timed
SE_ERR_DLLNOTFOUND (=32) - The
specified dynamic-link library was not found.
SE_ERR_FNF (=2) - The specified
file was not found.
SE_ERR_NOASSOC (=31) - There is
no application associated with the given file name extension.
SE_ERR_OOM (=8) - There was not
enough memory to complete the operation.
SE_ERR_PNF (=3) - The specified
path was not found.
SE_ERR_SHARE (=26) - A sharing