?
Danke für die Beispiellinks
So drucke ich:
aber es geht nicht über USB
/* 2*/ {
/* 3*/ DOCINFO di;
/* 4*/ HDC hdcMemory;
/* 5*/ HBITMAP hBitmap,hOldBitmap;
/* 6*/ BITMAP Bitmap;
/* 7*/
/* 8*/ pd.lStructSize = sizeof(PRINTDLG);
/* 9*/ pd.hwndOwner = hWnd;
/* 10*/ pd.hDevMode = NULL;
/* 11*/ pd.hDevNames = NULL;
/* 12*/ pd.Flags = PD_RETURNDC;
/* 13*/ pd.nCopies = 1;
/* 14*/
/* 15*/ di.cbSize=sizeof(DOCINFO);
/* 16*/ di.lpszDocName="Test";
/* 17*/ di.lpszOutput=NULL;
/* 18*/
/* 19*/ hdcMemory = CreateCompatibleDC(pd.hDC);
/* 20*/ hBitmap = LoadBitmap(hInst,"Bild");
/* 21*/ GetObject(hBitmap, sizeof(BITMAP), &Bitmap);
/* 22*/ hOldBitmap= SelectObject(hdcMemory,hBitmap);
/* 23*/
/* 24*/ PrintDlg((LPPRINTDLG)&pd);
/* 25*/ StartDoc(pd.hDC,&di);
/* 26*/ StartPage(pd.hDC);
/* 27*/ TextOut(pd.hDC,50,50,"TESTDRUCK",9);
/* 28*/ Rectangle(pd.hDC,50,90,625,105);
/* 29*/ EndPage(pd.hDC);
/* 30*/ StartPage(pd.hDC);
/* 31*/ BitBlt(pd.hDC,50,50,Bitmap.bmWidth,Bitmap.bmHeight,
/* 32*/ hdcMemory,0,0,SRCCOPY);
/* 33*/ EndPage(pd.hDC);
/* 34*/ EndDoc(pd.hDC);
/* 35*/
/* 36*/ DeleteDC(pd.hDC);
/* 37*/ SelectObject(hdcMemory, hOldBitmap);
/* 38*/ DeleteDC(hdcMemory);
/* 39*/ DeleteObject(hBitmap);
/* 40*/
/* 41*/ if (pd.hDevMode != NULL) GlobalFree(pd.hDevMode);
/* 42*/ if (pd.hDevNames != NULL) GlobalFree(pd.hDevNames);
/* 43*/ }