Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Form_Load()
Dim strWinPath As String * 128
Debug.Print Left$(strWinPath, GetWindowsDirectory(strWinPath, Len(strWinPath)))
End Sub
Option Explicit
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Const MaxLoop As Long = 200000
Private Sub Form_Load()
Dim strWinPath As String * 128, strPath As String
Dim lngIndex As Long
Dim sglStart As Single
sglStart = Timer()
For lngIndex = 1 To MaxLoop
'GetWindowsDirectory strWinPath, Len(strWinPath)
strPath = Left$(strWinPath, GetWindowsDirectory(strWinPath, Len(strWinPath)))
Next lngIndex
Debug.Print Timer() - sglStart
sglStart = Timer()
For lngIndex = 1 To MaxLoop
strPath = Environ$("WinDir")
Next lngIndex
Debug.Print Timer() - sglStart
End Sub
Dim EnvString, Indx, Msg, PathLen ' Declare variables.
Indx = 1 ' Initialize index to 1.
Do
EnvString = Environ(Indx) ' Get environment
' variable.
If Left(EnvString, 5) = "PATH=" Then ' Check PATH entry.
PathLen = Len(Environ("PATH")) ' Get length.
Msg = "PATH entry = " & Indx & " and length = " & PathLen
Exit Do
Else
Indx = Indx + 1 ' Not PATH entry,
End If ' so increment.
Loop Until EnvString = ""
If PathLen > 0 Then
MsgBox Msg ' Display message.
Else
MsgBox "No PATH environment variable exists."
End If