//************************************************************************ // Confidential Trade Secret. // Copyright (c) 1997 Data Access Corporation, Miami Florida // as an unpublished work. All rights reserved. // DataFlex is a registered trademark of Data Access Corporation. // //************************************************************************ //************************************************************************ // // $File name : DfAbout.pkg // $File title : About class support // Notice : // $Author(s) : Vincent Oorsprong, Ken Ross // // $Rev History // // JJT 11/5/98 Added version information // VOO 29/10/98 Replaced the GetFreeSystemResources for the Win32 variant // JJT 7/31/97 Registered Enumerate Workspace so dfabout can exist without // workspace package. // JJT 6/27/97 Turned the sysinfo objects into classes so the AboutDialog // class can create this object. // Cleaned up the interface (used correct classes and messages) // Added workspace reporting support to sys-info. // Turned off wrapping in the sys-info editor. // KR ??/??/96 File created //************************************************************************ Use LanguageText.pkg Use windows.pkg Use DFbitmap.pkg Use GlobalFunctionsProcedures.pkg Use ShellExecute.pkg Use GlobalMemoryStatus.pkg #IFNDEF Get_WNetGetUser External_Function32 WNetGetUser "WNetGetUserA" MPR.DLL ; Pointer lpName Pointer lpUser_Name Pointer lpLength Returns DWord #ENDIF //#IFNDEF ghoApplication // Global_Variable Integer ghoApplication // Move 0 To ghoApplication //#ENDIF Register_Function phoWorkspace Returns Handle Register_Function psHelpFile Returns String Register_Function pbEnterKeyAsTabKey Returns Boolean //**************************************************************************** // $Module type: FUNCTION // $Module name: Network_User_Name // $Author : AK/VOO/KCR // Created : 24-09-96 @ 19:17 // // Description // This function reads the current username of windows and returns that // name or an text unknown user // // $Rev History // 24-09-96 Module header created //**************************************************************************** Function Network_User_Name Returns String String sName sLength Pointer lpName_Addr lpLength_Addr Integer iRetval Movestr (Repeat (Character (0), 255)) To sName GetAddress Of sName To lpName_Addr Movestr (DwordToBytes (255)) To sLength GetAddress Of sLength To lpLength_Addr Moveint (WNetGetUser (0, lpName_Addr, lpLength_Addr)) To iRetval If iRetval Eq 0 Function_Return (CString (sName)) Else Function_Return "User Unknown" End_Function // Network_User_Name Class OLDSysinfoDisplay Is An Edit Procedure Construct_Object Forward Send construct_object Set Location To 6 6 Set Size To 110 255 Set Read_Only_State To True Set wrap_state To False End_Procedure //**************************************************************************** // $Module type: PROCEDURE // $Module name: Add_Line // $Author : VOO // Created : 06-10-96 @ 15:23 // // Description // This method will add a line to this edit object, it should go simpler // but it seems to be done this way. // // $Rev History // 06-10-96 Module header created //**************************************************************************** Procedure Add_Line String sVal Integer iLine Moveint (Line_Count(Self)) To iLine If (iLine = 1 And Changed_State(Self) = False) Moveint 0 To iLine Set Value Item iLine To sVal End_Procedure // Add_Line //**************************************************************************** // $Module type: PROCEDURE // $Module name: Show_Current_Directory // $Author : VOO // Created : 06-10-96 @ 15:24 // // Description // This method will show the name of the current directory in the system // information box // // $Rev History // 06-10-96 Module header created //**************************************************************************** Procedure Show_Current_Directory String sDir Get_Current_Directory To sDir Send Add_Line (SFormat(C_$CurrentDirectory, sDir)) End_Procedure // Show_Current_Directory //**************************************************************************** // $Module type: PROCEDURE // $Module name: Show_Windows_Directory // $Author : VOO // Created : 06-10-96 @ 15:24 // // Description // This method will show the name of the current directory in the system // information box // // $Rev History // 06-10-96 Module header created //**************************************************************************** Procedure Show_Windows_Directory String sWindir Get_Windows_Directory To sWindir Send Add_Line (SFormat(C_$WindowsDirectory, sWindir)) End_Procedure // Show_Windows_Directory Procedure Show_Current_User Send Add_Line (SFormat(C_$NetworkUserName, Network_User_Name(Self))) End_Procedure // Show_Current_User Procedure Show_Number_Format Integer iFormat Get_Attribute Df_Thousands_Separator To iFormat Send Add_Line (SFormat(C_$ThousandsSeparator, Character(iFormat), iFormat)) Get_Number_Format To iFormat Send Add_Line (SFormat(C_$DecimalSeparator, If (iFormat = 0, ".", ","))) End_Procedure // Show_Number_Format Procedure Show_Filelist_Name String sFilename Get_Attribute Df_Filelist_Name To sFilename Send Add_Line (SFormat(C_$CurrentFilelist, sFilename)) End_Procedure // Show_Filelist_Name Procedure Show_Lock_Delay Integer iLockdelay Get_Attribute Df_Lock_Delay To iLockdelay Send Add_Line (SFormat(C_$DatabaseLockingDelay, iLockDelay)) End_Procedure // Show_Lock_Delay Procedure Show_Lock_Timeout Integer iLockTimeout Get_Attribute Df_Lock_Timeout To iLockTimeout Send Add_Line (SFormat(C_$DatabaseLockingTimeout, iLockTimeOut)) End_Procedure // Show_Lock_Timeout Procedure Show_Screen_Size Integer iYscreensize iXscreensize Moveint (GetSystemMetrics (SM_CXSCREEN)) To iXscreensize Moveint (GetSystemMetrics (SM_CYSCREEN)) To iYscreensize Send Add_Line (SFormat(C_$VideoResolution, iXscreensize, iYscreensize)) End_Procedure // Show_Screen_Size Procedure Show_Page_Size Send Add_Line (SFormat(C_$PageEndFormFeed, Pageend, Pagefeed)) End_Procedure Procedure Show_Date Date dToday Sysdate4 dToday Send Add_Line (SFormat(C_$CurrentSystemDate, String(dToday))) End_Procedure // Show_Date Procedure Show_Date_Format Integer iDateFormat String sDateFormat Get_Attribute Df_Date_Format To iDateFormat If iDateFormat Eq DF_DATE_USA ; Movestr C_$USA To sDateFormat Else If iDateformat Eq DF_DATE_EUROPEAN ; Movestr C_$European To sDateFormat Else If iDateformat Eq DF_DATE_MILITARY ; Movestr C_$Military To sDateFormat Else ; Movestr C_$UnknownDateType To sDateFormat Send Add_Line (SFormat(C_$DateFormat, sDateformat)) End_Procedure // Show_Date_Format Procedure Show_Memavail Integer iMem Memory iMem Send Add_Line (SFormat(C_$AvailableMemory, iMem) * "Kb") End_Procedure // Show_Memavail Procedure Show_Systemresources String sMemoryStatus Pointer lpsMemoryStatus Integer iVoid DWord dwMemoryLoad dwTotalPhys dwAvailPhys dwTotalPageFile dwAvailPageFile dwTotalVirtual dwAvailVirtual ZeroType RdsMEMORYSTATUS To sMemoryStatus GetAddress Of sMemoryStatus To lpsMemoryStatus Moveint (GlobalMemoryStatus(lpsMemoryStatus)) To iVoid GetBuff From sMemoryStatus At RdsMEMORYSTATUS.dwMemoryLoad To dwMemoryLoad GetBuff From sMemoryStatus At RdsMEMORYSTATUS.dwTotalPhys To dwTotalPhys GetBuff From sMemoryStatus At RdsMEMORYSTATUS.dwAvailPhys To dwAvailPhys GetBuff From sMemoryStatus At RdsMEMORYSTATUS.dwTotalPageFile To dwTotalPageFile GetBuff From sMemoryStatus At RdsMEMORYSTATUS.dwAvailPageFile To dwAvailPageFile GetBuff From sMemoryStatus At RdsMEMORYSTATUS.dwTotalVirtual To dwTotalVirtual GetBuff From sMemoryStatus At RdsMEMORYSTATUS.dwAvailVirtual To dwAvailVirtual Send Add_Line (SFormat(C_$MemoryUtilization, dwMemoryLoad) + " %") Send Add_Line ("Available Physical Memory" * String(Round(dwAvailPhys / dwTotalPhys * 100.0)) + String(" %")) Send Add_Line ("Available Pagefile Space" * String(Round(dwAvailPageFile / dwTotalPageFile * 100.0)) + String(" %")) Send Add_Line ("Available Virtual Memory" * String(Round(dwAvailVirtual / dwTotalVirtual * 100.0)) + String(" %")) End_Procedure // Show_Systemresources Procedure Show_Registration String sRegName Integer iSN Registration sRegName iSN Send Add_Line (SFormat(C_$Serial, iSN)) Send Add_Line (SFormat(C_$RegName, sRegName)) End_Procedure // Show_Current_Directory //**************************************************************************** // If workspaces are used, we will send the message EnumerateWorkspaceData // to the workspace object passing the an object and message to send back // to this object. It is expected that the workspace object will send this // message for every line of information it wants displayed (passing the // information to be displayed //**************************************************************************** Register_Procedure EnumerateWorkspaceData Integer hObjId Integer hmMessId Procedure Show_ServicePack String sVersion Get_Profile_String "" "CurrentVersionDescription" To sVersion If (sVersion <> "") Begin Send Add_Line sVersion Send Add_Line "" End End_Procedure Procedure Show_WorkspaceInformation If ghoApplication ; Send EnumerateWorkspaceData Of (phoWorkspace(ghoApplication)) Self Msg_add_Line // removed for VDF8 //Else If ghoWorkspace ; // Send EnumerateWorkspaceData of ghoWorkspace self Msg_add_Line End_Procedure Function VersionStr Integer iVer Integer iRev Integer iBld Returns String Function_Return (String(iVer)-"."-String(iRev)-"."-String(iBld)) End_Function Procedure Show_Versions Integer iVersion iRevision iBuild Version_information iVersion iRevision iBuild Send Add_Line (SFormat(C_$RuntimeVersion, VersionStr(Self,iVersion,iRevision,iBuild) )) Send Add_Line (SFormat(C_$PackageVersion, VersionStr(Self,PKG_VERSION, PKG_REVISION, PKG_BUILD) )) Send Add_Line (SFormat(C_$FMACVersion, VersionStr(Self,FMAC_VERSION, FMAC_REVISION, FMAC_BUILD) )) End_Procedure //*** //*** BW //*** Procedure: Show_Drivers //*** Purpose : Show loaed database drivers //*** Procedure Show_Drivers String Current_drvr String Loadeddrvrs Integer Number_of_drvrs Integer Count Move "" To Loadeddrvrs Get_Attribute DF_NUMBER_DRIVERS To Number_of_drvrs For Count From 1 To Number_of_drvrs Get_Attribute DF_DRIVER_NAME Of Count To Current_drvr If (Loadeddrvrs <> "") ; Move (Append(Loadeddrvrs, ", ")) To Loadeddrvrs Move (Append(Loadeddrvrs, Current_drvr)) To Loadeddrvrs Loop Send Add_Line (SFormat(C_$DatabaseDriver, Loadeddrvrs)) End_Procedure // Show_Drivers Procedure Show_HelpFile Send Add_Line "" Send Add_Line (SFormat(C_$HelpFile, psHelpFile(ghoApplication))) End_Procedure Procedure Show_EnterAsTab Send Add_Line (SFormat(C_$EnterKeyNavForward, If(pbEnterKeyAsTabKey(ghoApplication),"True","False"))) End_Procedure //**************************************************************************** // $Module type: PROCEDURE // $Module name: Add_Focus // $Author : VOO // Created : 24-09-96 @ 19:43 // // Description // During activation we will remove the old information and add the newly // found systeminformation // // $Rev History // 24-09-96 Module header created //**************************************************************************** Procedure Add_Focus Integer hoRoot Forward Send Add_Focus hoRoot Send Delete_Data Set Changed_State To False Set Read_Only_State To True Send Show_WorkSpaceInformation // added to show WS info If ghoApplication Begin Send Show_HelpFile Send Show_EnterAsTab End Send Show_Drivers Send Show_Current_User Send Show_Windows_Directory Send Show_Current_Directory Send Show_Filelist_Name Send Show_Versions Send Show_Memavail Send Show_Screen_Size Send Show_Page_Size Send Show_Number_Format Send Show_Date_Format Send Show_Lock_Delay Send Show_Lock_Timeout Send Show_Date Send Show_Systemresources // Send Show_Registration // Don't display this for RDS. End_Procedure // Show_All_Info End_Class // SysinfoDisplay //**************************************************************************** // $Module type: OBJECT // $Module name: Sysinfo_Dialog // $Author : VOO // Created : 24-09-96 @ 18:47 // // Description // This object shows the systeminformation on the screen // // $Rev History // 24-09-96 Module header created //**************************************************************************** Class OLDSysInfoDialog Is A ModalPanel Procedure Construct_Object Forward Send construct_object Set Caption_Bar To True Set Sysmenu_Icon To True Set Label To C_$SystemInformation Set Size To 152 270 Set Locate_Mode To CENTER_ON_SCREEN Set Minimize_Icon To False Set Maximize_Icon To False Set Border_Style To Border_Thick Object Sysinfo_Display Is A OLDSysInfoDialog End_Object Object Close_Button Is A Button Set Label To C_$Close Set Location To 120 212 Set Message Item 0 To msg_Close_Panel Set default_action_button To Self End_Object // Close_Button On_Key Kcancel Send Close_Panel On_Key Key_Alt+Key_C Send Close_Panel End_Procedure //**************************************************************************** // $Module type: PROCEDURE // $Module name: OnResize // $Author : VO // Created : 05/16/00 @ 3:40 // // Description // When the dialog is resized relocate the edit object and button // // $Rev History // 05/16/00 VO Module header created //**************************************************************************** Procedure OnResize Integer iPanelGuiSize Get GuiSize To iPanelGuiSize Set GuiSize Of Sysinfo_Display To (Hi (iPanelGuiSize) - 70) (Low (iPanelGuiSize) - 25) Set GuiLocation Of Close_Button To (Hi (iPanelGuiSize) - 50) (Low (iPanelGuiSize) - 90) Send Adjust_Logicals End_Procedure // OnResize End_Class // SysinfoDialog // Purpose: // // Ken Ross 12/17/96 5:16PM // Class OLDAboutDialog Is A ModalPanel Procedure construct_object Forward Send Construct_Object Property String psWebSite '' Set Label To C_$About Set Size To 110 247 Set Border_Style To Border_Thick //Set peAnchors To anNone Set piMaxSize To 0 0 Set piMinSize To 110 247 Set Locate_Mode To CENTER_ON_SCREEN Object SysInfo_Dialog Is A OLDSysInfoDialog End_Object Object oBox Is A Container3d Set Border_Style To Border_StaticEdge Set Size To 74 232 Set Location To 4 5 Set peAnchors To anAll Object oAboutGraphic Is A BitmapContainer Set Border_Style To Border_None Set Bitmap_Style To Bitmap_Center Set Size To 48 48 Set Location To 0 2 Set peAnchors To AnAll End_Object // oAboutGraphic Object oAboutEdit Is An Edit Set Location To 0 53 Set Size To 72 177 Set Border_Style To Border_None Set Color To clBtnFace Set Read_Only_State To True Set peAnchors To anAll End_Object // oAboutEdit End_Object // oBox Object oOK_bn Is A Button On_Item "&OK" Send Close_Panel Set Size To 14 50 Set Location To 81 187 Set peAnchors To anBottomRight End_Object // oOK_bn Object oSysInfo_bn Is A Button On_Item "&System Info" Send Show_Sysinfo Set Size To 14 50 Set Location To 81 111 Set peAnchors To anBottomLeft End_Object // oSysInfo_bn Object oWebSite_bn Is A Button On_Item "&Web Site" Send Open_Web_Site Set Size To 14 50 Set Location To 81 57 Set Enabled_State To False Set peAnchors To anBottomLeft End_Object // oWebSite_bn On_Key kCancel Send KeyAction To oOk_bn On_Key Key_Alt+Key_O Send KeyAction To oOk_bn On_Key Key_Alt+Key_S Send KeyAction To oSysInfo_bn On_Key Key_Alt+Key_W Send KeyAction To oWebSite_bn // Set Bitmap Of (oAboutGraphic(oBox(Self))) To "DacAbout.bmp" // square bitmaps of 42x42 work best Set Logo To "DacAbout.bmp" // square bitmaps of 42x42 work best End_Procedure Procedure Set Productname String sVal Set value Of oAboutEdit Item 0 To sVal End_Procedure Procedure Set Version String sVal Set value Of oAboutEdit Item 1 To sVal End_Procedure Procedure Set Copyright String sVal Set value Of oAboutEdit Item 2 To sVal End_Procedure Procedure Set Author String sVal Set value Of oAboutEdit Item 3 To sVal End_Procedure Procedure Set Logo String sLogo Set Bitmap Of oAboutGraphic To sLogo End_Procedure Procedure Set Websiteaddress String sVal Integer iCount iPos String sWebSite If (Length(sVal) = 0) Procedure_Return Move (Pos(":", sVal)) To iPos If iPos Move (Right(sVal, (Length(sVal) - iPos))) To sWebSite Move (Trim(sWebSite)) To sWebSite Set psWebSite To sWebSite If (Length(sWebSite) > 0) Begin Set Enabled_State Of oWebSite_bn To True Get Line_Count Of oAboutEdit To iCount Set Value Of oAboutEdit Item iCount To sVal End End_Procedure Procedure Set EmailAddress String sVal Integer iCount Get Line_Count Of oAboutEdit To iCount Set Value Of oAboutEdit Item iCount To sVal Send License Send Serial Send Users End_Procedure Procedure License Integer iCount String sName Get psName Of ghoApplication To sName Get Line_Count Of oAboutEdit To iCount Set Value Of oAboutEdit Item iCount To ("Licensed to:" * sName) End_Procedure Procedure Serial Integer iCount String sNo Get psSerial Of ghoApplication To sNo Get Line_Count Of oAboutEdit To iCount Set Value Of oAboutEdit Item iCount To ("Serial number:" * String(sNo)) End_Procedure Procedure Users Integer iCount iNo Get piUsers Of ghoApplication To iNo Get Line_Count Of oAboutEdit To iCount Set Value Of oAboutEdit Item iCount To ("Licensed Users:" * String(iNo)) Set Value Of oAboutEdit Item (iCount + 1) To "" End_Procedure Procedure ReadFile String sFilename Direct_Input sFilename If Not (Seqeof) Begin Close_Input Send Read Of oAboutEdit sFilename End End_Procedure Procedure Show_Sysinfo Send Popup_Modal Of Sysinfo_Dialog End_Procedure // Show_Sysinfo Procedure Open_Web_Site String sWebSite Get psWebSite To sWebSite Send DoStartDocument "open" sWebSite "" "" End_Procedure // Procedure End_Construct_Object // Handle hoVersionInfo // Boolean bIncluded // Integer iMajor iMinor iRelease iBuild // If (Label(oVersion) = C_$VERSION) Begin // // set it to the version info of the program, if available // If (ghoApplication) Begin // Get phoVersionInfo Of ghoApplication To hoVersionInfo // Get pbIncluded Of hoVersionInfo To bIncluded // If bIncluded Begin // Get piVersionMajor Of hoVersionInfo To iMajor // Get piVersionMinor Of hoVersionInfo To iMinor // Get piVersionRelease Of hoVersionInfo To iRelease // Get piVersionBuild Of hoVersionInfo To iBuild // Set Version To (SFormat(C_$VERSION +": %1.%2.%3.%4", iMajor, iMinor, iRelease, iBuild)) // End // End // End // Forward Send End_Construct_Object // End_Procedure End_Class