Original Post
🔒 Locked
Printers...
Advertisement
I'm assuming here you're using C++ for Windows. If that's the case, what you need to do is get a device context to the printer. The easiest way to do this is to create a PRINTDLG structure, and use it with the PrintDlg function. See this code:
Most of this is taken more or less straight from MSDN stuff. As far as actually printing what you want to a page, you'd treat it exactly like you would to a window. Any functions like StretchBlt, FrameRect, etc., work just as they do on a window, to my experience anyway.
Hope this helps-
-Arek the Absolute
[edited by - Arek the Absolute on June 9, 2002 9:34:36 PM]
PRINTDLG pd;
memset ((void *) &pd, 0, sizeof(PRINTDLG));
pd.lStructSize = sizeof(PRINTDLG);
pd.hwndOwner = hwnd;
pd.Flags = PD_RETURNDC;
pd.hInstance = NULL;
PrintDlg(&pd);
HDC ghdc = pd.hDC;
if (pd.hDevMode)
GlobalFree (pd.hDevMode);
if (pd.hDevNames)
GlobalFree (pd.hDevNames);
DOCINFO di;
SetMapMode (ghdc, MM_TEXT);
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = "Test";
di.lpszOutput = NULL;
StartDoc(ghdc, &di);
StartPage(ghdc);
// Print your stuff here
EndPage(ghdc);
EndDoc(ghdc);
Most of this is taken more or less straight from MSDN stuff. As far as actually printing what you want to a page, you'd treat it exactly like you would to a window. Any functions like StretchBlt, FrameRect, etc., work just as they do on a window, to my experience anyway.
Hope this helps-
-Arek the Absolute
[edited by - Arek the Absolute on June 9, 2002 9:34:36 PM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement