home *** CD-ROM | disk | FTP | other *** search
- Type APISysDir
- Declare Function GetSystemDirectoryA Lib "kernel32" (ByVal file As String, ByVal size As Long) As Long
-
- End Type
-
- Type APISystemMasterForm From SampleMasterForm
- Dim btnGetInfo As New Button
- Dim Label1 As New Label
- Dim Label2 As New Label
- Dim lblWinDir As New Label
- Dim lblWinSysDir As New Label
-
- ' METHODS for object: APISystemMasterForm
- Sub btnGetInfo_Click()
- Dim buffer As String
- Dim totalchars As Integer
-
- buffer = Space(255)
- totalchars = APIWinDir.GetWindowsDirectoryA(buffer, 255)
- If totalchars == 0 Then
- lblWinDir.Caption = "Unable to determine Windows directory."
- Else
- lblWinDir.Caption = UCase(Left(buffer, totalchars))
- End If
-
- buffer = Space(255)
- totalchars = APISysDir.GetSystemDirectoryA(buffer, 255)
- If totalchars == 0 Then
- lblWinSysDir.Caption = "Unable to determine System directory."
- Else
- lblWinSysDir.Caption = UCase(Left(buffer, totalchars))
- End If
- End Sub
-
- Sub ResetApplication_Click ()
-
- ' Clear the two labels
- lblWinDir.Caption = ""
- lblWinSysDir.Caption = ""
-
- End Sub
-
- Sub Load()
-
- ' Restore prerequisite objects that are shared with other samples,
- ' and therefore may already be loaded.
- If FindObject("APIWinDir") == Nothing Then
- LoadTextObject(SampleDir & "winapi.eto")
- End If
-
- End Sub
-
- End Type
-
- Type APIWinDir
- Declare Function GetWindowsDirectoryA Lib "kernel32" (ByVal file As String, ByVal size As Long) As Long
-
- End Type
-
- Begin Code
- ' Reconstruction commands for object: APISysDir
- '
- With APISysDir
- End With 'APISysDir
- ' Reconstruction commands for object: APISystemMasterForm
- '
- With APISystemMasterForm
- .Caption := "Windows API Functions Demo"
- .Move(3270, 1185, 5790, 4065)
- .SampleDir := "W:\bootcamp\basic\apisystm\"
- .SampleName := "apisystm"
- With .btnGetInfo
- .Caption := "Get Info"
- .ZOrder := 1
- .Move(1950, 2550, 1650, 450)
- End With 'APISystemMasterForm.btnGetInfo
- With .Label1
- .Caption := "Windows Directory:"
- .ForeColor := 13107200
- .ZOrder := 2
- .Move(450, 450, 1950, 300)
- End With 'APISystemMasterForm.Label1
- With .Label2
- .Caption := "Windows System Directory:"
- .ForeColor := 13107200
- .ZOrder := 3
- .Move(450, 1500, 2850, 300)
- End With 'APISystemMasterForm.Label2
- With .lblWinDir
- .Caption := "C:\WINNT"
- .ZOrder := 4
- .Move(900, 900, 4350, 300)
- End With 'APISystemMasterForm.lblWinDir
- With .lblWinSysDir
- .Caption := "C:\WINNT\SYSTEM32"
- .ZOrder := 5
- .Move(900, 1950, 4350, 300)
- End With 'APISystemMasterForm.lblWinSysDir
- With .helpfile
- .FileName := "W:\bootcamp\basic\apisystm\apisystm.hlp"
- End With 'APISystemMasterForm.helpfile
- End With 'APISystemMasterForm
- ' Reconstruction commands for object: APIWinDir
- '
- With APIWinDir
- End With 'APIWinDir
- End Code
-