wdDialogFilePrint printer settings dialog gets hidden behind application. Can I make this modal or grab focus on display? RRS feed

  • Question

  • I am trying to programatically display the Word printer settings dialog (wdDialogFilePrint) from my C# application using Word Interop. The problem is that it takes a little time for the dialog to appear, during which users may click around the screen. If my application is maximised, this means that the dialog is lost behind it and the application looks like it's hung.


    My questions are:

    • Is there any way I can launch this modally from within my application so that it doesn't lose focus?
    • Is there a way I can grab the print settings dialog window and bring it t front once it's loaded (e.g. using win32 or something)?
    • Is there a better way I can launch the Word printer dialog so I don't have this problem?


    This is how we're currently launching the dialog:


    Word.Dialog printWordDialog = currentLoadedDocument.Application.Dialogs[Microsoft.Office.Interop.Word.WdWordDialog.wdDialogFilePrint];
    						InvokePrintDialogHelper(printWordDialog, "Printer", template.PrinterSettings.PrinterSettings.PrinterName);
    						InvokePrintDialogHelper(printWordDialog, "OutputPrinter", template.PrinterSettings.PrinterSettings.PrinterName);
    						InvokePrintDialogHelper(printWordDialog, "NumCopies", template.PrinterSettings.PrinterSettings.Copies.ToString());
    						//show print dialog
    						int dialogResult = printWordDialog.Show(ref objMissing);
    						if (dialogResult == 1) {
    							printed = true;
    							MessageBox.Show(Constants.UI.PrintingCompleteDescription, Constants.UI.PrintingCompleteTitle, MessageBoxButtons.OK);


    Thursday, January 20, 2011 9:43 AM

All replies