Module Dfabout.pkg
1//************************************************************************
2// Confidential Trade Secret.
3// Copyright (c) 1997 Data Access Corporation, Miami Florida
4// as an unpublished work. All rights reserved.
5// DataFlex Is A registered trademark Of Data Access Corporation.
6//
7//************************************************************************
8//************************************************************************
9//
10// $File name : DfAbout.pkg
11// $File title : About class support
12// Notice :
13// $Author(s) : Vincent Oorsprong, Ken Ross
14//
15// $Rev History
16//
17// VOO 07/25/2003 Removed OnResize procedure for sysinfo dialog. Replaced logic
18// with anchor technique. Removed unnessary property in the
19// sysinfo dialog. Changed the size Of the about & sysinfo dialog
20// object To better look in Windows XP. Repositioned the close
21// button in the sysinfo dialog To line up with the display area
22// Replaced obsolete code and techniques. Removed dead code.
23// JJT 10/23/2001 removed all ghoworkspace support. Uses app object or nothing
24// SWB 07/19/01 Added support Of the Application object in preference to
25// the global Workspace object, if it is present
26// JJT 11/05/98 Added version information
27// VOO 29/10/98 Replaced the GetFreeSystemResources for the Win32 variant
28// JJT 7/31/97 Registered Enumerate Workspace so dfabout can exist without
29// workspace package.
30// JJT 6/27/97 Turned the sysinfo objects into classes so the AboutDialog
31// class can create this object.
32// Cleaned up the interface (used correct classes and messages)
33// Added workspace reporting support To sys-info.
34// Turned off wrapping in the sys-info editor.
35// KR ??/??/96 File created
36//************************************************************************
37Use LanguageText.pkg
38Use Windows.pkg
39Use DFbitmap.pkg
40Use GlobalFunctionsProcedures.pkg
41
42External_Function32 WNetGetUser "WNetGetUserA" MPR.DLL Pointer lpName Pointer lpUser_Name Pointer lpLength Returns DWord
43
44Register_Function phoWorkspace Returns Handle
45Register_Function Help_filename Returns String
46Register_Function GetHelpFile Returns String
47Register_Function pbEnterKeyAsTabKey Returns Boolean
48
49//****************************************************************************
50// $Module type: FUNCTION
51// $Module name: Network_User_Name
52// $Author : AK/VOO/KCR
53// Created : 09-24-96 @ 19:17
54//
55// Description
56// This function reads the current username Of windows and returns that
57// name or an text unknown user
58//
59// $Rev History
60// 07/25/2003 Replaced obsolete code
61// 09/24/1996 Module header created
62//****************************************************************************
63Function Network_User_Name for cDesktop Returns String
64 String sName
65 Integer iRetval iLength
66
67 ZeroString 255 To sName
68 Move 255 To iLength
69
70 Move (WNetGetUser (0, AddressOf (sName), AddressOf (iLength))) To iRetval
71
72 If (iRetval = 0) Begin
73 Function_Return (CString (sName))
74 End
75 Else Begin
76 Function_Return "User Unknown"
77 End
78End_Function // Network_User_Name
79
80Type MEMORYSTATUS
81 Field MEMORYSTATUS.dwLength As Dword // sizeof(MEMORYSTATUS)
82 Field MEMORYSTATUS.dwMemoryLoad As Dword // percent Of memory in use
83 Field MEMORYSTATUS.dwTotalPhys As Dword // bytes Of physical memory
84 Field MEMORYSTATUS.dwAvailPhys As Dword // free physical memory bytes
85 Field MEMORYSTATUS.dwTotalPageFile As Dword // bytes Of paging file
86 Field MEMORYSTATUS.dwAvailPageFile As Dword // free bytes Of paging file
87 Field MEMORYSTATUS.dwTotalVirtual As Dword // user bytes Of address space
88 Field MEMORYSTATUS.dwAvailVirtual As Dword // free user bytes
89End_Type // MEMORYSTATUS
90
91External_Function GlobalMemoryStatus "GlobalMemoryStatus" Kernel32.Dll Pointer lpsMemoryStatus Returns Integer
92
93{ Visibility=Private }
94Class SysinfoDisplay Is An Edit
95 Procedure Construct_Object
96 Forward Send Construct_Object
97
98 Set Location To 6 6
99 Set Size To 110 255
100 Set Read_Only_State To True
101 Set Wrap_State To False
102 End_Procedure // Construct_Object
103
104 //****************************************************************************
105 // $Module type: PROCEDURE
106 // $Module name: Add_Line
107 // $Author : VOO
108 // Created : 06-10-96 @ 15:23
109 //
110 // Description
111 // This method will add a line To this edit object, it should go simpler
112 // but it seems To be done this way.
113 //
114 // $Rev History
115 // 07/25/2003 Replaced property retrieval from expression to GET syntax
116 // 06-10-1996 Module header created
117 //****************************************************************************
118 { Visibility=Private }
119 Procedure Add_Line String sVal
120 Integer iLine
121
122 Get Line_Count To iLine
123 If (iLine = 1 And (Not (Changed_State (Self)))) Begin
124 Move 0 To iLine
125 End
126 Set Value Item iLine To sVal
127 End_Procedure // Add_Line
128
129 //****************************************************************************
130 // $Module type: PROCEDURE
131 // $Module name: Show_Current_Directory
132 // $Author : VOO
133 // Created : 06-10-96 @ 15:24
134 //
135 // Description
136 // This method will show the name Of the current directory in the system
137 // information box
138 //
139 // $Rev History
140 // 06-10-96 Module header created
141 //****************************************************************************
142 { Visibility=Private }
143 Procedure Show_Current_Directory
144 String sDir
145
146 Get_Current_Directory To sDir
147
148 Send Add_Line (SFormat (C_$CurrentDirectory, sDir))
149 End_Procedure // Show_Current_Directory
150
151 { Visibility=Private }
152 Procedure Show_Windows_Directory
153 String sWindir
154
155 Get_Windows_Directory To sWindir
156
157 Send Add_Line (SFormat (C_$WindowsDirectory, sWindir))
158 End_Procedure // Show_Windows_Directory
159
160 { Visibility=Private }
161 Procedure Show_Current_User
162 Send Add_Line (SFormat (C_$NetworkUserName, Network_User_Name (Self)))
163 End_Procedure // Show_Current_User
164
165 { Visibility=Private }
166 Procedure Show_Number_Format
167 Integer iFormat
168 String sFormatText
169
170 Get_Attribute Df_Thousands_Separator To iFormat
171 Move (Character (iFormat)) To sFormatText
172 Send Add_Line (SFormat (C_$ThousandsSeparator, sFormatText, iFormat))
173
174 Get_Number_Format To iFormat
175 If (iFormat = 0) Begin
176 Move "." To sFormatText
177 End
178 Else Begin
179 Move "," To sFormatText
180 End
181 Send Add_Line (SFormat (C_$DecimalSeparator, sFormatText))
182 End_Procedure // Show_Number_Format
183
184 { Visibility=Private }
185 Procedure Show_Filelist_Name
186 String sFilename
187
188 Get_Attribute Df_Filelist_Name To sFilename
189
190 Send Add_Line (SFormat (C_$CurrentFilelist, sFilename))
191 End_Procedure // Show_Filelist_Name
192
193 { Visibility=Private }
194 Procedure Show_Lock_Delay
195 Integer iLockdelay
196
197 Get_Attribute Df_Lock_Delay To iLockdelay
198
199 Send Add_Line (SFormat (C_$DatabaseLockingDelay, iLockDelay))
200 End_Procedure // Show_Lock_Delay
201
202 { Visibility=Private }
203 Procedure Show_Lock_Timeout
204 Integer iLockTimeout
205
206 Get_Attribute Df_Lock_Timeout To iLockTimeout
207
208 Send Add_Line (SFormat (C_$DatabaseLockingTimeout, iLockTimeOut))
209 End_Procedure // Show_Lock_Timeout
210
211 { Visibility=Private }
212 Procedure Show_Screen_Size
213 Integer iYscreensize iXscreensize
214
215 Move (GetSystemMetrics (SM_CXSCREEN)) To iXscreensize
216 Move (GetSystemMetrics (SM_CYSCREEN)) To iYscreensize
217
218 Send Add_Line (SFormat (C_$VideoResolution, iXscreensize, iYscreensize))
219 End_Procedure // Show_Screen_Size
220
221 { Visibility=Private }
222 Procedure Show_Page_Size
223 Send Add_Line (SFormat (C_$PageEndFormFeed, Pageend, Pagefeed))
224 End_procedure // Show_Page_Size
225
226 { Visibility=Private }
227 Procedure Show_Date
228 Date dToday
229
230 Sysdate4 dToday
231
232 Send Add_Line (SFormat (C_$CurrentSystemDate, String (dToday)))
233 End_procedure // Show_Date
234
235 { Visibility=Private }
236 Procedure Show_Date_Format
237 Integer iDateFormat
238 String sDateFormat
239
240 Get_Attribute Df_Date_Format To iDateFormat
241 Case Begin
242 Case (iDateFormat = DF_DATE_USA)
243 Move C_$USA To sDateFormat
244 Case Break
245 Case (iDateFormat = DF_DATE_EUROPEAN)
246 Move C_$European To sDateFormat
247 Case Break
248 Case (iDateFormat = DF_DATE_MILITARY)
249 Move C_$Military To sDateFormat
250 Case Break
251 Case Else
252 Move C_$UnknownDateType To sDateFormat
253 Case Break
254 Case End
255
256 Send Add_Line (SFormat (C_$DateFormat, sDateformat))
257 End_Procedure // Show_Date_Format
258
259 { Visibility=Private }
260 Procedure Show_Memavail
261 Integer iMem
262
263 Memory iMem
264
265 Send Add_Line (SFormat (C_$AvailableMemory, iMem))
266 End_Procedure // Show_Memavail
267
268 { Visibility=Private }
269 Procedure Show_Systemresources
270 String sMemoryStatus
271 Integer iVoid
272 Dword dwMemoryLoad dwTotalPhys dwAvailPhys dwTotalPageFile dwAvailPageFile dwTotalVirtual dwAvailVirtual
273
274 ZeroType MEMORYSTATUS To sMemoryStatus
275
276 Move (GlobalMemoryStatus (AddressOf (sMemoryStatus))) To iVoid
277
278 GetBuff From sMemoryStatus At MEMORYSTATUS.dwMemoryLoad To dwMemoryLoad
279 GetBuff From sMemoryStatus At MEMORYSTATUS.dwTotalPhys To dwTotalPhys
280 GetBuff From sMemoryStatus At MEMORYSTATUS.dwAvailPhys To dwAvailPhys
281 GetBuff From sMemoryStatus At MEMORYSTATUS.dwTotalPageFile To dwTotalPageFile
282 GetBuff From sMemoryStatus At MEMORYSTATUS.dwAvailPageFile To dwAvailPageFile
283 GetBuff From sMemoryStatus At MEMORYSTATUS.dwTotalVirtual To dwTotalVirtual
284 GetBuff From sMemoryStatus At MEMORYSTATUS.dwAvailVirtual To dwAvailVirtual
285
286 Send Add_Line (SFormat (C_$MemoryUtilization, dwMemoryLoad))
287 Send Add_Line (SFormat (C_$AvailablePhysicalMemory, dwAvailPhys / dwTotalPhys * 100.0))
288 Send Add_Line (SFormat (C_$AvailablePagefileSpace, dwAvailPageFile / dwTotalPageFile * 100.0))
289 Send Add_Line (SFormat (C_$AvailableVirtualMemory, dwAvailVirtual / dwTotalVirtual * 100.0))
290 End_Procedure // Show_Systemresources
291
292 { Visibility=Private }
293 Procedure Show_Registration
294 String sRegName
295 Integer iSN
296
297 Registration sRegName iSN
298
299 Send Add_Line (SFormat (C_$Serial, iSN))
300 Send Add_Line (SFormat (C_$RegName, sRegName))
301 End_Procedure // Show_Registration
302
303 //****************************************************************************
304 // If workspaces are used, we will send the message EnumerateWorkspaceData
305 // To the workspace object passing the an object and message To send back
306 // To this object. It is expected that the workspace object will send this
307 // message for every line Of information it wants displayed (passing the
308 // information To be displayed
309 //****************************************************************************
310 Register_Procedure EnumerateWorkspaceData Integer hObjId Integer hmMessId
311
312 { Visibility=Private }
313 Procedure Show_ServicePack
314 String sVersion
315
316 Get_Profile_String "" "CurrentVersionDescription" To sVersion
317
318 If (sVersion <> "") Begin
319 Send Add_Line sVersion
320 Send Add_Line ""
321 End
322 End_Procedure // Show_ServicePack
323
324 { Visibility=Private }
325 Procedure Show_WorkspaceInformation
326 Integer hoWorkspace
327
328 If (ghoApplication <> 0) Begin
329 Get phoWorkspace Of ghoApplication To hoWorkspace
330 Send EnumerateWorkspaceData Of hoWorkspace Self Msg_Add_Line
331 End
332 End_Procedure // Show_WorkspaceInformation
333
334 { Visibility=Private }
335 Function VersionStr Integer iVer Integer iRev Integer iBld Returns String
336 Function_Return (String (iVer) - "." - String (iRev) - "." - String (iBld))
337 End_Function // VersionStr
338
339 { Visibility=Private }
340 Procedure Show_Versions
341 Integer iVersion iRevision iBuild
342
343 Version_information iVersion iRevision iBuild
344
345 Send Add_Line (SFormat (C_$RuntimeVersion, VersionStr(self,iVersion,iRevision,iBuild) ))
346 Send Add_Line (SFormat (C_$PackageVersion, VersionStr(self,PKG_VERSION, PKG_REVISION, PKG_BUILD) ))
347 Send Add_Line (SFormat (C_$FMACVersion, VersionStr(self,FMAC_VERSION, FMAC_REVISION, FMAC_BUILD) ))
348 End_Procedure // Show_Versions
349
350 //***
351 //*** BW
352 //*** Procedure: Show_Drivers
353 //*** Purpose : Show loaded database drivers
354 //***
355
356 { Visibility=Private }
357 Procedure Show_Drivers
358 String sCurrentDriver sLoadedDrivers
359 Integer iNumberOfDrivers iCount
360
361 Move "" To sLoadedDrivers
362 Get_Attribute DF_NUMBER_DRIVERS To iNumberOfDrivers
363 For iCount From 1 To iNumberOfDrivers
364 Get_Attribute DF_DRIVER_NAME Of iCount To sCurrentDriver
365 If (sLoadedDrivers <> "") Begin
366 Move (Append (sLoadedDrivers, ", ")) To sLoadedDrivers
367 End
368 Move (Append (sLoadedDrivers, sCurrentDriver)) To sLoadedDrivers
369 Loop
370 Send Add_Line (SFormat (C_$DatabaseDriver, sLoadedDrivers))
371 End_Procedure // Show_Drivers
372
373 { Visibility=Private }
374 Procedure Show_HelpFile
375 String sHelpFile
376 Integer eHelpType
377
378 If (ghoApplication <> 0) Begin
379 Get peHelpType Of ghoApplication To eHelpType
380 If (eHelpType = htHtmlHelp and ghoHtmlHelp) Begin
381 Get GetHelpFile Of ghoHtmlHelp To sHelpFile
382 End
383 Else If (eHelpType = htWinHelp and Help_object_id) Begin
384 Get Help_filename Of Help_object_id To sHelpFile
385 End
386 Else Begin
387 Move C_$ThereIsNoHelpfileDefined To sHelpFile
388 End
389
390 Send Add_Line ""
391 Send Add_Line (SFormat (C_$HelpFile, sHelpFile))
392 End
393 End_Procedure // Show_HelpFile
394
395 { Visibility=Private }
396 Procedure Show_EnterAsTab
397 Boolean bEnterKeyAsTabKey
398 String sText
399
400 If (ghoApplication <> 0) Begin
401 Get pbEnterKeyAsTabKey Of ghoApplication To bEnterKeyAsTabKey
402 If (bEnterKeyAsTabKey) Begin
403 Move "True" To sText
404 End
405 Else Begin
406 Move "False" To sText
407 End
408 Send Add_Line (SFormat (C_$EnterKeyNavForward, sText))
409 End
410 End_Procedure // Show_EnterAsTab
411
412 //****************************************************************************
413 // $Module type: PROCEDURE
414 // $Module name: Add_Focus
415 // $Author : VOO
416 // Created : 24-09-96 @ 19:43
417 //
418 // Description
419 // During activation we will remove the old information and add the newly
420 // found systeminformation
421 //
422 // $Rev History
423 // 24-09-96 Module header created
424 //****************************************************************************
425 { Visibility=Private }
426 Procedure Add_Focus Integer hoRoot
427 Forward Send Add_Focus hoRoot
428
429 Send Delete_Data
430
431 Set Changed_State To False
432 Set Read_Only_State To True
433
434 Send Show_ServicePack
435 Send Show_WorkSpaceInformation // added To show WS info
436 If (ghoApplication <> 0) Begin
437 Send Show_HelpFile
438 Send Show_EnterAsTab
439 End
440 Send Show_Drivers
441 Send Show_Current_User
442 Send Show_Windows_Directory
443 Send Show_Current_Directory
444 Send Show_Filelist_Name
445 Send Show_Versions
446 Send Show_Memavail
447 Send Show_Screen_Size
448 Send Show_Page_Size
449 Send Show_Number_Format
450 Send Show_Date_Format
451 Send Show_Lock_Delay
452 Send Show_Lock_Timeout
453 Send Show_Date
454 Send Show_Systemresources
455 Send Show_Registration
456 End_Procedure // Show_All_Info
457End_Class // SysinfoDisplay
458
459//****************************************************************************
460// $Module type: OBJECT
461// $Module name: Sysinfo_Dialog
462// $Author : VOO
463// Created : 24-09-96 @ 18:47
464//
465// Description
466// This object shows the systeminformation on the screen
467//
468// $Rev History
469// 24-09-96 Module header created
470//****************************************************************************
471{ Visibility=Private }
472Class SysInfoDialog Is A ModalPanel
473 Procedure Construct_Object
474 Forward Send Construct_Object
475
476 Set Label to C_$SystemInformation
477 Set pbSizeToClientArea to True
478 Set Size to 140 267
479 Set piMinSize to 140 267
480 Set Locate_Mode To CENTER_ON_SCREEN
481 Set Border_Style To Border_Thick
482
483 Object oSysinfoDisplay Is A SysInfoDisplay
484 Set peAnchors to anAll
485 End_Object // oSysinfoDisplay
486
487 Object oCloseButton Is A Button
488 Set Label To C_$Close
489 Set Location To 120 210
490 Set Message Item 0 To Msg_Close_Panel
491 Set Default_State To True
492 Set peAnchors to anBottomRight
493 End_Object // oCloseButton
494
495 On_Key kCancel Send Close_Panel
496 End_Procedure // Construct_Object
497End_Class // SysinfoDialog
498
499// Purpose:
500//
501// Ken Ross 12/17/96 5:16PM
502//
503{ OverrideProperty=StatusBar_Id DesignTime=False }
504{ OverrideProperty=ToolBar_Id DesignTime=False }
505{ HelpTopic=AboutDialog }
506Class AboutDialog Is A ModalPanel
507 Procedure Construct_Object
508 String sVdfRootDir
509
510 Forward Send Construct_Object
511
512 Set Label To C_$About
513 Set Size to 89 212
514 Set Locate_Mode To CENTER_ON_SCREEN
515
516 Object oSysInfoDialog Is A SysInfoDialog
517 End_Object // oSysInfoDialog
518
519 Object oBox Is A Container3d
520 Set Border_Style To Border_StaticEdge
521 Set Size to 63 202
522 Set Location To 4 5
523
524 Object oAboutGraphic Is A BitmapContainer
525 Set Border_Style To Border_None
526 Set Bitmap_Style To Bitmap_Center
527 Set Size To 48 48
528 Set Location To 7 2
529 End_Object // oAboutGraphic
530
531 Object oProductName Is A TextBox
532 Set Label To C_$ProductName
533 Set Size To 10 45
534 Set Location To 8 53
535 End_Object // oProductName
536
537 Object oVersion Is A TextBox
538 Set Label To C_$Version
539 Set Size To 10 25
540 Set Location To 21 53
541 End_Object // oVersion
542
543 Object oCopyright Is A TextBox
544 Set Label To C_$Copyright
545 Set Size To 10 31
546 Set Location To 34 53
547 End_Object // oCopyright
548
549 Object oAuthor Is A TextBox
550 Set Label To C_$Author
551 Set Size To 10 22
552 Set Location To 46 53
553 End_Object // oAuthor
554 End_Object // oBox
555
556 Object oOKButton Is A Button
557 On_Item C_$OK Send Close_Panel
558 Set Size To 14 50
559 Set Location To 71 157
560 End_Object // oOKButton
561
562 Object oSysInfoButton Is A Button
563 On_Item C_$SystemInfo Send Show_Sysinfo
564 Set Size To 14 50
565 Set Location To 71 101
566 End_Object // oSysInfoButton
567
568 On_Key Kcancel Send KeyAction Of oOKButton
569
570 Set Logo To "DacAbout.bmp" // square bitmaps Of 42x42 work best
571 End_Procedure // Construct_Object
572
573 { MethodType=Property }
574 Procedure Set ProductName String sProductName
575 Set Label Of oProductName To sProductName
576 End_Procedure // Set ProductName
577
578 { MethodType=Property }
579 Procedure Set Version String sVersion
580 Set Label Of oVersion To sVersion
581 End_Procedure // Set Version
582
583 { MethodType=Property }
584 Procedure Set Copyright string sCopyright
585 Set Label Of oCopyright To sCopyright
586 End_Procedure // Set Copyright
587
588 { MethodType=Property }
589 Procedure Set Author String sAuthor
590 Set Label Of oAuthor To sAuthor
591 End_Procedure // Set Author
592
593 { MethodType=Property }
594 Procedure Set Logo string sLogo
595 // square bitmaps Of 42x42 work best
596 Set Bitmap Of oAboutGraphic To sLogo
597 End_Procedure // Set Logo
598
599 { Visibility=Private }
600 Procedure Show_Sysinfo
601 Send Popup_Modal Of oSysinfoDialog
602 End_Procedure // Show_Sysinfo
603
604 Procedure End_Construct_Object
605 Handle hoVersionInfo
606 Boolean bIncluded
607 Integer iMajor iMinor iRelease iBuild
608 String sLabel
609
610 Get Label Of oVersion To sLabel
611 If (sLabel = C_$VERSION) Begin
612 // set it To the version info Of the program, if available
613 If (ghoApplication <> 0) Begin
614 Get phoVersionInfo Of ghoApplication To hoVersionInfo
615 Get pbIncluded Of hoVersionInfo To bIncluded
616 If (bIncluded) Begin
617 Get piVersionMajor Of hoVersionInfo To iMajor
618 Get piVersionMinor Of hoVersionInfo To iMinor
619 Get piVersionRelease Of hoVersionInfo To iRelease
620 Get piVersionBuild Of hoVersionInfo To iBuild
621 Move (SFormat (C_$VERSION + ": %1.%2.%3.%4", iMajor, iMinor, iRelease, iBuild)) To sLabel
622 Set Version To sLabel
623 End
624 End
625 End
626
627 Forward Send End_Construct_Object
628 End_Procedure // End_Construct_Object
629End_Class // AboutDialog
630