Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] View/Pro and accessing Windows Printer API (gdi32.dll)

From: amicom:sonic at: 27-Jun-2002 9:31

Hello All! I am looking to add native printing support to my REBOL applications for Windows, but I am running into a problem with the library component of View/Pro. Here's the story: The following has C source code for sending raw data to a printer on Windows. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_93g2.asp Converting it to View/Pro was going well until I hit the OpenPrinter routine!. Here's a transcript of my efforts:
>> gdi32: load/library %gdi32.dll >> startdoc: make routine! ["Start Document" hdc [string!] docinfo
[struct! [cbsize [int] lpszdocname [string!] lpszoutput [string!] lpszdatatype [string!] fwtype [int]]] return: [int]] gdi32 "StartDocA" ;So far, so good...
>> openprinter: make routine! ["Open Printer" pprintername [string!]
phprinter [string!] pdefault [string!] return: [integer!]] gdi32 "OpenPrinterA" ** Access Error: Cannot open OpenPrinterA ** Near: openprinter: make routine! ["Open Printer" pprintername [string!] phprinter [string!] pdefault [string!] return: [integer!]] gdi32 OK, maybe OpenPrinterA is not the correct name, let's see:
>> gdi32: read %/c/windows/system/gdi32.dll >> find gdi32 "OpenPrinter"
== {OpenPrinterA^@^@^@^@WritePrinter^@^@^@^@OPENGL32^@^@^@^@wglChoosePixelFormat^@^@^@^@wglDescribePixelFormat^@^@wglGetPixelFormat... OpenPrinterA is the correct name...AARGH! What's the deal? Anyone have any ideas on this? Am I overlooking something? I'm planning to release the REBOL Windows printer functionality to the community once it is working because dumping raw data to LPT1: isn't usually the most desirable method of printing. My plans are to get the raw printing through GDI working first, and then making it more like the integrated printing features in Windows complete with bitmap printing support, etc. The URL listed above has complete details on how to do this (in C). Anyone willing to work with me on this project will be welcomed enthusiastically! Bohdan "Bo" Lechnowsky Lechnowsky Technical Consulting REBOL/IOS Value Added Reseller Specializing in solutions using REBOL