Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

GetStartupInfo (kernel32)
 
.
Summary

C# Signature:

[DllImport("kernel32.dll", SetLastError = false, CharSet = CharSet.Auto)]
static extern void GetStartupInfo(out STARTUPINFO lpStartupInfo);

VB Signature:

Declare Sub GetStartupInfo Lib "kernel32.dll" (<Out> ByRef As STARTUPINFO)

User-Defined Types:

STARTUPINFO

Notes:

Tips & Tricks:

On my W10x64 my vshost.exe died by caling the GetStartupInfoW method.

So i changed it to GetStartupInfoA and also changed the 'STARTUPINFO's StructureLayout-Attribute to CharSet.Ansi instead of Unicode.

Sample Code:

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    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;
     }

     [DllImport("kernel32.dll", SetLastError = true, EntryPoint = "GetStartupInfoA")]
     public static extern void GetStartupInfo(out STARTUPINFO lpStartupInfo);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation

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).

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions