Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Context Handle of a Printer

Status
Not open for further replies.

Hurricane766

IS-IT--Management
Nov 30, 2004
34
0
0
CA
hi,
I'm wondering if it's possible to find out the windows context handle of a printer?

Thanks
 
If you want to obtain a (default) printer device context handle, you may use PrintDlg(LPPRINTDLG) Windows API function (or PrintDlgEx in modern Windows). Initialize PRINTDLG structure with Flag member value = PD_RETURNDC | PD_RETURNDEFAULT (no real dialog box in that case). The function returns default printer device context handle in hDC member of the structure.
Don't forget to initialize the structure, to handle possible errors (and to DeleteDC obtained context handle after using?).
See MSDN for details...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top