.NET/Windows API for .NET

GetWindowsDirectory - 운영체제 설치경로

클리엘 2019. 8. 9. 17:02
728x90
Declare Function GetWindowsDirectory Lib "Kernel32" Alias "GetWindowsDirectoryA" (ByVal Name As String, ByVal Size As Integer) As Integer

▶VB.NET 선언

Dim sName As String = Space(10)
GetWindowsDirectory(sName, 11)

sName

▶VB.NET 호출

[System.Runtime.InteropServices.DllImport("Kernel32.dll")]
private static extern int GetWindowsDirectory(StringBuilder Name, int Size);

▶C# 선언

StringBuilder sName = new StringBuilder(10);
GetWindowsDirectory(sName, 11);

sName

▶C# 호출


GetWindowsDirectory의 첫번째 인수로는 운영체제 설치경로의 문자열이 들어갈 변수를 두번째 인수는 가져올 길이를 지정합니다.

728x90