1. Writing direct to printer
- Posted by "Andy Drummond" <andy at kestreltele.com> Mar 22, 2004
- 359 views
This is a multi-part message in MIME format. ------=_NextPart_000_0094_01C4101B.20925980 charset="iso-8859-1" I have a project whereby I need to write a log file to the printer port as fast as it appears - but Windows only outputs anything when you throw a page. I have tried using the Windows routine WritePrinter() but it needs the handle to the the printer DC, and I can't seem to get that anywhere. I use Win32Lib 59.1 and Judith's IDE to write my code - plus my own DLL to call WritePrinter because that lives in WinSpool.lib and not in a DLL. Does anyone know where I can find the handle of the DC that Win32Lib gets when you call getPrinter() in that library? I have the DC itself, but that doesn't seem to help. I don't think I understand handles...... ------=_NextPart_000_0094_01C4101B.20925980 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2800.1400" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>I have a project whereby I need to write a log file to the printer port</FONT></DIV> <DIV><FONT face=Arial size=2>as fast as it appears - but Windows only outputs anything when you</FONT></DIV> <DIV><FONT face=Arial size=2>throw a page.</FONT></DIV> <DIV><FONT face=Arial size=2>I have tried using the Windows routine WritePrinter() but it needs the</FONT></DIV> <DIV><FONT face=Arial size=2>handle to the the printer DC, and I can't seem to get that anywhere.</FONT></DIV> <DIV><FONT face=Arial size=2>I use Win32Lib 59.1 and Judith's IDE to write my code - plus my own</FONT></DIV> <DIV><FONT face=Arial size=2>DLL to call WritePrinter because that lives in WinSpool.lib and not in</FONT></DIV> <DIV><FONT face=Arial size=2>a DLL.</FONT></DIV> <DIV><FONT face=Arial size=2>Does anyone know where I can find the handle of the DC that Win32Lib</FONT></DIV> <DIV><FONT face=Arial size=2>gets when you call getPrinter() in that library? I have the DC itself, but</FONT></DIV> <DIV><FONT face=Arial size=2>that doesn't seem to help. I don't think I understand handles......</FONT></DIV> ------=_NextPart_000_0094_01C4101B.20925980--
2. Re: Writing direct to printer
- Posted by "Mario Steele" <eumario at tuscanchat.com> Mar 22, 2004
- 360 views
This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C40FF0.91DD8CC0 charset="iso-8859-1" as fast as it appears - but Windows only outputs anything when you throw a page. I have tried using the Windows routine WritePrinter() but it needs the handle to the the printer DC, and I can't seem to get that anywhere. I use Win32Lib 59.1 and Judith's IDE to write my code - plus my own DLL to call WritePrinter because that lives in WinSpool.lib and not in a DLL. Does anyone know where I can find the handle of the DC that Win32Lib gets when you call getPrinter() in that library? I have the DC itself, but that doesn't seem to help. I don't think I understand handles...... What you should be able to do, which I'm sure Derek will correct me, is be able to use getDC(Printer) which returns a Win32lib ID for the Handle to the DC. You should be able to get the Actual Win32 Handle from getHandle(getDC(Printer)). Again, I could be wrong, and I'm sure Derek will correct me on this. EuMario ------=_NextPart_000_0005_01C40FF0.91DD8CC0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 5.50.4134.100" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV>============ The Euphoria Mailing List ============ <BR><FONT face=Arial size=2>I have a project whereby I need to write a log file to the printer port</FONT></DIV> <DIV><FONT face=Arial size=2>as fast as it appears - but Windows only outputs anything when you</FONT></DIV> <DIV><FONT face=Arial size=2>throw a page.</FONT></DIV> <DIV><FONT face=Arial size=2>I have tried using the Windows routine WritePrinter() but it needs the</FONT></DIV> <DIV><FONT face=Arial size=2>handle to the the printer DC, and I can't seem to get that anywhere.</FONT></DIV> <DIV><FONT face=Arial size=2>I use Win32Lib 59.1 and Judith's IDE to write my code - plus my own</FONT></DIV> <DIV><FONT face=Arial size=2>DLL to call WritePrinter because that lives in WinSpool.lib and not in</FONT></DIV> <DIV><FONT face=Arial size=2>a DLL.</FONT></DIV> <DIV><FONT face=Arial size=2>Does anyone know where I can find the handle of the DC that Win32Lib</FONT></DIV> <DIV><FONT face=Arial size=2>gets when you call getPrinter() in that library? I have the DC itself, but</FONT></DIV> <DIV><FONT face=Arial size=2>that doesn't seem to help. I don't think I understand handles......</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>What you should be able to do, which I'm sure Derek will correct me, is be able to use getDC(Printer) which returns a Win32lib ID for the Handle to the DC. You should be able to get the Actual Win32 Handle from getHandle(getDC(Printer)). Again, I could be wrong, and I'm sure Derek will correct me on this.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> ------=_NextPart_000_0005_01C40FF0.91DD8CC0--
3. Re: Writing direct to printer
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Mar 22, 2004
- 365 views
----- Original Message ----- >From: Andy Drummond >Subject: Writing direct to printer > > > >I have a project whereby I need to write a log file to the printer port >as fast as it appears - but Windows only outputs anything when you >throw a page. >I have tried using the Windows routine WritePrinter() but it needs the >handle to the the printer DC, and I can't seem to get that anywhere. That's not what my documentation says. I read it that WritePrinter needs the handle to the printer; no DC is mentioned. To get that handle you need to call the API OpenPrinter(). >I use Win32Lib 59.1 and Judith's IDE to write my code - plus my own >DLL to call WritePrinter because that lives in WinSpool.lib and not in >a DLL. >Does anyone know where I can find the handle of the DC that Win32Lib >gets when you call getPrinter() in that library? I have the DC itself, but >that doesn't seem to help. I don't think I understand handles...... The DC is NOT required. -- Derek