Well, you can research the EnumPrinters function, it takes either a PRINTER_INFO_4 or a PRINTER_INFO_5 structure, but you can get local or default printer names with this function.
Call it once to obtain the size of the structure it needs, and again to actually fill it.
here's a snippet.
EnumPrinters( PRINTER_ENUM_LOCAL,, NULL, 4, NULL, 0, &dwNeeded, &dwReturned );
Get the size of the things you need for the structure.
dwNeeded, and dwRetured are both defined as DWORD values.
PRINTER_INFO_4 * pinfo4; //used for windows NT.
pinfo4 = malloc( dwNeeded );
EnumPrinters( PRINTER_ENUM_LOCAL, NULL, 4, (PBYTE) pinfo4,
dwNeeded, &dwNeeded, &dwRetured );
Fill the actual structure.
then, put it in an hdc..
hdc = CreateDC( NULL, pinfo4->pPrinterName, NULL, NULL );
free( pinfo4 );
now if you were to wrap this up into a function, you can
call it from a part of another window's program, say...
HDC hdcPrn;
if( NULL == (hdcPrn = GetPrinterDC( ) ) )
return FALSE;
this will populate your hdcPrn with the values you obtained by using that function to get your printer name/values, etc.
then you can
if( StartDoc( hdcPrn .....
hope this is what you were asking
The weevil of doooooooooom
-The eagle may soar, but the weasel never gets sucked up by a jet engine (Anonymous)