Option expedition
Private Declare Function GetWindowsDirectory lib "kernel32" Alias "getWindowsDirectorya" (Byval Lpbuffer AS String, _ Byval Nsize As long) AS Long
Private submed1_click () 'variable definition. DIM DSTR1 AS STRING DSTR1 = STRING (255, 0) 'call function. Call getWindowsDirectory (DSTR1, 255) 'Returns numerical processing. DSTR1 = LEFT (DSTR1, INSTR (1, DSTR1, CHR (0)) - 1) 'The output of data. Text1.text = DSTR1END SUB
Private submmand2_click () end 'exits. End Sub
'Getting the system's temporary folder Option ExplicitPrivate Declare function getTemppath LIB "kernel32" Alias "getTemppatha" (Byval NBufferLength As Long, Byval LPBuffer AS String) As longprivate const Max_path = 260
Private Function GetTempDir () As String Dim TempDir As String Dim ChrLen As Long TempDir = Space (Max_PATH) ChrLen = GetTempPath (Max_PATH, TempDir) If ChrLen> Max_PATH Then ChrLen = GetTempPath (TempDir, ChrLen) End If GetTempDir = Left (TempDir, CHRLEN) END FUNCTION
Private Sub Form_Load () with text1 .font = 18 .text = getTempdir End Withend Sub
'Get System Folder Option Explicit
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "getsystemdirectorya" (Byval Nsize As long) As long
Private const Max_path = 260
Private Function GetSysDir () As String Dim SysDir As String Dim ChrLen As String SysDir = Space (MAX_PATH) ChrLen = GetSystemDirectory (SysDir, MAX_PATH) If ChrLen> MAX_PATH Then ChrLen = GetSystemDirectory (SysDir, ChrLen) End If GetSysDir = Left (SysDir, CHRLEN) END FUNCTION
Private Sub Form_Load () DIM SYSDIR AS STRING SYSDIR = Getsysdir Text1 = Sysdirend Sub