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 Structures, prefix the name with the module name and a period.
StartupInfo (Structures)
.
C# Definition:
// Use this version when the caller allocates the strings
// (For example: CreateProcess)
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
public struct STARTUPINFO
{
public uint cb;
public string lpReserved;
public string lpDesktop;
public string lpTitle;
public uint dwX;
public uint dwY;
public uint dwXSize;
public uint dwYSize;
public uint dwXCountChars;
public uint dwYCountChars;
public uint dwFillAttribute;
public uint dwFlags;
public ushort wShowWindow;
public ushort cbReserved2;
public IntPtr lpReserved2;
public IntPtr hStdInput;
public IntPtr hStdOutput;
public IntPtr hStdError;
}
// Use this version when the API allocates the strings
// (For example: GetStartupInfo)
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
public struct STARTUPINFO
{
public uint cb;
public IntPtr lpReserved; // Instead of string!
public IntPtr lpDesktop; // Instead of string!
public IntPtr lpTitle; // Instead of string!
public uint dwX;
public uint dwY;
public uint dwXSize;
public uint dwYSize;
public uint dwXCountChars;
public uint dwYCountChars;
public uint dwFillAttribute;
public uint dwFlags;
public ushort wShowWindow;
public ushort cbReserved2;
public IntPtr lpReserved2;
public IntPtr hStdInput;
public IntPtr hStdOutput;
public IntPtr hStdError;
}
VB Definition:
' Use this version when the caller allocates the strings
' (For example: CreateProcess)
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
Structure STARTUPINFO
Public cb As Integer
Public lpReserved As String
Public lpDesktop As String
Public lpTitle As String
Public dwX As Integer
Public dwY As Integer
Public dwXSize As Integer
Public dwYSize As Integer
Public dwXCountChars As Integer
Public dwYCountChars As Integer
Public dwFillAttribute As Integer
Public dwFlags As Integer
Public wShowWindow As Short
Public cbReserved2 As Short
Public lpReserved2 As Integer
Public hStdInput As Integer
Public hStdOutput As Integer
Public hStdError As Integer
End Structure
' Use this version when the API allocates the strings
' (For example: GetStartupInfo)
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
Structure STARTUPINFO
Public cb As Integer
Public lpReserved As IntPtr ' Instead of String!
Public lpDesktop As IntPtr ' Instead of String!
Public lpTitle As IntPtr ' Instead of String!
Public dwX As Integer
Public dwY As Integer
Public dwXSize As Integer
Public dwYSize As Integer
Public dwXCountChars As Integer
Public dwYCountChars As Integer
Public dwFillAttribute As Integer
Public dwFlags As Integer
Public wShowWindow As Short
Public cbReserved2 As Short
Public lpReserved2 As Integer
Public hStdInput As Integer
Public hStdOutput As Integer
Public hStdError As Integer
End Structure
Notes:
Some APIs, like GetStartupInfo, allocate the memory for the three string fields and do not expect the memory to ever be freed. Defining these fields as strings will cause the interop marshaler to call CoTaskMemFree, so it's important to define them as IntPtr (a raw pointer) instead when calling such APIs. After the call, use Marshal.PtrToStringAuto (or one of the other character sets if appropriate) to convert the IntPtr to a managed string that you can use.
Tips & Tricks:
Please add some!
Sample Code:
Please add some!
Alternative Managed API:
Do you know one? Please contribute it!
Creates a new process, using the creditials supplied by hToken. The application opened is running under the credentials and authority for the user supplied to LogonUser.
4/21/2013 11:21:50 PM - -203.19.158.31
Starts a new process, opens an application in that process, and uses a passed UserID and Password. The application opened is running under the credentials and authority of the UserID passed.
7/18/2010 5:39:00 AM - -87.74.130.67
TODO - a short description
3/16/2007 8:11:30 AM - -61.11.98.124
The GetStartupInfo API
2/4/2016 7:50:17 AM - -213.182.225.128
The CoTaskMemFree API
7/6/2013 3:17:22 PM - anonymous
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
TODO - a short description
3/16/2007 8:11:30 AM - -61.11.98.124
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
Please edit this page!
Do you have...
helpful tips?
corrections to the existing content?
alternate definitions?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.