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ワンポイントテクニック目次に戻る

楽天モバイル[UNLIMITが今なら1円] ECナビでポインと Yahoo 楽天 LINEがデータ消費ゼロで月額500円〜!


無料ホームページ 無料のクレジットカード 海外格安航空券 解約手数料0円【あしたでんき】 海外旅行保険が無料! 海外ホテル