Original Post
Okay, I wrote a simple program a while ago that prints simple black and white boxes, as well as some text, onto paper. I got it working absolutely fine on my computer, but I had two other people try it out on theirs, and it doesn't work for them. It pops up the dialog from PrintDlg, but after that, it doesn't start printing, or pop up the printer's standard progress dialog, etc. Unfortunately, as I said, it works fine on my computer, so I'm having real problems finding out what's wrong. I'll put up the source for the printing, and maybe someone will be able to point out what's up... I did trim it down, so you don't have to plow through all the stuff about reading in variables from edit boxes and all that. I don't think that's the source of the problem, but if you think it is I'll post that too. Thanks in advance!
-Arek the Absolute
[edited by - Arek the Absolute on June 13, 2002 5:33:52 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);
ghdc = pd.hDC;
if (pd.hDevMode)
GlobalFree (pd.hDevMode);
if (pd.hDevNames)
GlobalFree (pd.hDevNames);
DOCINFO di;
RECT rect;
HPEN pen = CreatePen(PS_SOLID,5,RGB(0,0,0));
SelectObject(ghdc,pen);
HBRUSH hbr = CreateHatchBrush(HS_VERTICAL,RGB(255,255,255));
SelectObject(ghdc,hbr);
SetTextColor(ghdc,RGB(0,0,0));
SetMapMode (ghdc, MM_TEXT);
rect.top = 0;
rect.left = 0;
rect.right = GetDeviceCaps (ghdc, HORZRES);
rect.bottom = GetDeviceCaps (ghdc, VERTRES);
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = "Test";
di.lpszOutput = NULL;
RECT pagerect = rect;
StartDoc(ghdc, &di);
StartPage(ghdc);
// this is where I was printing, using only the DrawText and
// LineTo functions, if that makes a difference
EndPage(ghdc);
EndDoc(ghdc);
DeleteDC(ghdc);