home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap22 / getdir.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-24  |  1.7 KB  |  48 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   8460
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1515
  7.    ClientWidth     =   6690
  8.    Height          =   8865
  9.    Left            =   1080
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   8460
  12.    ScaleWidth      =   6690
  13.    Top             =   1170
  14.    Width           =   6810
  15. Attribute VB_Name = "Form1"
  16. Attribute VB_Creatable = False
  17. Attribute VB_Exposed = False
  18. Private Declare Function GetCurrentDirectory Lib "kernel32" _
  19.         Alias "GetCurrentDirectoryA" (ByVal nBufferLength As Long, _
  20.         ByVal lpBuffer As String) As Long
  21. Private Declare Function GetSystemDirectory Lib "kernel32" _
  22.     Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, _
  23.     ByVal nSize As Long) As Long
  24. Private Declare Function GetTempPath Lib "kernel32" _
  25.     Alias "GetTempPathA" (ByVal nBufferLength As Long, _
  26.     ByVal lpBuffer As String) As Long
  27. Private Declare Function GetWindowsDirectory Lib "kernel32" _
  28.     Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, _
  29.     ByVal nSize As Long) As Long
  30. Private Sub Form_Load()
  31.     Dim curDir As String
  32.     Dim sysDir As String
  33.     Dim tmpDir As String
  34.     Dim winDir As String
  35.     curDir = Space(500)
  36.     sysDir = Space(500)
  37.     tmpDir = Space(500)
  38.     winDir = Space(500)
  39.     curDir = Left(curDir, GetCurrentDirectory(Len(curDir), curDir))
  40.     sysDir = Left(sysDir, GetSystemDirectory(sysDir, Len(sysDir)))
  41.     tmpDir = Left(tmpDir, GetTempPath(Len(tmpDir), tmpDir))
  42.     winDir = Left(winDir, GetWindowsDirectory(winDir, Len(winDir)))
  43.     MsgBox curDir
  44.     MsgBox sysDir
  45.     MsgBox tmpDir
  46.     MsgBox winDir
  47. End Sub
  48.