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.
<DllImport("kernel32.dll")> _
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
End Function
Boo Signature:
[DllImport("kernel32.dll", SetLastError : true)]
def CreateProcess(
lpApplicationName as string,
lpCommandLine as string,
ref lpProcessAttributes as SECURITY_ATTRIBUTES,
ref lpThreadAttributes as SECURITY_ATTRIBUTES,
bInheritHandles as bool,
dwCreationFlags as CreationFlags,
lpEnvironment as IntPtr,
lpCurrentDirectory as string,
ref lpStartupInfo as STARTUPINFOEX,
ref lpProcessInformation as PROCESS_INFORMATION) as bool:
pass
User-Defined Types:
[StructLayout(LayoutKind.Sequential)]
struct SECURITY_ATTRIBUTES:
nLength as int
lpSecurityDescriptor as IntPtr
[StructLayout(LayoutKind.Sequential)]
struct STARTUPINFO:
cb as uint
lpReserved as IntPtr
lpDesktop as IntPtr
lpTitle as IntPtr
dwX as uint
dwY as uint
dwXSize as uint
dwYSize as uint
dwXCountChars as uint
dwYCountChars as uint
dwFillAttributes as uint
dwFlags as uint
wShowWindow as ushort
cbReserved as ushort
lpReserved2 as IntPtr
hStdInput as IntPtr
hStdOutput as IntPtr
hStdErr as IntPtr
[StructLayout(LayoutKind.Sequential)]
struct STARTUPINFOEX:
StartupInfo as STARTUPINFO
lpAttributeList as IntPtr
[StructLayout(LayoutKind.Sequential)]
struct PROCESS_INFORMATION:
hProcess as IntPtr
hThread as IntPtr
dwProcessId as int
dwThreadId as int
Notes:
This is great for starting an external app and then using the PID and handle for calls to functions such as WaitForSingleObject and all window message functions.
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-72.24.140.51
Passed in place of STARTUPINFO to extend CreateProcess
1/22/2015 10:29:55 PM - anonymous
Add attributes to an initialized proc thread attribute list
7/20/2021 7:58:04 AM - -84.74.145.231
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).