Windowsディレクトリを取得

<Windows特有のアプリケーションが機種を問わず実行可能に>

宣 言

Private Declare Function GetWindowsDirectory Lib "KERNEL32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer$, ByVal nSize&) As Longng

※Privateは必要に応じて削除またはPublicに変更

引 数 説 明


WinDir

String

Windowsディレクトリを格納する文字列

Size

Long

WinDirのサイズ

注意:WinDirにはNull文字列が含まれます。何らかの方法で消去してください。

サ ン プ ル プ ロ グ ラ ム

プログラムを張りつけ実行するとWindowsディレクトリを表示して終了します。

動作確認:Visual Basic 5.0,Windows98

Private Declare Function GetWindowsDirectory Lib "KERNEL32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer$, ByVal nSize&) As Long

Private Sub Form_Load()
Dim WinDir As String * 255
GetWindowsDirectory WinDir, 255
MsgBox WinDir
End
End Sub

トップに戻る
Visual Basicワンポイントテクニック目次に戻る

Gポイントポイ活 Amazon Yahoo 楽天

無料ホームページ 楽天モバイル[UNLIMITが今なら1円] 海外格安航空券 海外旅行保険が無料!