I need to realize a function for start a process with more controll than "start"
I found that is possible via vbscript with WMI control.
I want realize with your help a generic procedure , an wrapper?, for start a process.
the process be started with a priority and a parameter to hide the window, and more.
I start from here
Code: Select all
:Create_process [in] string CommandLine,
:: [in] string CurrentDirectory,
:: [in] uint32 CreateFlags;
:: [in] string EnvironmentVariables;
:: [in] uint16 ErrorMode;
:: [in] uint32 FillAttribute;
:: [in] uint32 PriorityClass;
:: [in] uint16 ShowWindow;
:: [in] string Title;
:: [in] string WinstationDesktop;
:: [in] uint32 X;
:: [in] uint32 XCountChars;
:: [in] uint32 XSize;
:: [in] uint32 Y;
:: [in] uint32 YCountChars;
:: [in] uint32 YSize;
:: [out] uint32 ProcessId
REM REF. http://msdn.microsoft.com/en-us/library/windows/desktop/aa389388%28v=vs.85%29.aspx
:: CommandLine [in]
:: Command line to execute. The system adds a null character to the command line, trimming the string if necessary, to indicate which file was actually used.
:: CurrentDirectory [in]
:: Current drive and directory for the child process. The string requires that the current directory resolves to a known path. A user can specify an absolute path or a path relative to the current working directory. If this parameter is NULL, ::the new process will have the same path as the calling process. This option is provided primarily for shells that must ::start an application and specify the application's initial drive and working directory.
:: The startup configuration of a Windows process. [in]
:: The PriorityClass property controls the priority class of the new process (used to determine the scheduling priorities of the threads in the process). If the PriorityClass 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.
:: The ShowWindow property specifies how the window is to be displayed to the user.
:: ProcessId [out]
:: Global process identifier that can be used to identify a process. The value is valid from the time the process is created until the time the process is terminated.
:: Return Value
:: 0 Successful Completion
:: 2 Access Denied
:: 3 Insufficient Privilege
:: 8 Unknown failure
:: 9 Path Not Found
:: 21 Invalid Parameter