Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
Shared Function CreateProcess(lpApplicationName As String, _
lpCommandLine As String, ByRef lpProcessAttributes As SECURITY_ATTRIBUTES, _
ByRef lpThreadAttributes As SECURITY_ATTRIBUTES,bInheritHandles As Boolean, _
dwCreationFlags As UInt32, lpEnvironment As IntPtr, lpCurrentDirectory As String, _
<[In]> ByRef lpStartupInfo As STARTUPINFO, _
<[Out]> ByRef lpProcessInformation As PROCESS_INFORMATION) As Boolean
This is great for starting an external app and then use the PID and handle for calls to functions such as WaitForSingleObject and all window message functions.
It should also be considered when wanting to start a process without all the diagnostic capability. When starting a process, about 3 MB of DLLs are loaded as well as several extra threads started. Doing this via Win32 API avoids this overhead.
Tips & Tricks:
Add this in constructor of a class to logically treat the app as an object.
Sample Code C#:
public static void StartupNotepad()
const uint NORMAL_PRIORITY_CLASS = 0x0020;
string Application = Environment.GetEnvironmentVariable("windir") + @"\Notepad.exe";
string CommandLine = @" c:\boot.ini";
PROCESS_INFORMATION pInfo = new PROCESS_INFORMATION();
STARTUPINFO sInfo = new STARTUPINFO();
SECURITY_ATTRIBUTES pSec = new SECURITY_ATTRIBUTES();
SECURITY_ATTRIBUTES tSec = new SECURITY_ATTRIBUTES();
pSec.nLength = Marshal.SizeOf(pSec);
tSec.nLength = Marshal.SizeOf(tSec);
Public Shared Sub StartupNotepad()
Const NORMAL_PRIORITY_CLASS AS UInt32 = &h2
Dim retValue As Boolean
Dim Application As String = Environment.GetEnvironmentVariable("windir") & "\Notepad.exe"
Dim CommandLine As String = " c:\boot.ini"
Dim pInfo As PROCESS_INFORMATION = New PROCESS_INFORMATION()
Dim sInfo As STARTUPINFO = New STARTUPINFO()
Dim pSec As SECURITY_ATTRIBUTES = New SECURITY_ATTRIBUTES()
Dim tSec As SECURITY_ATTRIBUTES = New SECURITY_ATTRIBUTES()
pSec.nLength = Marshal.SizeOf(pSec)
tSec.nLength = Marshal.SizeOf(tSec)
Passed in place of STARTUPINFO to extend CreateProcess
7/8/2019 11:50:55 AM - dahall-22.214.171.124
The '''PROCESS_INFORMATION''' structure is filled in by either the CreateProcess, CreateProcessAsUser, CreateProcessWithLogonW, or CreateProcessWithTokenW function with information about the newly created process and its primary thread.
8/9/2010 12:13:12 PM - -126.96.36.199
The [SECURITY_ATTRIBUTES] structure contains the security descriptor for an object and specifies whether the handle retrieved by specifying this structure is inheritable. This structure provides security settings for objects created by various functions, such as Kernel32.CreateFile, Kernel32.CreatePipe, Kernel32.CreateProcess, or Advapi32.RegCreateKeyEx.
7/15/2010 5:39:54 AM - -188.8.131.52
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).