home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap22 / getdir.frm < prev    next >
Text File  |  1995-09-24  |  2KB  |  56 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. End
  16. Attribute VB_Name = "Form1"
  17. Attribute VB_Creatable = False
  18. Attribute VB_Exposed = False
  19. Private Declare Function GetCurrentDirectory Lib "kernel32" _
  20.         Alias "GetCurrentDirectoryA" (ByVal nBufferLength As Long, _
  21.         ByVal lpBuffer As String) As Long
  22.  
  23. Private Declare Function GetSystemDirectory Lib "kernel32" _
  24.     Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, _
  25.     ByVal nSize As Long) As Long
  26.  
  27. Private Declare Function GetTempPath Lib "kernel32" _
  28.     Alias "GetTempPathA" (ByVal nBufferLength As Long, _
  29.     ByVal lpBuffer As String) As Long
  30.  
  31. Private Declare Function GetWindowsDirectory Lib "kernel32" _
  32.     Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, _
  33.     ByVal nSize As Long) As Long
  34.  
  35. Private Sub Form_Load()
  36.     Dim curDir As String
  37.     Dim sysDir As String
  38.     Dim tmpDir As String
  39.     Dim winDir As String
  40.  
  41.     curDir = Space(500)
  42.     sysDir = Space(500)
  43.     tmpDir = Space(500)
  44.     winDir = Space(500)
  45.     curDir = Left(curDir, GetCurrentDirectory(Len(curDir), curDir))
  46.     sysDir = Left(sysDir, GetSystemDirectory(sysDir, Len(sysDir)))
  47.     tmpDir = Left(tmpDir, GetTempPath(Len(tmpDir), tmpDir))
  48.     winDir = Left(winDir, GetWindowsDirectory(winDir, Len(winDir)))
  49.     MsgBox curDir
  50.     MsgBox sysDir
  51.     MsgBox tmpDir
  52.     MsgBox winDir
  53. End Sub
  54.  
  55.  
  56.