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.
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;
}
GetStartupPath() returns the path of the object that started the program, be it a shortcut or an EXE file
Tested on VB.NET Framework 2.0 in XP and Win10
Private Declare Sub GetStartupInfo Lib "kernel32.dll" Alias "GetStartupInfoA" (ByRef lpStartupInfo As STARTUPINFO)
Private Structure STARTUPINFO
Public cb As UInteger
Public lpReserved As String
Public lpDesktop As String
Public lpTitle As String
Public dwX As UInteger
Public dwY As UInteger
Public dwXSize As UInteger
Public dwYSize As UInteger
Public dwXCountChars As UInteger
Public dwYCountChars As UInteger
Public dwFillAttribute As UInteger
Public dwFlags As UInteger
Public wShowWindow As UShort
Public cbReserved2 As UShort
Public lpReserved2 As IntPtr
Public hStdInput As IntPtr
Public hStdOutput As IntPtr
Public hStdError As IntPtr
End Structure
Private Const STARTF_TITLESHORTCUT = &H800
Public Function GetStartupPath() As String
Dim si As New STARTUPINFO
si.dwFlags = si.dwFlags And STARTF_TITLESHORTCUT
Call GetStartupInfo(si)
Return si.lpTitle
End Function
Return si.lpTitle
End Function
Alternative Managed API:
Do you know one? Please contribute it!
Alternative Managed API:
Do you know one? Please contribute it!
The GetStartupInfo API
5/3/2022 9:25:41 PM - Wade Spital-135.180.201.213
Passed in place of STARTUPINFO to extend CreateProcess
7/8/2019 11:50:55 AM - dahall-72.24.140.51
Click to read this page
4/6/2008 7:23:14 AM - anonymous
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).