Hi,
I have solved my problem with the printing dll - thanks go to Markus Seitz. The reason was that I dont declare an exit point in the dll:-)
But I can only print one page. If I have more than one page, the program prints only the last page. Hope, sb can help me. I dont know, where the error is. Is the error in the rendering procedure of Lotus Notes or I have a error with calling the WIN-API.
Here is my program the notes-rendering:
printf(“\n Starte nun rendering… \n”);
error = EditorPrintNoteToBitmap(hSourceDB,
SourceNoteID,
&EPBContext);
printf(“Rendering abgeschlossen \n”);
printf(“Lösche memory-allocation”);
PrintMyPage (NULL,EPBContext.hBitmap);
// PrintMyPage(NULL,eins);
// PrintMyPage(NULL,zwei);
DeleteObject(hBrush);
DeleteObject(EPBContext.hBitmap);
DeleteDC(EPBContext.hPaint);
here the winapi-calling:
BOOL PrintMyPage (HWND hwnd, HBITMAP hBitmap)
{
int izu=0;
int seiten=0;
TEXTMETRIC tm;
int pages=0;
int yChar,iCharsPerLine, iLinesPerPage,iTotalLines,iTotalPages,iPage,iLine,iLineNum;
HDC hdcMemory;
BITMAP bitmap;
HBITMAP hOldBitmap;
PRINTDLG pd;
// alte Druckfunktion…
DOCINFO di;
int i=0;
// static DOCINFO di = { sizeof (DOCINFO), TEXT (“DRUCK”) } ;
// static DOCINFO di = { sizeof (DOCINFO), TEXT(wert)} ;
BOOL bSuccess = TRUE ;
HDC hdcPrn ;
int xPage, yPage ;
di.cbSize = sizeof(di);
di.lpszDocName = docID; //Name des Druckauftrages, wie er im Spooler erscheint
di.lpszOutput = NULL;
di.lpszDatatype = NULL;
di.fwType = NULL;
hdcPrn = GetPrinterDC (druckerName);
if (NULL ==hdcPrn )
return FALSE ;
xPage = GetDeviceCaps (hdcPrn, HORZRES) ;
yPage = GetDeviceCaps (hdcPrn, VERTRES) ;
hdcMemory = CreateCompatibleDC(hdcPrn);
GetObject(hBitmap, sizeof(BITMAP), &bitmap);
hOldBitmap= SelectObject(hdcMemory,hBitmap);
pd.Flags=PD_ALLPAGES;
pd.lStructSize = sizeof(PRINTDLG);
pd.hDevMode = NULL;
pd.hDevNames = NULL;
pd.Flags = PD_RETURNDC;
pd.nCopies = 1;
PrintDlg((LPPRINTDLG)&pd);
StartDoc (hdcPrn, &di);
StartPage(hdcPrn);
BitBlt(hdcPrn,50,50,700,700,
hdcMemory,0,0,SRCCOPY);
EndPage(hdcPrn);
EndDoc(hdcPrn);