home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Windows 95 Special 2 / WIN95_2.bin / utils / envelop / envelop.6 / Tools / Bootcamp / basic / apisystm / apisystm.eto < prev    next >
Encoding:
Text File  |  1996-07-08  |  3.0 KB  |  108 lines

  1. Type APISysDir
  2.   Declare Function GetSystemDirectoryA Lib "kernel32" (ByVal file As String, ByVal size As Long) As Long
  3.  
  4. End Type
  5.  
  6. Type APISystemMasterForm From SampleMasterForm
  7.   Dim btnGetInfo As New Button
  8.   Dim Label1 As New Label
  9.   Dim Label2 As New Label
  10.   Dim lblWinDir As New Label
  11.   Dim lblWinSysDir As New Label
  12.  
  13.   ' METHODS for object: APISystemMasterForm
  14.   Sub btnGetInfo_Click()
  15.     Dim buffer As String
  16.     Dim totalchars As Integer
  17.   
  18.     buffer = Space(255)
  19.     totalchars = APIWinDir.GetWindowsDirectoryA(buffer, 255)
  20.     If totalchars == 0 Then 
  21.       lblWinDir.Caption = "Unable to determine Windows directory."
  22.     Else 
  23.       lblWinDir.Caption = UCase(Left(buffer, totalchars))
  24.     End If
  25.   
  26.     buffer = Space(255)
  27.     totalchars = APISysDir.GetSystemDirectoryA(buffer, 255)
  28.     If totalchars == 0 Then 
  29.       lblWinSysDir.Caption = "Unable to determine System directory."
  30.     Else 
  31.       lblWinSysDir.Caption = UCase(Left(buffer, totalchars))
  32.     End If
  33.   End Sub
  34.  
  35.   Sub ResetApplication_Click ()
  36.   
  37.     ' Clear the two labels
  38.     lblWinDir.Caption = ""
  39.     lblWinSysDir.Caption = ""
  40.   
  41.   End Sub
  42.  
  43.   Sub Load()
  44.   
  45.     ' Restore prerequisite objects that are shared with other samples,
  46.     ' and therefore may already be loaded.
  47.     If FindObject("APIWinDir") == Nothing Then 
  48.       LoadTextObject(SampleDir & "winapi.eto")
  49.     End If
  50.   
  51.   End Sub
  52.  
  53. End Type
  54.  
  55. Type APIWinDir
  56.   Declare Function GetWindowsDirectoryA Lib "kernel32" (ByVal file As String, ByVal size As Long) As Long
  57.  
  58. End Type
  59.  
  60. Begin Code
  61. ' Reconstruction commands for object: APISysDir
  62. '
  63.   With APISysDir
  64.   End With  'APISysDir
  65. ' Reconstruction commands for object: APISystemMasterForm
  66. '
  67.   With APISystemMasterForm
  68.     .Caption := "Windows API Functions Demo"
  69.     .Move(3270, 1185, 5790, 4065)
  70.     .SampleDir := "W:\bootcamp\basic\apisystm\"
  71.     .SampleName := "apisystm"
  72.     With .btnGetInfo
  73.       .Caption := "Get Info"
  74.       .ZOrder := 1
  75.       .Move(1950, 2550, 1650, 450)
  76.     End With  'APISystemMasterForm.btnGetInfo
  77.     With .Label1
  78.       .Caption := "Windows Directory:"
  79.       .ForeColor := 13107200
  80.       .ZOrder := 2
  81.       .Move(450, 450, 1950, 300)
  82.     End With  'APISystemMasterForm.Label1
  83.     With .Label2
  84.       .Caption := "Windows System Directory:"
  85.       .ForeColor := 13107200
  86.       .ZOrder := 3
  87.       .Move(450, 1500, 2850, 300)
  88.     End With  'APISystemMasterForm.Label2
  89.     With .lblWinDir
  90.       .Caption := "C:\WINNT"
  91.       .ZOrder := 4
  92.       .Move(900, 900, 4350, 300)
  93.     End With  'APISystemMasterForm.lblWinDir
  94.     With .lblWinSysDir
  95.       .Caption := "C:\WINNT\SYSTEM32"
  96.       .ZOrder := 5
  97.       .Move(900, 1950, 4350, 300)
  98.     End With  'APISystemMasterForm.lblWinSysDir
  99.     With .helpfile
  100.       .FileName := "W:\bootcamp\basic\apisystm\apisystm.hlp"
  101.     End With  'APISystemMasterForm.helpfile
  102.   End With  'APISystemMasterForm
  103. ' Reconstruction commands for object: APIWinDir
  104. '
  105.   With APIWinDir
  106.   End With  'APIWinDir
  107. End Code
  108.