` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Windows API: Enumerating Printers
2005-02-08 -- Lee White
 
Newsgroups: comp.lang.clarion > How can one get all printers available from print setup loaded into > a que or > table.. Windows API, EnumPrinters() http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_9fjn.asp You call it twice, once to get the memory required and printer count, then again to load that memory. Although I use HeapCreate & HeapAlloc, you should be able to create the memory by NEWing a string to the proper size. Use PRINTER_ENUM_LOCAL + PRINTER_ENUM_CONNECTIONS to get the printer list of all local printers and any network printers defined for the user. For NT/2000/XP use PRINTER_INFO_4. For '9x/Me use PRINTER_INFO_5. Once you get the memory loaded you can loop through it and use memcpy to carve out chunks to fit the size of the INFO group. The use the pointers from the group and lstrcpyn to get the information into a queue. Just be careful with your coding so you don't create any buffer overflows with lstrcpyn! And you thought this would be hard! Look around, there's probably a free template somewhere to do this for you. -- Lee White


Today is May 5, 2024, 1:23 pm
This article has been viewed 35131 times.
Google search has resulted in 25 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: