home *** CD-ROM | disk | FTP | other *** search
/ Corel Draw 8 / 01CD8_Program.iso / scripts / gdi.csc < prev    next >
Text File  |  1997-12-04  |  3KB  |  74 lines

  1. REM Displays the systems free resources
  2. REM GDI.CSC          September 23, 1996
  3. REM ⌐ 1997 Corel Corporation. All rights reserved.
  4.  
  5. REM **************************************************************************************
  6. REM You need to have the Windows DLL RSRC32.dll installed for this script to work.
  7. REM If you don't have this file, install the System Resource Meter, available as a 
  8. REM component of the Accessories option provided with Windows 95. 
  9. REM
  10. REM To install the System Resource Meter:
  11. REM From the Start menu select Settings, Control Panel. Choose Add/Remove Programs and 
  12. REM select the Windows Setup tab. Under Accessories, enable the System Resource Meter 
  13. REM option. Follow the on-screen instuctions to complete the process.
  14. REM **************************************************************************************
  15.  
  16. '  Declare DLL function
  17. DECLARE FUNCTION GetRes LIB "RSRC32.dll" (BYVAL a AS INTEGER) AS LONG ALIAS "_MyGetFreeSystemResources32@4"
  18. ' GetRes function constants
  19. GLOBAL CONST GFSR_SYSTEMRESOURCES%=0
  20. GLOBAL CONST GFSR_USERRESOURCES%=1
  21. GLOBAL CONST GFSR_GDIRESOURCES%=2
  22.  
  23.     ' Resource meter dialog
  24. BEGIN DIALOG OBJECT RES 207, 56, "Resource Indicator", SUB RESHandler
  25.     TEXT  6, 6, 62, 12, .SysResText, "System resources:"
  26.     TEXT  68, 6, 15, 12, .SysRes, ""
  27.     PROGRESS 92, 6, 106, 12, .SysProg
  28.     TEXT  7, 36, 57, 12, .GDIResText, "GDI Resources:"
  29.     TEXT  68, 21, 15, 12, .GDIRes, ""
  30.     PROGRESS 92, 21, 106, 12, .GDIProg
  31.     TEXT  7, 21, 54, 12, .UserResText, "User Resources:"
  32.     TEXT  68, 36, 15, 12, .UserRes, ""
  33.     PROGRESS 92, 36, 106, 12, .UserProg
  34. END DIALOG
  35.  
  36. ' Dialog handler
  37. SUB RESHandler(BYVAL ControlID%, BYVAL Event%)
  38.     DIM Sys AS LONG
  39.     DIM User AS LONG
  40.     DIM GDI AS LONG
  41.     IF Event%=0 OR Event%=5 THEN
  42.       ' Timer
  43.         ' Collect res info
  44.         Sys&=GetRes(GFSR_SYSTEMRESOURCES)
  45.         User&=GetRes(GFSR_USERRESOURCES)
  46.         GDI&=GetRes(GFSR_GDIRESOURCES)
  47.         ' Set up text
  48.         RES.SysRes.SetText(" " + CSTR(Sys&) + "%")
  49.         RES.UserRes.SetText(" " + CSTR(User&) + "%")
  50.         RES.GDIRes.SetText(" " + CSTR(GDI&) + "%")
  51.         ' Set up progress controls
  52.         RES.SysProg.SetValue Sys&
  53.         RES.UserProg.SetValue User&
  54.         RES.GDIProg.SetValue GDI&
  55.     END IF
  56. END SUB
  57.  
  58. ON ERROR GOTO ErrorHandler
  59. ' Main code
  60. RES.SetTimer 10000 ' Update every 10 seconds
  61. RES.SetStyle 32   ' Enable minimize/maximize
  62. ' Set progress controls
  63. RES.SysProg.SetMinRange 0
  64. RES.GDIProg.SetMinRange 0
  65. RES.UserProg.SetMinRange 0
  66. RES.SysProg.SetMaxRange 100
  67. RES.GDIProg.SetMaxRange 100
  68. RES.UserProg.SetMaxRange 100
  69. ' Call up dialog
  70. DIALOG RES
  71.  
  72. ErrorHandler:
  73. STOP
  74.