none
What is the use of IPrinterExtensionEventArgs.WindowModal property for V4 Printer Extension application? RRS feed

  • Question

  • Hello!

    I cannot understand the purpose of the WindowModal property in IPrinterExtensionEventArgs.

    In the official Printer Extension Sample I see the following piece of code:

                    //
                    // Display a modal/non-modal window based on the 'WindowModal' parameter.
                    //
    
                    if (eventArgs.WindowModal)
                    {
                        printPreferenceWindow.ShowDialog();
                    }
                    else
                    {
                        printPreferenceWindow.Show();
    
                        // Flash the window to draw the user's attention. This is required
                        // because the printer extension may be drawn behind the parent window.
                        // The return value of FlashWindow can be safely ignored if there is no need
                        // to know if the window has focus or not.
                        WindowHelper.FlashWindow(wih.Handle);
                    }
    

    But since Printer Extension is run as a separate application for each Printing Preferences window opened – is there really any difference whether to call Show or ShowDialog for the main window in the application start-up routine? Either way it will end up in a message handling loop which will quit when the main window is closed and then application will exit.

    I tried to always use ShowDialog regardless of the value of the WindowModal property and I have not noticed any difference in window behavior compared to the official way.

    Am I missing something and WindowModal can be useful in some cases?

    Best regards,

    Dmitry.

    Thursday, September 5, 2013 9:06 AM

Answers