Win32_ProcessStartup class
The Win32_ProcessStartup abstract WMI class represents the startup configuration of a Windows-based process. The class is defined as a method type definition, which means that it is only used for passing information to the Create method of the Win32_Process class.
The following syntax is simplified from Managed Object Format (MOF) code and includes all inherited properties.
Syntax
class Win32_ProcessStartup : Win32_MethodParameterClass
{
uint32 CreateFlags;
string EnvironmentVariables[];
uint16 ErrorMode;
uint32 FillAttribute;
uint32 PriorityClass;
uint16 ShowWindow;
string Title;
string WinstationDesktop;
uint32 X;
uint32 XCountChars;
uint32 XSize;
uint32 Y;
uint32 YCountChars;
uint32 YSize;
};
Members
The Win32_ProcessStartup class has the following types of members:
Properties
The Win32_ProcessStartup class has the following properties.
- CreateFlags
-
- Data type: uint32
- Access type: Read-only
Additional values that control the priority class and the creation of the process. The following creation values can be specified in any combination, except as noted.
Value (Dec/Hex) Meaning - Debug_Process
- 1 (0x1)
If this flag is set, the calling process is treated as a debugger, and the new process is being debugged. The system notifies the debugger of all debug events that occur in the process being debugged. On Windows 95 and Windows 98 operating systems, this flag is not valid if the new process is a 16-bit application.
- Debug_Only_This_Process
- 2 (0x2)
If this flag is not set and the calling process is being debugged, the new process becomes another process being debugged. If the calling process is not a process of being debugged, no debugging-related actions occur.
- Create_Suspended
- 4 (0x4)
The primary thread of the new process is created in a suspended state and does not run until the ResumeThread method is called.
- Detached_Process
- 8 (0x8)
For console processes, the new process does not have access to the console of the parent process. This flag cannot be used if the Create_New_Console flag is set.
- Create_New_Console
- 16 (0x10)
This new process has a new console, instead of inheriting the parent console. This flag cannot be used with the Detached_Process flag.
- Create_New_Process_Group
- 512 (0x200)
This new process is the root process of a new process group. The process group includes all of the processes that are descendants of this root process. The process identifier of the new process group is the same as the process identifier that is returned in the ProcessID property of the Win32_Process class. Process groups are used by the GenerateConsoleCtrlEvent method to enable the sending of either a CTRL+C signal or a CTRL+BREAK signal to a group of console processes.
- Create_Unicode_Environment
- 1024 (0x400)
The environment settings listed in the EnvironmentVariables property use Unicode characters. If this flag is not set, the environment block uses ANSI characters.
- Create_Default_Error_Mode
- 67108864 (0x4000000)
Newly created processes are given the system default error mode of the calling process instead of inheriting the error mode of the parent process. This flag is useful for multithreaded shell applications that run with hard errors disabled.
- CREATE_BREAKAWAY_FROM_JOB
- 16777216 (0x1000000)
Used for the created process not to be limited by the job object.
- EnvironmentVariables
-
- Data type: string array
- Access type: Read/write
List of settings for the configuration of a computer. Environment variables specify search paths for files, directories for temporary files, application-specific options, and other similar information. The system maintains a block of environment settings for each user and one for the computer. The system environment block represents environment variables for all of the users of a specific computer. A user's environment block represents the environment variables that the system maintains for a specific user, and includes the set of system environment variables. By default, each process receives a copy of the environment block for its parent process. Typically, this is the environment block for the user who is logged on. A process can specify different environment blocks for its child processes.
- ErrorMode
-
- Data type: uint16
- Access type: Read/write
On some non-x86 processors, misaligned memory references cause an alignment fault exception. The No_Alignment_Fault_Except flag lets you control whether or not an operating system automatically fixes such alignment faults, or makes them visible to an application. On a millions of instructions per second (MIPS) platform, an application must explicitly call SetErrorMode with the No_Alignment_Fault_Except flag to have the operating system automatically fix alignment faults.
How an operating system processes several types of serious errors. You can specify that the operating system process errors, or an application can receive and process errors.
The default setting is for the operating system to make alignment faults visible to an application. Because the x86 platform does not make alignment faults visible to an application, the No_Alignment_Fault_Except flag does not make the operating system raise an alignment fault error—even if the flag is not set. The default state for SetErrorMode is to set all of the flags to 0 (zero).
- FillAttribute
-
- Data type: uint32
- Access type: Read/write
The text and background colors if a new console window is created in a console application. These values are ignored in graphical user interface (GUI) applications.
Value (Dec/Hex) Meaning - 1 (0x1)
Foreground_Blue
- 2 (0x2)
Foreground_Green
- 4 (0x4)
Foreground_Red
- 8 (0x8)
Foreground_Intensity
- 16 (0x10)
Background_Blue
- 32 (0x20)
Background_Green
- 64 (0x40)
Background_Red
- 128 (0x80)
Background_Intensity
- PriorityClass
-
- Data type: uint32
- Access type: Read/write
Priority class of the new process. Use this property to determine the schedule priorities of the threads in the process. If the property is left null, the priority class defaults to Normal—unless the priority class of the creating process is Idle or Below_Normal. In these cases, the child process receives the default priority class of the calling process.
- ShowWindow
-
- Data type: uint16
- Access type: Read/write
How the window is displayed to the user.
Value Meaning - SW_HIDE
- 0
Hides the window and activates another window.
- SW_NORMAL
- 1
Activates and displays a window. If the window is minimized or maximized, the system restores it to the original size and position. An application specifies this flag when displaying the window for the first time.
- SW_SHOWMINIMIZED
- 2
Activates the window, and displays it as a minimized window.
- SW_SHOWMAXIMIZED
- 3
Activates the window, and displays it as a maximized window.
- SW_SHOWNOACTIVATE
- 4
Displays a window in its most recent size and position. This value is similar to SW_NORMAL, except that the window is not activated.
- SW_SHOW
- 5
Activates the window, and displays it at the current size and position.
- SW_MINIMIZE
- 6
Minimizes the specified window, and activates the next top-level window in the Z order.
- SW_SHOWMINNOACTIVE
- 7
Displays the window as a minimized window. This value is similar to SW_SHOWMINIMZED, except that the window is not activated.
- SW_SHOWNA
- 8
Displays the window at the current size and position. This value is similar to SW_SHOW, except that the window is not activated.
- SW_RESTORE
- 9
Activates and displays the window. If the window is minimized or maximized, the system restores it to the original size and position. An application specifies this flag when restoring a minimized window.
- SW_SHOWDEFAULT
- 10
Sets the show state based on the SW_ value that is specified in the STARTUPINFO structure passed to the CreateProcess function by the program that starts the application.
- SW_FORCEMINIMIZE
- 11
Windows Server 2003, Windows 2000, and Windows XP: Minimizes a window, even when the thread that owns the window is hung. Only use this flag when minimizing windows from a different thread. - Title
-
- Data type: string
- Access type: Read/write
Text displayed in the title bar when a new console window is created; used for console processes. If NULL, the name of the executable file is used as the window title. This property must be NULL for GUI or console processes that do not create a new console window.
- WinstationDesktop
-
- Data type: string
- Access type: Read/write
The name of the desktop or the name of both the desktop and window station for the process—for Windows NT only. A backslash in the string indicates that the string includes both desktop and window station names. If WinstationDesktop is NULL, the new process inherits the desktop and window station of its parent process. If WinstationDesktop is an empty string, the process does not inherit the desktop and window station of its parent process. The system determines if a new desktop and window station must be created. A window station is a secure object that contains a clipboard, a set of global atoms, and a group of desktop objects. The interactive window station that is assigned to the logon session of the interactive user also contains the keyboard, mouse, and display device. A desktop is a secure object contained within a window station. A desktop has a logical display surface and contains windows, menus, and hooks. A window station can have multiple desktops. Only the desktops of the interactive window station can be visible and receive user input.
- X
-
- Data type: uint32
- Access type: Read/write
The X offset of the upper left corner of a window if a new window is created—in pixels. The offsets are 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.
Note X and Y cannot be specified independently.
- XCountChars
-
- Data type: uint32
- Access type: Read/write
Screen buffer width in character columns. This property is used for processes that create a console window, and is ignored in GUI processes.
Note XCountChars and YCountChars cannot be specified independently.
- XSize
-
- Data type: uint32
- Access type: Read/write
Pixel width of a window if a new window is created. For GUI processes, this is only usedthe first time the new process calls CreateWindow to create an overlapped window if the nWidth parameter of CreateWindow is CW_USEDEFAULT.
Note XSize and YSize cannot be specified independently.
- Y
-
- Data type: uint32
- Access type: Read/write
Pixel offset of the upper-left corner of a window if a new window is created. The offsets are 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.
Note X and Y cannot be specified independently.
- YCountChars
-
- Data type: uint32
- Access type: Read/write
Screen buffer height in character rows. This property is used for processes that create a console window, but is ignored in GUI processes.
Note XCountChars and YCountChars cannot be specified independently.
- YSize
-
- Data type: uint32
- Access type: Read/write
Pixel height of a window if a new window is created. 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.
Note XSize and YSize cannot be specified independently.
Remarks
This class is derived from Win32_MethodParameterClass.
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
For C++ code examples, see WMI C++ Application Examples.
The following VBScript code example creates a Notepad process on the local computer. Win32_ProcessStartup is used to configure the process settings.
Const SW_NORMAL = 1
strComputer = "."
strCommand = "Notepad.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
' Configure the Notepad process to show a window
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = SW_NORMAL
' Create Notepad process
Set objProcess = objWMIService.Get("Win32_Process")
intReturn = objProcess.Create _
(strCommand, Null, objConfig, intProcessID)
If intReturn <> 0 Then
Wscript.Echo "Process could not be created." & _
vbNewLine & "Command line: " & strCommand & _
vbNewLine & "Return value: " & intReturn
Else
Wscript.Echo "Process created." & _
vbNewLine & "Command line: " & strCommand & _
vbNewLine & "Process ID: " & intProcessID
End If
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
MOF |
|
|
DLL |
|
|
Namespace |
\root\CIMV2 |
See also
Send comments about this topic to Microsoft
Build date: 9/7/2011
