| |
|
|
| Drucker Drucken WinSpool OpenPrinter Jobs EnumJobs PRINTER_CHANGE_JOB Spooler Aufträge Überwachen Querformat Hochformat DevMode FindFirstPrinterChangeNotification:
Andreas Miethe (20.11.10)
Rolf Koch (11/20/10) So hatte vorm Konzert otra vez gekuckt y festgestellt, daß imprimir test&,wi&,he& Immer 0,0,0 printen. Naja veces gemütlich rangehen y studieren ^ ^
If fragt a el falschen Punto el Devmode-Struktur. Hoch oder Querformat es a Position 44 como word 1 oder 2 KompilierenMarcaSeparación {$cleq}
$H Windows.ph
$H winspool.ph
DEF Get_STDPrinter(1) Substr$(ReadIni$("WIN.INI","Windows","Device"),@&(1),",")
DEF &PRINTER_CHANGE_JOB $FF00
DEF &INFINITE $FFFFFFFF
DEF &PRINTER_CHANGE_ADD_JOB $100
DEF OpenPrinterA(3) !"winspool.drv","OpenPrinterA"
DEF FindFirstPrinterChangeNotification(4) !"winspool.drv","FindFirstPrinterChangeNotification"
DEF FindNextPrinterChangeNotification(4) !"winspool.drv","FindNextPrinterChangeNotification"
DEF EnumJobsA(8) !"winspool.drv","EnumJobsA"
DEF FindClosePrinterChangeNotification(1) !"winspool.drv","FindClosePrinterChangeNotification"
DEF ClosePrinter(1) !"winspool.drv","ClosePrinter"
Declare JOB_INFO_1#
Declare druckername$,dokument$,dstring$
Declare Ende%,lb&,old_count&,entry$,sounddir$,lizenz$
Declare hicon&,cancel&,Title$,Version$,config$
Declare wav$,dateipfad$,belege$,wurde$,new$,abelege%
Var InfoBuffer& = 0
Var BytesNeeded& = 0
Var BytesReturned& = 0;
Var A& = 0
Var L& = 0
Var chgObject& = 0
Var pdwChange& = 0
Var fcnreturn& = 0
Var hPrinter& = 0
Var foundprint& = 0
Var Printer$ = Get_STDPrinter(1)
Var devmoaddr&=0
Var drv$=""
Var wi&=0
Var he&=0
Var Orientation&=0
Var test&=0
//WindowStyle 64
CLS
print usedll("winspool.drv")
print printer$
print OpenPrinterA(Addr(Printer$),Addr(hPrinter&),0)
print hPrinter&
chgObject& = FindFirstPrinterChangeNotification(hPrinter&,&PRINTER_CHANGE_JOB, 0, 0)
print chgObject&
dateipfad$=$progdir
dstring$="Drucktest.rtf"'Wordpad Datei unter Drucktest.rtf gespeichert für Test!
' Am besten einen Filedruck auswählen, damit man kein Papier verbraucht.
settimer 50
WhileNot Ende%
Waitinput
If %wmtimer
~WaitForSingleObject(chgObject&,150)'200 Millisekunden warten
fcnreturn& = FindNextPrinterChangeNotification(chgObject&, Addr(pdwChange&),0,0)
foundprint&=0
If fcnreturn&
If pdwChange& = &PRINTER_CHANGE_ADD_JOB
'Print "neuer Druck-Job"
EnumJobsA(hPrinter&,0,1,2,0,0,Addr(BytesNeeded&),Addr(BytesReturned&))
Dim JOB_INFO_1#,BytesNeeded&
Repeat
EnumJobsA(hPrinter&,0,1,2,JOB_INFO_1#,BytesNeeded&,Addr(BytesNeeded&),Addr(BytesReturned&))
If BytesReturned&
'Locate 0,0
druckername$=String$(Long(JOB_INFO_1#,4),0)
dokument$=String$(Long(JOB_INFO_1#,16),0)
foundprint&=1
devmoaddr&=Long(JOB_INFO_1#,40)
test&=long(devmoaddr&,104)
wi&=long(devmoaddr&,108)
he&=long(devmoaddr&,112)
Orientation&=word(devmoaddr&,44)
drv$=string$(devmoaddr&,0)
EndIf
Until BytesReturned& = 0
If foundprint&=1
print dokument$
print dstring$
print drv$
print test&,wi&,he&
Print If (Orientation& = 1,"Hochformat","Querformat")
If dokument$=dstring$
'playsound sounddir$+"doorbell.wav",1 'HIER SOUNDAUSGABE
PRINT "Jetzt würde der Lautsprecher Dingdong spielen"
EndIf
EndIf
EndIf
EndIf
EndIf
EndWhile
FindClosePrinterChangeNotification(chgObject&)
ClosePrinter(hPrinter&)
killtimer
End
|
|
|
| |
|
|