DECLARE CreateDC IN Win32API INTEGER, STRING @, INTEGER, INTEGER nMyhDC = CreateDC(0,cWindowsPrinterName,0,0)This returns a usable device context that can be used to reference a printer. When you have finished working with the printer in the specific context you used the hDC for, you should release it with DeleteDC()
DECLARE SHORT DeleteDC IN WIN32API INTEGER =DeleteDC(nMyhDC)The MSDN library covers device contexts in great detail. The VB docs cover the device context from the perspective of the VB Printer Object - Dan Appleman's book on the Win32 API for VB Programmers gives a much more concise and understandable discussion, albeit using VB syntax, but the differences from your POV are completely trivial. You can obtain the name of the printer from the array returned by APRINTERS(), GETPRINTER(), etc.