PrintDlgEx, StartDoc, have problems when printer sends dialog box message


  • Hello,

    I use PrintDlgEx and StartDoc to print a picture.Sometimes, It prints the color picture fine. But problem occurs when the printer sends a dialog box like "Low Ink Reminder" to screen.

    I need to stop my program so that user can reply to this Dialog Box, otherwise, error develops later.   At this time, my program keeps going and ignores the Dialog Box and causes problem later. In other words, I need to know when this Dialog Box shows up and thenI can stop my program until the Dialog Box is satisfied.

    In my way of thinking, I have no information about this dialog box because it is generated by the printer, and therefore I have no handle of the dialog box

    Is there a way to know if printer is sending a dialog box?.

    Would anyone help?

    A skelton of code is shwn below: Thank you,


    hResult = PrintDlgEx(&pdx);

    hDlgPrint=CreateDialog (hInst, (LPCTSTR) "PrintDlgBox", hwnd, PrintDlgProc) ;

    SetAbortProc(pdx.hDC, AbortPrntProc) ;

    res=StartDoc (pdx.hDC, &di);

    StartPage (pdx.hDC)

    StretchDIBits(hdc,xDst,yDst,wdStretch,hdStretch,0,0,wd,hd,pBits,pbmi,DIB_RGB_COLORS,SRCCOPY) ;

    EndPage (pdx.hDC)

    EndDoc (pdx.hDC);

    chang Chi

    Thursday, January 24, 2013 6:39 PM