- sw_hide
- hides the window and activates another window.
- sw_maximize
- maximizes the specified window.
- sw_minimize
- minimizes the specified window and activates the next top-level window in the z-order.
- sw_restore
- 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 window.
- sw_show
- activates the window and displays it in its current size and position.
- sw_showdefault
- sets the show state based on the sw_ flag specified in the startupinfo structure passed to the createprocess 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
- activates the window and displays it as a maximized window.
- sw_showminimized
- activates the window and displays it as a minimized window.
- sw_showminnoactive
- displays the window as a minimized window. the active window remains active.
- sw_showna
- displays the window in its current state. the active window remains active.
- sw_shownoactivate
- displays a window in its most recent size and position. the active window remains active.
- sw_shownormal
- 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.
return value
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. the return value is cast as an hinstance for backward compatibility with 16-bit windows applications. it is not a true hinstance, however. the only thing that can be done with the returned hinstance is to cast it to an int and compare it with the value 32 or one of the error codes below.
0 the operating system is out of memory or resources. error_file_not_found the specified file was not found. error_path_not_found the specified path was not found. error_bad_format the .exe file is invalid (non-microsoft win32 .exe or error in .exe image). se_err_accessdenied the operating system denied access to the specified file. se_err_associncomplete the file name association is incomplete or invalid. se_err_ddebusy the dynamic data exchange (dde) transaction could not be completed because other dde transactions were being processed. se_err_ddefail the dde transaction failed. se_err_ddetimeout the dde transaction could not be completed because the request timed out. se_err_dllnotfound the specified dynamic-link library (dll) was not found. se_err_fnf the specified file was not found. se_err_noassoc there is no application associated with the given file name extension. this error will also be returned if you attempt to print a file that is not printable. se_err_oom there was not enough memory to complete the operation. se_err_pnf the specified path was not found. se_err_share a sharing violation occurred.
remarks
this method allows you to execute any commands in a folder's shortcut menu or stored in the registry.
to open a folder, use either of the following calls:
shellexecute(handle, null, <fully_qualified_path_to_folder>, null, null, sw_shownormal);or
shellexecute(handle, "open", <fully_qualified_path_to_folder>, null, null, sw_shownormal);to explore a folder, use:
shellexecute(handle, "explore", <fully_qualified_path_to_folder>, null, null, sw_shownormal);to launch the shell's find utility for a directory, use:
shellexecute(handle, "find", <fully_qualified_path_to_folder>, null, null, 0);if lpoperation is null, the function opens the file specified by lpfile. if lpoperation is "open" or "explore", the function attempts to open or explore the folder.
to obtain information about the application that is launched as a result of calling shellexecute, use shellexecuteex.
note the launch folder windows in a separate process setting in folder options affects shellexecute. if that option is disabled (the default setting), shellexecute uses an open explorer window rather than launch a new one. if no explorer window is open, shellexecute launches a new one.windows 95/98/me: shellexecute is supported by the microsoft layer for unicode. to use this, you must add certain files to your application, as outlined in microsoft layer for unicode on windows 95/98/me systems.
function information
minimum dll version shell32.dll version 3.51 or later custom implementation no header shellapi.h import library shell32.lib minimum operating systems windows nt 3.1, windows 95 unicode implemented as ansi and unicode versions.