| |
|
|
| Manchmal muss man Steuerbefehle direkt an einen Drucker senden, so gehts: KompilierenMarkierenSeparierenRawDataToPrinter("Druckername","text")
DEF OpenPrinterA(3) !"winspool.drv","OpenPrinterA"
DEF StartDocPrinter(3) !"winspool.drv","StartDocPrinterA"
DEF StartPagePrinter(1) !"winspool.drv","StartPagePrinter"
DEF WritePrinter(4) !"winspool.drv","WritePrinter"
DEF EndPagePrinter(1) !"winspool.drv","EndPagePrinter"
DEF EndDocPrinter(1) !"winspool.drv","EndDocPrinter"
DEF ClosePrinter(1) !"winspool.drv","ClosePrinter"
BOOL RawDataToPrinter( string szPrinterName, string text){
long lpData=addr(text),dwCount=len(text)
long hPrinter=globalAlloc(gPTR,4)
long DocInfo=globalAlloc(gPTR,12)
long dwJob
long dwBytesWritten=globalAlloc(gPTR,4)
string raw="RAW"
string docname="Druckauftrag"
long docinfo&,0=addr(docname),0,addr(raw)
long tmp=globalAlloc(gPTR,128)
char tmp&,0=szPrinterName
casenot OpenPrinterA( tmp, hPrinter, 0 ) : return false
hPrinter=long(hPrinter,0)
dwJob = StartDocPrinter( hPrinter, 1, DocInfo )
StartPagePrinter( hPrinter )
WritePrinter( hPrinter, lpData, dwCount, dwBytesWritten )
EndPagePrinter( hPrinter );
EndDocPrinter( hPrinter );
ClosePrinter( hPrinter );
return TRUE nt color=#0000FF>}
|
|
|
| |
|
|
|
| Achso,
der Funktion fehlen noch lauter globalFree's, überall wo per globalAlloc Speicher geholt wurde. |
|
|
| |
|
|