VC++ STARTUPINFO Structure

来源:互联网 发布:versapro编程软件下载 编辑:程序博客网 时间:2024/06/06 10:08
STARTUPINFO Structure

Specifies the window station, desktop, standard handles, and appearance of the main window for a process at creation time.

Syntax

C++
typedef struct _STARTUPINFO {  DWORD  cb;  LPTSTR lpReserved;  LPTSTR lpDesktop;  LPTSTR lpTitle;  DWORD  dwX;  DWORD  dwY;  DWORD  dwXSize;  DWORD  dwYSize;  DWORD  dwXCountChars;  DWORD  dwYCountChars;  DWORD  dwFillAttribute;  DWORD  dwFlags;  WORD   wShowWindow;  WORD   cbReserved2;  LPBYTE lpReserved2;  HANDLE hStdInput;  HANDLE hStdOutput;  HANDLE hStdError;} STARTUPINFO, *LPSTARTUPINFO;

Members

cb

The size of the structure, in bytes.

lpReserved

Reserved; must be NULL.

lpDesktop

The name of the desktop, or the name of both the desktop and window station for this process. A backslash in the string indicates that the string includes both the desktop and window station names. For more information, see Thread Connection to a Desktop.

lpTitle

For console processes, 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 must be NULL for GUI or console processes that do not create a new console window.

dwX

If dwFlags specifies STARTF_USEPOSITION, this member is the x offset of the upper left corner of a window if a new window is created, in pixels. Otherwise, this member is ignored.

The offset is from the upper left corner of the screen. For GUI processes, the specified position is used the first time the new process calls CreateWindow to create an overlapped window if the x parameter of CreateWindow is CW_USEDEFAULT.

dwY

If dwFlags specifies STARTF_USEPOSITION, this member is the y offset of the upper left corner of a window if a new window is created, in pixels. Otherwise, this member is ignored.

The offset is from the upper left corner of the screen. For GUI processes, the specified position is used the first time the new process calls CreateWindow to create an overlapped window if the y parameter of CreateWindow is CW_USEDEFAULT.

dwXSize

If dwFlags specifies STARTF_USESIZE, this member is the width of the window if a new window is created, in pixels. Otherwise, this member is ignored.

For GUI processes, this is used only the first time the new process calls CreateWindow to create an overlapped window if the nWidth parameter of CreateWindow is CW_USEDEFAULT.

dwYSize

If dwFlags specifies STARTF_USESIZE, this member is the height of the window if a new window is created, in pixels. Otherwise, this member is ignored.

For GUI processes, this is used only the first time the new process calls CreateWindow to create an overlapped window if the nHeight parameter of CreateWindow is CW_USEDEFAULT.

dwXCountChars

If dwFlags specifies STARTF_USECOUNTCHARS, if a new console window is created in a console process, this member specifies the screen buffer width, in character columns. Otherwise, this member is ignored.

dwYCountChars

If dwFlags specifies STARTF_USECOUNTCHARS, if a new console window is created in a console process, this member specifies the screen buffer height, in character rows. Otherwise, this member is ignored.

dwFillAttribute

If dwFlags specifies STARTF_USEFILLATTRIBUTE, this member is the initial text and background colors if a new console window is created in a console application. Otherwise, this member is ignored.

This value can be any combination of the following values: FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED, FOREGROUND_INTENSITY, BACKGROUND_BLUE, BACKGROUND_GREEN, BACKGROUND_RED, and BACKGROUND_INTENSITY. For example, the following combination of values produces red text on a white background:

FOREGROUND_RED| BACKGROUND_RED| BACKGROUND_GREEN| BACKGROUND_BLUE

dwFlags

A bit field that determines whether certain STARTUPINFO members are used when the process creates a window. This member can be one or more of the following values.

ValueMeaning
STARTF_FORCEONFEEDBACK

Indicates that the cursor is in feedback mode for two seconds after CreateProcess is called. The Working in Background cursor is displayed (see the Pointers tab in the Mouse control panel utility).

If during those two seconds the process makes the first GUI call, the system gives five more seconds to the process. If during those five seconds the process shows a window, the system gives five more seconds to the process to finish drawing the window.

The system turns the feedback cursor off after the first call to GetMessage, regardless of whether the process is drawing.

STARTF_FORCEOFFFEEDBACK

Indicates that the feedback cursor is forced off while the process is starting. The Normal Select cursor is displayed.

STARTF_RUNFULLSCREEN

Indicates that the process should be run in full-screen mode, rather than in windowed mode.

This flag is only valid for console applications running on an x86 computer.

STARTF_USECOUNTCHARS

The dwXCountChars and dwYCountChars members are valid.

STARTF_USEFILLATTRIBUTE

The dwFillAttribute member is valid.

STARTF_USEPOSITION

The dwX and dwY members are valid.

STARTF_USESHOWWINDOW

The wShowWindow member is valid.

STARTF_USESIZE

The dwXSize and dwYSize members are valid.

STARTF_USESTDHANDLES

The hStdInput, hStdOutput, and hStdError members are valid.

If this flag is specified when calling one of the process creation functions, the handles must be inheritable and the function's bInheritHandles parameter must be set to TRUE. For more information, see Handle Inheritance.

If this flag is specified when calling the GetStartupInfo function, these members are either the handle value specified during process creation or INVALID_HANDLE_VALUE.

 

wShowWindow

If dwFlags specifies STARTF_USESHOWWINDOW, this member can be any of the SW_ constants defined in Winuser.h. Otherwise, this member is ignored.

For GUI processes, wShowWindow specifies the default value the first time ShowWindow is called. The nCmdShow parameter of ShowWindow is ignored. In subsequent calls to ShowWindow, the wShowWindow member is used if the nCmdShow parameter of ShowWindow is set to SW_SHOWDEFAULT.

cbReserved2

Reserved for use by the C Run-time; must be zero.

lpReserved2

Reserved for use by the C Run-time; must be NULL.

hStdInput

If dwFlags specifies STARTF_USESTDHANDLES, this member is the standard input handle for the process. Otherwise, this member is ignored and the default for standard input is the keyboard buffer.

hStdOutput

If dwFlags specifies STARTF_USESTDHANDLES, this member is the standard output handle for the process. Otherwise, this member is ignored and the default for standard output is the console window's buffer.

hStdError

If dwFlags specifies STARTF_USESTDHANDLES, this member is the standard error handle for the process. Otherwise, this member is ignored and the default for standard error is the console window's buffer.

Remarks

For graphical user interface (GUI) processes, this information affects the first window created by the CreateWindow function and shown by the ShowWindow function. For console processes, this information affects the console window if a new console is created for the process. A process can use the GetStartupInfo function to retrieve the STARTUPINFO structure specified when the process was created.

If a GUI process is being started and neither STARTF_FORCEONFEEDBACK or STARTF_FORCEOFFFEEDBACK is specified, the process feedback cursor is used. A GUI process is one whose subsystem is specified as "windows."

Examples

For an example, see Creating Processes.

Requirements

Minimum supported clientWindows 2000 ProfessionalMinimum supported serverWindows 2000 ServerHeaderWinbase.h (include Windows.h)Unicode and ANSI namesSTARTUPINFOW (Unicode) and STARTUPINFOA (ANSI)

See Also

CreateProcess
CreateProcessAsUser
CreateProcessWithLogonW
CreateProcessWithTokenW
GetStartupInfo

Send comments about this topic to Microsoft

原创粉丝点击