typedef struct _STARTUPINFO { /* si */
DWORD cb;
LPTSTR lpReserved;
LPTSTR lpDesktop;
LPSTR lpTitle;
DWORD dwX;
DWORD dwY;
DWORD dwXSize;
DWORD dwYSize;
DWORD dwXCountChars;
DWORD dwYCountChars;
DWORD dwFillAttribute;
DWORD dwFlags;
WORD wShowWindow;
WORD cbReserved2;
LPBYTE lpReserved2;
} STARTUPINFO, *LPSTARTUPINFO;
cb
Must be sizeof(STARTUPINFO).
lpReserved
Reserved. Applications should set lpReserved to NULL before passing the structure to the CreateProcess function.
lpDesktop
If non-NULL, this parameter refers to the name of a desktop to start the application in. If the desktop exists, this process is associated with this desktop. If it does not exist, a desktop with default attributes will be created by this name for this process.
lpTitle
For console applications, this is the title displayed in the title bar if a new console window is created. If NULL, the name of the executable file is used as the window title instead. This parameter is ignored by gui applications or by console applications that do not create a new console window.
dwX, dwY
Ignored unless dwFlags specifies STARTF_USEPOSITION. Specifies the x and y offsets in pixels of the topleft window corner if a new window is created. For gui applications, the specified position is used the first time CreateWindow is called to create an overlapped window if the x parameter of CreateWindow is CW_USEDEFAULT.
dwXSize, dwYSize
Ignored unless dwFlags specifies STARTF_USESIZE. For console applications, specifies the maximum width (dwXSize) and height (dwYSize) in character rows and columns if a new console window is created. For gui applications, specifies the width and height in pixels, and is used only the first time CreateWindow is called to create an overlapped window if the nWidth parameter of CreateWindow is CW_USEDEFAULT.
dwXCountChars, dwYCountChars
Ignored unless dwFlags specifies STARTF_USECOUNTCHARS. For console applications, specifies the screen buffer width (dwXCountChars) and height (dwYCountChars) in character columns and rows if a new console window is created. Ignored in gui applications.
dwFillAttribute
Ignored unless dwFlags specifies STARTF_USEFILLATTRIBUTE. For console applications, specifies the initial text and background colors if a new console window is created. Ignored in gui applications.
dwFlags
This is a bit field that determines whether certain STARTUPINFO fields will be used when the process creates a window. The following constants may be used:
Value | Meaning |
STARTF_USESHOWWINDOW | If not specified, the wShowWindow field is ignored. |
STARTF_USESIZE | If not specified, the dwXSize and dwYSize fields are ignored. |
STARTF_USEPOSITION | If not specified, the dwX and dwY fields are ignored. |
STARTF_USECOUNTCHARS | If not specified, the dwXCountChars and dwYCountChars fields are ignored. |
STARTF_USEFILLATTRIBUTE | If not specified, the dwFillAttribute field is ignored. |
STARTF_FORCEONFEEDBACK | If specified, the cursor is in feedback mode for two seconds after CreateProcess is called. If during those two seconds, the application makes the first GUI call, the system gives five more seconds to the application. If during those five seconds, the application shows a window, the system gives five more seconds to the application to finish drawing the window. |
The system turns the feedback cursor off after the first call to GetMessage, regardless of whether the application is drawing. | |
For more information on feedback, see the comments section. | |
STARTF_FORCEOFFFEEDBACK | If specified, the feedback cursor is forced off while the application is starting. The normal cursor is displayed. For more information on feedback, see the comments section. |
wShowWindow
Ignored unless dwFlags specifies STARTF_USESHOWWINDOW. For gui applications, specifies the default value the first time that ShowWindow is called, if the nCmdShow parameter of ShowWindow is SW_SHOWDEFAULT. Can be any of the SW_* ShowWindow constants defined in winuser.h. WinMain used to have a nCmdShow parameter that applications were encouraged either pass to CreateWindow as in the case above where x == CW_USEDEFAULT, or as is more common, applications are encouraged to pass this parameter to ShowWindow. The nCmdShow parameter is no longer available through main. Applications will be encouraged to use SW_SHOWDEFAULT as the default ShowWindow command. USER32 will use the ShowWindow command passed through the STARTUPINFO structure in this case.
cbReserved2
Reserved. Applications should set cbReserved2 to zero.
lpReserved2
Reserved. Applications should set lpReserved2 to NULL.
If a GUI application is being started and neither STARTF_FORCEONFEEDBACK or STARTF_FORCEOFFFEEDBACK is specified, the application feedback cursor is used. A GUI application is one whose UMTYPE is specified as “windows”.