A pointer to a STARTUPINFO structure is passed as a parameter to the CreateProcess function. This structure contains a number of members that can be used to specify various attributes of the new process. How the information in this structure is used depends on the following:
The type of process being started (GUI or console)
The creation flags argument to CreateProcess
The dwFlags field of the STARTUPINFO structure.
In any case, the new process can access the data in its STARTUPINFO structure by calling the GetStartupInfo function.
The dwFlags parameter determines whether the following STARTUPINFO members will be used when the process creates a window.
Member | Flag |
dwX | only if STARTF_USEPOSITION |
dwY | only if STARTF_USEPOSITION |
dwXSize | only if STARTF_USESIZE |
dwYSize | only if STARTF_USESIZE |
dwXCountChars | only if STARTF_USECOUNTCHARS |
dwYCountChars | only if STARTF_USECOUNTCHARS |
dwFillAttribute | only if STARTF_USEFILLATTRIBUTE |
wShowWindow | only if STARTF_USESHOWWINDOW |
For console processes that use the parent's console, all STARTUPINFO members are ignored, that is they don't change the existing console.
The following list describes how the STARTUPINFO members will be used for console applications that create a new console (provided that the appropriate dwFlags have been specified). This applies to processes created with the CREATE_NEW_CONSOLE creation flag, and to those that create a new console by calling AllocConsole (either processes that were created with the DETACHED_PROCESS creation flag, or processes that have released the parent's console by calling FreeConsole ). Note that many of these console attributes can be set or queried using the Console functions (e.g., GetConsoleScreenBufferInfo, SetConsoleTextAttribute, etc.). These functions are discussed in detail in the Console overview.
Member | Description |
dwX | The x offset in pixels of topleft window corner |
dwY | The y offset in pixels of topleft window corner |
dwXSize | The maximum width in characters of the new console window |
dwYSize | The maximum height in characters of the new console window |
dwXCountChars | The screen buffer width in character columns of the new console |
dwYCountChars | The screen buffer height in character rows of the new console |
dwFillAttribute | The text and background colors of the new console |
wShowWindow | Ignored by console apps |
lpTitle | The title of the new console window |
The following lists describe how the STARTUPINFO members will be used for GUI applications using CreateWindow and ShowWindow to create and display an overlapped window (provided that the appropriate dwFlags have been specified). These defaults are used only for the first window created and the first time that ShowWindow is called.
If the x parameter of CreateWindow is CW_USEDEFAULT:
Member | Description |
dwX | The horizontal offset in pixels of topleft window corner from the topleft corner of the display |
dwY | The vertical offset in pixels of topleft window corner from the topleft corner of the display |
If the nWidth parameter of CreateWindow is CW_USEDEFAULT:
Member | Description |
dwXSize | The width in pixels of the new window |
dwYSize | The height in pixels of the new window |
If the nCmdShow parameter of ShowWindow is SW_SHOWDEFAULT:
Member | Description |
wShowWindow | Specifies how the window is to be shown. It can be any of the SW_* constants. |
The following STARTUPINFO members are ignored by GUI applications:
dwXCountChars
dwYCountChars
dwFillAttribute
lpTitle