📄 getwindowsdirectory.bas
字号:
Attribute VB_Name = "GetWindowsDirectoryModule"
Option Explicit
Public Const MAX_PATH = 260
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
'返回Windows的安装目录
Sub GetWindowsDirectory_test()
Dim S As String, Length As Long
S = String(MAX_PATH, 0)
Length = GetWindowsDirectory(S, MAX_PATH)
S = Left(S, InStr(S, Chr(0)) - 1)
MsgBox "Windows 路径=" & S, , "GetWindowsDirectory"
End Sub
Sub Main()
GetWindowsDirectory_test
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -