FUNCky & System Information from within dBASE
by John Staub, President, Staub & Associates, Inc.

The author would like to thank John Fried, Steve Hawkins and Jean-Pierre Martel for their proofreading and assistance in preparing this article.

Why FUNCky?

FUNCKy is a library of useful program functions and utilities that can be incorporated into your dBASE applications. It has so many diverse routines that can be easily included in a dBL app that we consider it a necessary part of our developer toolset.  For our System Information form we could have used various API calls to collect most of the information we needed. However, since FUNCky is such an integral part of our development toolset we took the “lazy” route and let it do the work for us. This article focuses on providing your users with a form which collects and displays System Information using FUNCky and dBASE.

What is required?

Of course, you'll need a registered copy of FUNCky, available on the Web. If you are using any of the FUNCky routines in a client's application, you will need to install FUNCky.dll and FUNCky.TLB on their computers and/or server(s), and register FUNCky.dll on each machine. These install and registration processes can be included in your installation program, and are especially easy using Inno or similar packages that allow you to run automated processes during the install.

Why System Information?

One of our clients has a very diverse LAN and Terminal Services operating environment. Occasionally when trouble-shooting a particular problem, we need to gather some specific information from the client's workstation. The easiest method for us was to create a “System Information” form that the user could use to gather the specifics we look for.

The System Information Form

The form is a simple dBL form using stock TextLabel objects.  We've included the form in the download file, but it looks like this:

infodesigner.jpg (45909 bytes)

When the form opens, we use FUNCky calls to gather the information we need in the following manner:
 
 
set procedure to funcky.cc additive
local Funcky,cpu,cpustr,cpuspeed,memtotal,memstr,memavail,memavailstr, ;
Windir,netdrives,drv,thedrives,login,str,Count
Funcky = New Funcky()
/// first get the CPU information
Cpu = FUNCky.CpuType()
cpuspeed = Funcky.cpuspeed()
cpuStr = "Your CPU is a " + FUNCky.Coerce(Cpu) + " processor"
form.textlabel1.text = cpustr
form.textlabel2.text = "Your CPU speed is "+cpuspeed + "MGZ"
/// now get the memory information
memTotal = FUNCky.ExtMem(0)
memStr = "You have"+ trim(Str(memTotal)) + " bytes total extended memory"
memAvail = FUNCky.ExtMem(1)
memavailStr = "You have"+ trim(Str(memAvail)) + " extended memory available"
form.textlabel3.text = memstr
form.textlabel4.text = memavailstr
/// now get the Windows System Folder information
WinDir = FUNCky.WinDir()
form.textlabel5.text = "Your Windows System Directory is "+WinDir
/// now get the local and networked drives
NetDrives = ""
Str = FUNCky.AllDrives()
Count = FUNCky.NumToken( Str, " ")
For i = 1 to Count
   Drive = FUNCky.Token( Str, " ", i)
   if( FUNCky.IsRemote( Drive ))
      NetDrives = NetDrives + Drive
   endif
Next
form.textlabel6.text = "The following drives are avaialble " + Str 
/// now get the login user information
login = ID()
form.textlabel7.text = "You are logged in as "+login
/// now get the computer's name
FUNCky = CreateObject("FUNCky") 
str := "Your computer name is: " + FUNCky.ComputerName()
form.textlabel8.text = str
// Query the default local IP address
Str := FUNCky.IpAddress(1)
form.textlabel9.text = "Your computers IP address is: " + Str
/// now show the Okay Button
form.pushbutton1.visible = true
return
   

Depending on the speed of your computer, the speed of your LAN, the number of drives, etc., you may experience slight delays in displaying the information. As the process unfolds, each of the TextLabel object's text.value changes and displays the information gathered for that specific object.  Addtionally, we reuse the Str value several times during the processing.

The end result looks something like this:

infodisplay.jpg (26986 bytes)

There are a number of other available methods such as O/S tests, servers in the domain, etc., that you may also tap into.

Get FUNCky?

FUNCky provides a wide variety of tools for the dBASE user.  The help file is complete and includes well-documented examples for a variety of programming languages.  Much of the above code was “derived” (okay, "borrowed") directly from the FUNCky examples. Technical support is excellent and available from their web site at http://www.FUNCky.com. There is a new FUNCky demo for dBASE available at (watch for word wrap)
http://www.funcky.com/downloadfile.asp?Filename=FUNCkyVDB.Exe&Section=Demos&Version=VDB

We use FUNCky for a variety of purposes and have found it very easy to integrate into a dBL app.  Perhaps it's time for you to get FUNCky.

To download the sample application, click here
(it's a 2Kb zipped file)


For more information on  Staub & Associates, Inc., please visit  http://www.staubassociates.com
For information on hosting your dBASE web applications or other web sites, please contact us at: wrightd_dBulletin_@dcs-fl.com (take out “_dBulletin_”).
This article is Copyright © — 2001, Staub & Associates, Inc — All Rights Reserved.