GetSystemDirectory (kernel32)
Last changed: -64.165.22.203

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern uint GetSystemDirectory([Out] StringBuilder lpBuffer,
   uint uSize);

VB.NET Signature:

<DllImport("kernel32.dll", SetLastError:=true, EntryPoint:="GetSystemDirectoryW", CharSet:=CharSet.Unicode)> _
Public Function GetSystemDirectory(<MarshalAs(UnmanagedType.LPTSTR)>lpBuffer As System.Text.StringBuilder, _
                   uSize As UInteger ) As UInteger
End function

VB Signature:

Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" _
          (ByVal lpBuffer As String, _
           ByVal nSize As Long) As Long

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    StringBuilder sbSystemDir = new StringBuilder(256);
    res = GetSystemDirectory(sbSystemDir,256);

Alternative Managed API:

System.Environment.GetFolderPath( ... ) As String

Documentation