home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Eagles Nest BBS 6
/
Eagles_Nest_Mac_Collection_Disc_6.TOAST
/
Windows
/
VisBasAPIex
/
VBAPIGUIDE.image
/
SYSINFO.FRM
< prev
next >
Wrap
Text File
|
1992-12-01
|
11KB
|
344 lines
VERSION 2.00
Begin Form SysInfo
Caption = "System Information Viewer"
Height = 4560
Left = 1035
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 3870
ScaleWidth = 7365
Top = 1140
Width = 7485
Begin Timer Timer1
Interval = 250
Left = 6120
Top = 120
End
Begin ListBox ListColor
Height = 2565
Left = 240
TabIndex = 2
Top = 600
Visible = 0 'False
Width = 3015
End
Begin TextBox KeyCheck
Height = 615
Left = 5880
MultiLine = -1 'True
TabIndex = 0
Text = "Press Key to get info"
Top = 720
Width = 1455
End
Begin TextBox Text1
Height = 1095
Left = 5880
MultiLine = -1 'True
TabIndex = 1
Text = "Caret change is shown here Set focus to this control for example"
Top = 1440
Width = 1335
End
Begin Label LabelColor
Alignment = 2 'Center
Caption = "Color"
Height = 255
Left = 240
TabIndex = 3
Top = 120
Visible = 0 'False
Width = 3015
End
Begin Label LabelKeyState
BorderStyle = 1 'Fixed Single
Height = 255
Left = 4800
TabIndex = 4
Top = 3480
Width = 2415
End
Begin Menu MenuGeneral
Caption = "General"
Begin Menu MenuFreeSpace
Caption = "Free&Space"
End
Begin Menu MenuTimes
Caption = "&Times"
End
Begin Menu MenuFlags
Caption = "&Flags"
End
End
Begin Menu MenuSystem
Caption = "System"
Begin Menu MenuColors
Caption = "Colors"
End
Begin Menu MenuMetrics
Caption = "&Metrics"
End
Begin Menu MenuParameters
Caption = "&Parameters"
End
End
End
Sub Form_Load ()
ListColor.AddItem "COLOR_ACTIVEBORDER"
ListColor.AddItem "COLOR_ACTIVECAPTION"
ListColor.AddItem "COLOR_APPWORKSPACE"
ListColor.AddItem "COLOR_BACKGROUND"
ListColor.AddItem "COLOR_BTNFACE"
ListColor.AddItem "COLOR_BTNHIGHLIGHT"
ListColor.AddItem "COLOR_BTNSHADOW"
ListColor.AddItem "COLOR_BTNTEXT"
ListColor.AddItem "COLOR_CAPTIONTEXT"
ListColor.AddItem "COLOR_GRAYTEXT"
ListColor.AddItem "COLOR_HIGHLIGHT"
ListColor.AddItem "COLOR_HIGHLIGHTTEXT"
ListColor.AddItem "COLOR_INACTIVEBORDER"
ListColor.AddItem "COLOR_INACTIVECAPTION"
ListColor.AddItem "COLOR_INACTIVECAPTIONTEXT"
ListColor.AddItem "COLOR_MENU"
ListColor.AddItem "COLOR_MENUTEXT"
ListColor.AddItem "COLOR_SCROLLBAR"
ListColor.AddItem "COLOR_WINDOW"
ListColor.AddItem "COLOR_WINDOWFRAME"
ListColor.AddItem "COLOR_WINDOWTEXT"
End Sub
' Display in the edit control the name of the key
'
Sub KeyCheck_KeyDown (KeyCode As Integer, Shift As Integer)
Dim scancode&
Dim keyname As String * 256
' Get the scancode
scancode& = MapVirtualKey%(KeyCode, 0)
' Shift the scancode to the high word and get the
' key name
dummy% = GetKeyNameText(scancode& * &H10000, keyname, 255)
KeyCheck.Text = keyname
End Sub
Sub KeyCheck_KeyPress (KeyAscii As Integer)
KeyAscii = 0 ' Ignore keys in this control
End Sub
Sub KeyCheck_LostFocus ()
KeyCheck.Text = "Press key to get info"
End Sub
Sub ListColor_Click ()
Dim colindex%
Select Case ListColor.ListIndex
Case 0
colindex% = COLOR_ACTIVEBORDER
Case 1
colindex% = COLOR_ACTIVECAPTION
Case 2
colindex% = COLOR_APPWORKSPACE
Case 3
colindex% = COLOR_BACKGROUND
Case 4
colindex% = COLOR_BTNFACE
Case 5
colindex% = COLOR_BTNHIGHLIGHT
Case 6
colindex% = COLOR_BTNSHADOW
Case 7
colindex% = COLOR_BTNTEXT
Case 8
colindex% = COLOR_CAPTIONTEXT
Case 9
colindex% = COLOR_GRAYTEXT
Case 10
colindex% = COLOR_HIGHLIGHT
Case 11
colindex% = COLOR_HIGHLIGHTTEXT
Case 12
colindex% = COLOR_INACTIVEBORDER
Case 13
colindex% = COLOR_INACTIVECAPTION
Case 14
colindex% = COLOR_INACTIVECAPTIONTEXT
Case 15
colindex% = COLOR_MENU
Case 16
colindex% = COLOR_MENUTEXT
Case 17
colindex% = COLOR_SCROLLBAR
Case 18
colindex% = COLOR_WINDOW
Case 19
colindex% = COLOR_WINDOWFRAME
Case 20
colindex% = COLOR_WINDOWTEXT
End Select
LabelColor.BackColor = GetSysColor&(colindex%) And &HFFFFFF
End Sub
Sub MenuColors_Click ()
SysInfo.Cls
ShowColors -1
End Sub
Sub MenuFlags_Click ()
Dim flagnum&
Dim vernum&, verword%
ShowColors 0
SysInfo.Cls
Print
' Get the windows flags and version numbers
flagnum& = GetWinFlags&()
vernum& = GetVersion&()
verword% = CInt(vernum& / &H10000)
Print "Running MS-DOS version "; verword% / 256; "."; verword% And &HFF
verword% = CInt(vernum& And &HFFFF&)
Print "Running Windows version "; verword% And &HFF; "."; CInt(verword% / 256)
If flagnum& And WF_80x87 Then Print "80x87 coprocessor present"
If flagnum& And WF_CPU086 Then Print "8086 present"
If flagnum& And WF_CPU186 Then Print "80186 present"
If flagnum& And WF_CPU286 Then Print "80286 present"
If flagnum& And WF_CPU386 Then Print "80386 present"
If flagnum& And WF_CPU486 Then Print "80486 present"
If flagnum& And WF_ENHANCED Then Print "Windows 386-enhanced mode"
If flagnum& And WF_PAGING Then Print "Memory paging active"
If flagnum& And WF_PMODE Then Print "Protected mode operation"
If flagnum& And WF_WLO Then Print "Windows emulation in non-Windows system"
End Sub
Sub MenuFreeSpace_Click ()
ShowColors 0
SysInfo.Cls
Print
Print GetFreeSpace&(0); "Bytes free in Global Heap"
Print GetFreeSystemResources%(GFSR_SYSTEMRESOURCES); "% free system resources."
Print GetFreeSystemResources%(GFSR_GDIRESOURCES); "% free GDI resources."
Print GetFreeSystemResources%(GFSR_USERRESOURCES); "% free USER resources."
End Sub
' The following is a selection of the system metrics
' that can be determined - see the reference section
' under the GetSystemMetrics function for more.
'
Sub MenuMetrics_Click ()
ShowColors 0
SysInfo.Cls
Print
Print "Non sizeable border width,height = "; GetSystemMetrics%(SM_CXBORDER); ","; GetSystemMetrics%(SM_CYBORDER)
Print "Caption height = "; GetSystemMetrics%(SM_CYCAPTION)
Print "Cursor width,height = "; GetSystemMetrics%(SM_CXCURSOR); ","; GetSystemMetrics%(SM_CYCURSOR)
Print "Icon width,height = "; GetSystemMetrics%(SM_CXICON); ","; GetSystemMetrics%(SM_CYICON)
Print "Width,Height of client area of full screen window = "; GetSystemMetrics%(SM_CXFULLSCREEN); ","; GetSystemMetrics(SM_CYFULLSCREEN)
Print "Menu bar height = "; GetSystemMetrics%(SM_CYMENU)
Print "Minimum width,height of window = "; GetSystemMetrics(SM_CXMIN); ","; GetSystemMetrics(SM_CYMIN)
End Sub
' A few examples of the many system parameters that can
' be set and retreived using the SystemParametersInfo
' function
'
Sub MenuParameters_Click ()
Dim intval%
ShowColors 0
SysInfo.Cls
Print
dummy% = SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, intval%, 0)
Print "Keyboard Delay is "; intval%
dummy% = SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, intval%, 0)
Print "Keyboard Speed is "; intval%
dummy% = SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, intval%, 0)
Print "Screen Save Active = "; intval%
dummy% = SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, intval%, 0)
Print "Screen Save Delay is "; intval%; " seconds"
End Sub
Sub MenuTimes_Click ()
ShowColors 0
SysInfo.Cls
Print
Print "Caret blinks every "; GetCaretBlinkTime%(); " ms"
Print "It's been "; GetCurrentTime&(); " ms since Windows was started"
Print "The last Windows message was processed at "; GetMessageTime&(); " ms"
Print "Two clicks within "; GetDoubleClickTime%(); " ms of each other are a double click"
Print "Timer resolution is "; GetTimerResolution&(); "microseconds per tick"
End Sub
' Use to show or hide the colors listbox and label
'
Sub ShowColors (bflag%)
If bflag% Then ' Show them
ListColor.Visible = -1
LabelColor.Visible = -1
Else ' Hide them
ListColor.Visible = 0
LabelColor.Visible = 0
End If
End Sub
' This shows how a custom caret can be used in a text
' box. Note that an arbitrary bitmap could be used as
' well (refer to the function reference for the
' CreateCaret function - also chapter 8 for information
' on bitmaps).
' Also note that VB may change the caret back to the
' default without notice (like when a menu or other
' application is selected)
'
Sub Text1_GotFocus ()
' Save the original blink time - it will be used to
' restore the original value during the LostFocus event
OriginalCaretBlinkTime% = GetCaretBlinkTime%()
' Creat a different shaped caret
CreateCaret agGetControlHwnd%(Text1), 0, 10, 15
' Creating the new caret caused the prior one (the
' default for the edit control) to be destroyed and
' thus hidden. So we must show the new caret.
ShowCaret agGetControlHwnd%(Text1)
' And change to an obnoxiously fast blink time - just
' to show how it's done.
SetCaretBlinkTime 150
End Sub
' Be sure to set the caret blink time back to its
' original value when the control loses the focus
'
Sub Text1_LostFocus ()
SetCaretBlinkTime OriginalCaretBlinkTime%
End Sub
' Update a label field to show the current state
' of the capslock, numlock and scroll lock keys
'
Sub Timer1_Timer ()
Dim numlock%, scrolllock%, capslock%
Dim res$
capslock% = GetKeyState%(VK_CAPITAL)
numlock% = GetKeyState%(VK_NUMLOCK)
scrolllock% = GetKeyState%(VK_SCROLL)
' The low bit indicates the state of the toggle
If capslock% And 1 Then res$ = res$ + "CAPS "
If numlock% And 1 Then res$ = res$ + "NUM "
If scrolllock% And 1 Then res$ = res$ + "SCROLL"
LabelKeyState.Caption = res$
End Sub