Last Updated 2005/10/26
 Programming Tips  Visual Basic ˆσό  υ ˆψ 
ˆσό‚Μ’†’f
2005/10/26

’ʏνŽg‚€ƒvƒŠƒ“ƒ^‚ΜˆσόƒWƒ‡ƒu‚πνœ‚·‚ιD


  Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" _
   (ByVal pPrinterName As String, _
    phPrinter As Long, _
    pDefault As Any) As Long

  Declare Function ClosePrinter Lib "winspool.drv" _
   (ByVal hPrinter As Long) As Long

  Declare Function SetPrinter Lib "winspool.drv" Alias "SetPrinterA" _
   (ByVal hPrinter As Long, _
    ByVal Level As Long, _
    pPrinter As Any, _
    ByVal Command As Long) As Long
  Public Const PRINTER_CONTROL_PAUSE = 1
  Public Const PRINTER_CONTROL_RESUME = 2
  Public Const PRINTER_CONTROL_PURGE = 3

  Dim strPrinterDeviceName  As String
  Dim lngPrinterHandle      As Long
  Dim lngPrinterInfoLevel   As Long
  Dim lngPrinterCommand     As Long
  Dim lngWin32apiResultCode As Long

  strPrinterDeviceName = Printer.DeviceName
  lngWin32apiResultCode = OpenPrinter(strPrinterDeviceName, _
                                      lngPrinterHandle, _
                                      ByVal vbNullString)
  lngPrinterInfoLevel = 0
  lngPrinterCommand = PRINTER_CONTROL_PURGE
  lngWin32apiResultCode = SetPrinter(lngPrinterHandle, _
                                     lngPrinterInfoLevel, _
                                     ByVal vbNullString, _
                                     lngPrinterCommand)
  lngWin32apiResultCode = ClosePrinter(lngPrinterHandle)


ŽQΖ
ˆσόƒLƒƒƒ“ƒZƒ‹
‘OŒγ‚ΜTips
ˆσό‚Μ’†’f

DSS ProgrammingTipsCGI Ver2.00