home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples5 / ch12 / dwprmon.cls < prev    next >
Encoding:
Visual Basic class definition  |  1997-02-16  |  1.7 KB  |  66 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "dwPrintMonitor"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = False
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = False
  10. ' Desaware API Class library
  11. ' Copyright (c) 1995-1997 by Desaware
  12. ' All rights reserved
  13.  
  14. ' Preliminary demonstration edition
  15.  
  16.  
  17. Option Explicit
  18.  
  19. Public pName$           ' Print monitor name
  20. Public pEnvironment$    ' Environment for monitor
  21. Public pDLLName$        ' DLL name of print monitor
  22. Public Level&
  23.  
  24. Private Type MONITOR_INFO_1
  25.         pName As Long
  26. End Type
  27.  
  28. Private Type MONITOR_INFO_2
  29.         pName As Long
  30.         pEnvironment As Long
  31.         pDLLName As Long
  32. End Type
  33.  
  34. Public Sub LoadInfo(Buf As Byte, pLevel&, x&)
  35.     Level = pLevel
  36.     Select Case Level
  37.         Case 1
  38.             LoadMonitorInfo1 Buf, x&
  39.         Case 2
  40.             LoadMonitorInfo2 Buf, x&
  41.     End Select
  42. End Sub
  43.  
  44. Public Sub LoadMonitorInfo1(Buf As Byte, x&)
  45.     Dim pi As MONITOR_INFO_1
  46.     Dim offset&
  47.     Dim useaddr&
  48.     offset& = x * Len(pi)
  49.     useaddr& = agGetAddressForObject(Buf) + offset
  50.     Call agCopyData(ByVal useaddr, pi, Len(pi))
  51.     If (pi.pName <> 0) Then pName = agGetStringFromPointer(pi.pName)
  52. End Sub
  53.  
  54. Public Sub LoadMonitorInfo2(Buf As Byte, x&)
  55.     Dim pi As MONITOR_INFO_2
  56.     Dim offset&
  57.     Dim useaddr&
  58.     offset& = x * Len(pi)
  59.     useaddr& = agGetAddressForObject(Buf) + offset
  60.     Call agCopyData(ByVal useaddr, pi, Len(pi))
  61.     If (pi.pName <> 0) Then pName = agGetStringFromPointer(pi.pName)
  62.     If (pi.pEnvironment <> 0) Then pEnvironment = agGetStringFromPointer(pi.pEnvironment)
  63.     If (pi.pDLLName <> 0) Then pDLLName = agGetStringFromPointer(pi.pDLLName)
  64. End Sub
  65.  
  66.