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 / samples4 / ch12 / dwprmon.cls < prev    next >
Encoding:
Text File  |  1996-02-16  |  1.6 KB  |  64 lines

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