home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 May / CHIPCD5_98.iso / coreldrw / Scripts / gdi.csc < prev    next >
Text File  |  1997-08-11  |  2KB  |  64 lines

  1. REM Displays the systems free resources
  2. REM GDI.CSC          Septembre 23, 1996
  3. REM You need to have the Windows DLL RSRC32.dll installed 
  4. REM for this script to work.
  5. REM Copyright 1996 Corel Corporation. All rights reserved.
  6.  
  7. '  Declare DLL function
  8. DECLARE FUNCTION GetRes LIB "RSRC32.dll" (BYVAL a AS INTEGER) AS LONG ALIAS "_MyGetFreeSystemResources32@4"
  9. ' GetRes function constants
  10. GLOBAL CONST GFSR_SYSTEMRESOURCES%=0
  11. GLOBAL CONST GFSR_USERRESOURCES%=1
  12. GLOBAL CONST GFSR_GDIRESOURCES%=2
  13.  
  14.     ' Resource meter dialog
  15. BEGIN DIALOG OBJECT RES 207, 56, "Resource Indicator", SUB RESHandler
  16.     TEXT  6, 6, 62, 12, .SysResText, "System resources:"
  17.     TEXT  68, 6, 15, 12, .SysRes, ""
  18.     PROGRESS 92, 6, 106, 12, .SysProg
  19.     TEXT  7, 36, 57, 12, .GDIResText, "GDI Resources:"
  20.     TEXT  68, 21, 15, 12, .GDIRes, ""
  21.     PROGRESS 92, 21, 106, 12, .GDIProg
  22.     TEXT  7, 21, 54, 12, .UserResText, "User Resources:"
  23.     TEXT  68, 36, 15, 12, .UserRes, ""
  24.     PROGRESS 92, 36, 106, 12, .UserProg
  25. END DIALOG
  26.  
  27. ' Dialog handler
  28. SUB RESHandler(BYVAL ControlID%, BYVAL Event%)
  29.     DIM Sys AS LONG
  30.     DIM User AS LONG
  31.     DIM GDI AS LONG
  32.     IF Event%=0 OR Event%=5 THEN
  33.       ' Timer
  34.         ' Collect res info
  35.         Sys&=GetRes(GFSR_SYSTEMRESOURCES)
  36.         User&=GetRes(GFSR_USERRESOURCES)
  37.         GDI&=GetRes(GFSR_GDIRESOURCES)
  38.         ' Set up text
  39.         RES.SysRes.SetText(" " + CSTR(Sys&) + "%")
  40.         RES.UserRes.SetText(" " + CSTR(User&) + "%")
  41.         RES.GDIRes.SetText(" " + CSTR(GDI&) + "%")
  42.         ' Set up progress controls
  43.         RES.SysProg.SetValue Sys&
  44.         RES.UserProg.SetValue User&
  45.         RES.GDIProg.SetValue GDI&
  46.     END IF
  47. END SUB
  48.  
  49. ' Main code
  50. RES.SetTimer 10000 ' Update every 10 seconds
  51. RES.SetStyle 32   ' Enable minimize/maximize
  52. ' Set progress controls
  53. RES.SysProg.SetMinRange 0
  54. RES.GDIProg.SetMinRange 0
  55. RES.UserProg.SetMinRange 0
  56. RES.SysProg.SetMaxRange 100
  57. RES.GDIProg.SetMaxRange 100
  58. RES.UserProg.SetMaxRange 100
  59. ' Call up dialog
  60. DIALOG RES
  61.  
  62.  
  63.  
  64.