SHELLEXECUTEINFO Structure

Type SHELLEXECUTEINFO
	cbSize As Long
	fMask As Long
	hwnd As Long
	lpVerb As String
	lpFile As String
	lpParameters As String
	lpDirectory As String
	nShow As Long
	hInstApp As Long
	lpIDList As Long
	lpClass As String
	hkeyClass As Long
	dwHotKey As Long
	hIcon As Long
	hProcess As Long
End Type

Description & Usage

The SHELLEXECUTEINFO structure holds the information passed to and from the ShellExecuteEx function. The structure stores the data telling the function what to do, and also receives data describing the function's result.

Visual Basic-Specific Issues

Data Members

cbSize
The size, in bytes, of the structure.
fMask
A combination of the following flags specifying which optional parts of the structure to use, and also specifying other options to use with the structure:
SEE_MASK_CLASSKEY
Use the hkeyClass member.
SEE_MASK_CLASSNAME
Use the lpClass member.
SEE_MASK_CONNECTNETDRV
Validate the file share and connect it to a drive letter. lpFile is the Universal Naming Convention (UNC) pathname of a file on the network.
SEE_MASK_DOENVSUBST
Expand any environment variables appearing inside lpDirectory or lpFile.
SEE_MASK_FLAG_DDEWAIT
If ShellExecuteEx starts a DDE conversation, wait for that conversation to finish before the function returns.
SEE_MASK_FLAG_NO_UI
Do not display an error dialog if an error occurs.
SEE_MASK_HOTKEY
Use the dwHotKey member.
SEE_MASK_ICON
Use the hIcon member.
SEE_MASK_IDLIST
Use the lpIDList member.
SEE_MASK_INVOKEIDLIST
Use the lpIDList member to invoke an application.
SEE_MASK_NOCLOSEPROCESS
Use the hProcess member.
hwnd
A handle to the window that is calling ShellExecuteEx, if any.
lpVerb
A string that specifies the action to perform on the file specified by lpFile. This may be one of the following strings, although others are possible:
"explore"
If lpFile is a path name, open it in a Windows Explorer window.
"open"
Open lpFile using its associated program. Opening an executable file runs it. This is the default action if none is specified.
"print"
Print lpFile using its associated program.
lpFile
The name of the file to open, print, execute, or whatever is specified by lpVerb.
lpParameters
Additional parameters to use to perform the action. This would typically be additional command-line options to use, especially when running an executable file.
lpDirectory
The path name of the working directory to use. If this is not specified, the current directory is used.
nShow
One of the following flags specifying how to display any window opened as a result of the call to ShellExecuteEx:
SW_HIDE
Hide the window.
SW_MAXIMIZE
Maximize the window.
SW_MINIMIZE
Minimize the window.
SW_RESTORE
Restore the window (not maximized nor minimized).
SW_SHOW
Show the window.
SW_SHOWMAXIMIZED
Show the window maximized.
SW_SHOWMINIMIZED
Show the window minimized.
SW_SHOWMINNOACTIVE
Show the window minimized but do not activate it.
SW_SHOWNA
Show the window in its current state but do not activate it.
SW_SHOWNOACTIVATE
Show the window in its most recent size and position but do not activate it.
SW_SHOWNORMAL
Show the window and activate it (as usual).
hInstApp
If ShellExecuteEx is successful, this receives a handle to the instance of the application that was started. If the function failed, this receives one of the following flags identifying the error:
SE_ERR_ACCESSDENIED
Access was denied.
SE_ERR_ASSOCINCOMPLETE
File association information was incomplete.
SE_ERR_DDEBUSY
The DDE operation is busy.
SE_ERR_DDEFAIL
The DDE operation failed.
SE_ERR_DDETIMEOUT
The DDE operation timed out.
SE_ERR_DLLNOTFOUND
A required DLL was not found.
SE_ERR_FNF
The file could not be found.
SE_ERR_NOASSOC
There is no associated program to use to perform the action.
SE_ERR_OOM
The computer is out of memory.
SE_ERR_PNF
The path could not be found.
SE_ERR_SHARE
A shared file cound not be opened.
lpIDList
A pointer to an ITEMIDLIST structure (PIDL) that identifies the file to execute. This member is only used if fMask contains SEE_MASK_IDLIST or SEE_MASK_INVOKEIDLIST.
lpClass
The name of the file class or globally unique identifier (GUID) to use. This member is only used if fMask contains SEE_MASK_CLASSNAME.
hkeyClass
A handle to the registry key to use for the file class. This member is only used if fMask contains SEE_MASK_CLASSKEY.
dwHotKey
The hot key to associate with the application. The low-order word is the virtual-key code of the hot key, and the high-order word is a combination of the following flags specifying the modifier keys to use:
HOTKEYF_ALT
Use the Alt key as a modifier.
HOTKEYF_CONTROL
Use the Ctrl key as a modifier.
HOTKEYF_EXT
Use the extended key as a modifier.
HOTKEYF_SHIFT
Use the Shift key as a modifier.
This member is only used if fMask contains SEE_MASK_HOTKEY.
hIcon
A handle to the icon to use for the file class. This member is only used if fMask contains SEE_MASK_ICON.
hProcess
Receives a handle to the process that was started by the call to ShellExecuteEx. This member is only used if fMask contains SEE_MASK_NOCLOSEPROCESS.

Constant Definitions

Const SEE_MASK_CLASSKEY = &H3
Const SEE_MASK_CLASSNAME = &H1
Const SEE_MASK_CONNECTNETDRV = &H80
Const SEE_MASK_DOENVSUBST = &H200
Const SEE_MASK_FLAG_DDEWAIT = &H100
Const SEE_MASK_FLAG_NO_UI = &H400
Const SEE_MASK_HOTKEY = &H20
Const SEE_MASK_ICON = &H10
Const SEE_MASK_IDLIST = &H4
Const SEE_MASK_INVOKEIDLIST = &HC
Const SEE_MASK_NOCLOSEPROCESS = &H40
Const SW_HIDE = 0
Const SW_MAXIMIZE = 3
Const SW_MINIMIZE = 6
Const SW_RESTORE = 9
Const SW_SHOW = 5
Const SW_SHOWMAXIMIZED = 3
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMINNOACTIVE = 7
Const SW_SHOWNA = 8
Const SW_SHOWNOACTIVATE = 4
Const SW_SHOWNORMAL = 1
Const SE_ERR_ACCESSDENIED = 5            
Const SE_ERR_ASSOCINCOMPLETE = 27
Const SE_ERR_DDEBUSY = 30
Const SE_ERR_DDEFAIL = 29
Const SE_ERR_DDETIMEOUT = 28
Const SE_ERR_DLLNOTFOUND = 32
Const SE_ERR_FNF = 2                     
Const SE_ERR_NOASSOC = 31
Const SE_ERR_OOM = 8                     
Const SE_ERR_PNF = 3                     
Const SE_ERR_SHARE = 26
Const HOTKEYF_ALT = &H4
Const HOTKEYF_CONTROL = &H2
Const HOTKEYF_EXT = &H8
Const HOTKEYF_SHIFT = &H1

Used By

ShellExecuteEx

Back to the Structure list.
Back to the Reference section.


Last Modified: August 26, 2000
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/s/shellexecuteinfo.html