home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1998 April B
/
Pcwk4b98.iso
/
Borland
/
Dbase50w
/
SAMPLES1.PAK
/
SYSINFO.WFM
< prev
next >
Wrap
Text File
|
1994-08-02
|
10KB
|
344 lines
**************************************************************************
* PROGRAM: Sysinfo.wfm
*
* WRITTEN BY: Borland Samples Group
*
* DATE: 5/93
*
* UPDATED: 7/94
*
* REVISION: $Revision: 1.43 $
*
* VERSION: dBASE FOR WINDOWS 5.0
*
* DESCRIPTION: This form displays information about your system.
* It uses Windows API functions called externally from
* dBASE for Windows to obtain that information.
*
* PARAMETERS: None
*
* CALLS: Buttons.cc (for custom pushbuttons)
*
* USAGE: do Sysinfo.wfm
* or
* set procedure to Sysinfo.wfm additive
* local f
* f = new SysInfo()
* f.mdi = .f. && modal forms cannot be mdi
* f.ReadModal()
*
*******************************************************************************
create session
set talk off
set ldCheck off
** END HEADER -- do not remove this line*
* Generated on 05/11/94
*
LOCAL f
f = NEW SYSINFOFORM ()
f.Open()
CLASS SYSINFOFORM OF FORM
Set Procedure to Buttons.cc additive
this.OnOpen = CLASS::ONOPEN
this.OnClose = CLASS::ONCLOSE
this.MDI = .F.
this.MousePointer = 1
this.Text = "Windows System Information"
this.Width = 52.79
this.Top = 8.42
this.Left = 26.39
this.Height = 13.13
this.Minimize = .F.
this.Maximize = .F.
this.HelpFile = ""
this.HelpId = ""
DEFINE RECTANGLE RECTANGLE1 OF THIS;
PROPERTY;
ColorNormal "N/W",;
Text "",;
Height 10.07,;
Width 50.15,;
Top 0.54,;
Left 1.32,;
Border .T.
DEFINE TEXT INSTANCESTEXT OF THIS;
PROPERTY;
ColorNormal "N/W",;
Text "Number of Instances:",;
Width 23.75,;
Top 1.06,;
Left 2.64,;
Height 1.32,;
Border .F.,;
Alignment 2
DEFINE TEXT WINVERSIONTEXT OF THIS;
PROPERTY;
MousePointer 1,;
ColorNormal "N/W",;
Text "Windows Version:",;
Width 23.75,;
Top 2.38,;
Left 2.64,;
Height 1.32,;
Border .F.,;
Alignment 2
DEFINE TEXT MODETEXT OF THIS;
PROPERTY;
MousePointer 1,;
ColorNormal "N/W",;
Text "Mode of Operation:",;
Width 23.75,;
Top 3.72,;
Left 2.64,;
Height 1.32,;
Border .F.,;
Alignment 2
DEFINE TEXT CPUTEXT OF THIS;
PROPERTY;
MousePointer 1,;
ColorNormal "N/W",;
Text "CPU Type:",;
Width 23.75,;
Top 5.04,;
Left 2.64,;
Height 1.32,;
Border .F.,;
Alignment 2
DEFINE TEXT COPROCTEXT OF THIS;
PROPERTY;
MousePointer 1,;
ColorNormal "N/W",;
Text "Coprocessor Present:",;
Width 23.75,;
Top 6.36,;
Left 2.64,;
Height 1.32,;
Border .F.,;
Alignment 2
DEFINE TEXT GLOBFREETEXT OF THIS;
PROPERTY;
MousePointer 1,;
ColorNormal "N/W",;
Text "Free Global Memory:",;
Width 23.75,;
Top 7.69,;
Left 2.64,;
Height 1.32,;
Border .F.,;
Alignment 2
DEFINE TEXT DOSVERSTEXT OF THIS;
PROPERTY;
MousePointer 1,;
ColorNormal "N/W",;
Text "DOS Version:",;
Width 23.75,;
Top 9.01,;
Left 2.64,;
Height 1.32,;
Border .F.,;
Alignment 2
DEFINE ENTRYFIELD INSTANCESENTRY OF THIS;
PROPERTY;
Enabled .F.,;
ColorNormal "B/W",;
Width 19.80,;
Top 1.06,;
Left 27.71,;
Height 1.32,;
ColorHighLight "",;
Value " ",;
Border .F.
DEFINE ENTRYFIELD WINVERSIONENTRY OF THIS;
PROPERTY;
Enabled .F.,;
ColorNormal "B/W",;
Width 19.80,;
Top 2.38,;
Left 27.71,;
Height 1.32,;
ColorHighLight "",;
Value " ",;
Border .F.
DEFINE ENTRYFIELD MODEENTRY OF THIS;
PROPERTY;
Enabled .F.,;
ColorNormal "B/W",;
Width 23.10,;
Top 3.72,;
Left 27.71,;
Height 1.32,;
ColorHighLight "",;
Value " ",;
Border .F.
DEFINE ENTRYFIELD CPUENTRY OF THIS;
PROPERTY;
Enabled .F.,;
ColorNormal "B/W",;
Width 19.80,;
Top 5.04,;
Left 27.71,;
Height 1.32,;
ColorHighLight "",;
Value " ",;
Border .F.
DEFINE ENTRYFIELD COPROCENTRY OF THIS;
PROPERTY;
Enabled .F.,;
ColorNormal "B/W",;
Width 19.80,;
Top 6.36,;
Left 27.71,;
Height 1.32,;
ColorHighLight "",;
Value " ",;
Border .F.
DEFINE ENTRYFIELD GLOBFREEENTRY OF THIS;
PROPERTY;
Enabled .F.,;
ColorNormal "B/W",;
Width 19.80,;
Top 7.69,;
Left 27.71,;
Height 1.32,;
ColorHighLight "",;
Value " ",;
Border .F.
DEFINE ENTRYFIELD DOSVERSENTRY OF THIS;
PROPERTY;
Enabled .F.,;
ColorNormal "B/W",;
Width 19.80,;
Top 9.01,;
Left 27.71,;
Height 1.32,;
ColorHighLight "",;
Value " ",;
Border .F.
DEFINE CLOSEBUTTON CLOSEBUTTON1 OF THIS;
PROPERTY;
Width 14.11,;
Top 11.14,;
Left 19.14,;
Height 1.50
********************************************************************************
procedure OnOpen
* Called by Sysinfo(). This function makes the necessary API calls, and assigns
* the accessed information to variables that will be displayed in the form
* showing system information.
*
********************************************************************************
#include "winapi.h"
*extern CLONG GetFreeSpace ( CINT ) KRNL386.EXE
set procedure to Sampproc.prg additive && for Format functions
local mHandle,mInstance,mFlags,mCpu,mFreeMem,wFreeMem,mCoprocess
mHandle = GetModuleHandle(ansi("DBASEWIN.EXE")) && "SYSINFO"
ShowWindow(mHandle,7) && 7 make icon not active
mInstance = GetModuleUsage(mHandle)
mFlags = GetWinFlags()
do case && Check which mode Windows is running in
case mFlags = BitOr(mFlags,2)
mMode = "Running Win286"
case mFlags = BitOr(mFlags,16)
mMode = "Standard Mode"
case mFlags = BitOr(mFlags,32)
mMode = "Enhanced Mode"
endcase
do case && Check processor type
case mFlags = BitOr(mFlags,8)
mCpu = "80486"
case mFlags = BitOr(mFlags,4)
mCpu = "80386"
case mFlags = BitOr(mFlags,2)
mCpu = "80286"
case mFlags = BitOr(mFlags,128)
mCpu = "80186"
case mFlags = BitOr(mFlags,64)
mCpu = "8086"
endcase
mCoprocess = IIF(mFlags = BitOr(mFlags,1024), "Yes", "No ")
mFreeMem = FormatStr("%1 K", ltrim(str(memo())))
wFreeMem = FormatStr("%1 K", ltrim(str(GetFreeSpace(0)/1024)))
form.instancesEntry.value = ltrim(str(mInstance))
form.winVersionEntry.value = gVer("WIN")
form.modeEntry.value = mMode
form.cpuEntry.value = mCpu
form.coprocEntry.value = mCoprocess
form.globFreeEntry.value = wFreeMem
form.dosVersEntry.value = gVer("DOS")
form.visible = .T. && Workaround -- so you don't see all controls painting
&& while they are defined
********************************************************************************
procedure OnClose
********************************************************************************
close procedure Buttons.cc
ENDCLASS
********************************************************************************
procedure GVer (verType)
*
* Gets information from the Windows function
* GetVersion(), which returns the major and minor
* DOS and Windows versions as a CLONG.
*
*
* The "High Byte of the High Word" contains the
* major DOS version, the "Low Byte of the High Word"
* contains the minor DOS version. The "High Byte of
* the Low Word" specifies the minor version of
* Windows and the "Low byte of the Low Word"
* specifies the major Windows version. The Bit
* functions are used to extract the proper values.
* BitRshift(), BitAnd().
*
********************************************************************************
#define HIWORD(x) (bitand(bitrshift(x,16),2^16-1))
#define LOWORD(x) (bitand(x,2^16-1))
#define HIBYTE(x) (bitand(bitrshift(x,8),2^8-1))
#define LOBYTE(x) (bitand(x,2^8-1))
#define STRHIBYTE(x) ltrim(str(HIBYTE(x)))
#define STRLOBYTE(x) ltrim(str(LOBYTE(x)))
* EXTERN CLONG GetVersion(CVOID) krnl386.exe
local version,retVal
version = GetVersion( )
if upper(verType) = "DOS"
retVal = FormatStr("%1.%2",;
STRHIBYTE(HIWORD(version)), STRLOBYTE(HIWORD(version)))
elseif left(upper(verType),3) = "WIN"
retVal = FormatStr("%1.%2",;
STRLOBYTE(LOWORD(version)), STRHIBYTE(LOWORD(version)))
endif
return retVal