Results 1 to 9 of 9

Thread: The modern print dialog issue after Windows 11 22H2 update

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    609

    The modern print dialog issue after Windows 11 22H2 update

    In Windows 11 22H2, Microsoft has replaced the legacy Print Dialog for all classic (win32) apps, e.g., Notepad, WordPad, Notepad++, etc., with a new dialog. Earlier, this dialog was available only for UWP apps (aka Store apps). Also, there is a new Print Queue dialog introduced in this version.

    However, in the modern print dialog, the preview pane always shows “No preview available,” irrespective of the previewed file type. Furthermore, on some systems, the title bar reads “Printing from Win32 application” instead of the program’s name — e.g., Notepad++.

    I got another big issue: when I click the Print button, my custom print preview window or whole app going in taskbar.

    If I switch off by .UseEXDialog = False, then the print dialog is traditional style, everything is normal.

    How to solve this problem if I keep this new style Dialog?
    Attached Images Attached Images   
    Last edited by DaveDavis; Oct 8th, 2023 at 04:00 AM.

  2. #2
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: The modern print dialog issue after Windows 11 22H2 update

    ".UseEXDialog = False"

    This seems to be a .NET question. If not, clarify how you're calling it from VB6.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    609

    Re: The modern print dialog issue after Windows 11 22H2 update

    Quote Originally Posted by fafalone View Post
    ".UseEXDialog = False"

    This seems to be a .NET question. If not, clarify how you're calling it from VB6.
    Yes, I used .NET for testing.
    I just test VB6, I am using Krool's class CommonDialog.cls by calling ShowPrinterEx, the print dialog is new style, but test OK without such issue.
    Last edited by DaveDavis; Oct 8th, 2023 at 06:20 AM.

  4. #4
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: The modern print dialog issue after Windows 11 22H2 update

    Well if Krool's class works ok you can always try calling the API directly like it does instead of the .NET wrapper.

    Or make the class into a DLL (Krool has a version in twinBASIC that supports x64).

  5. #5
    Addicted Member
    Join Date
    Feb 2006
    Location
    Craiova, Romania
    Posts
    140

    Re: The modern print dialog issue after Windows 11 22H2 update

    An alternative (and definitive) solution to restore the Legacy Print Dialog
    1. Type "cmd" select Run as administrator
    Code:
    reg add "HKCU\Software\Microsoft\Print\UnifiedPrintDialog" /v "PreferLegacyPrintDialog" /d 1 /t REG_DWORD /f
    OR

    2. Add to registry
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Print\UnifiedPrintDialog]
    "PreferLegacyPrintDialog"=dword:00000001
    Last edited by cliv; Oct 9th, 2023 at 08:18 AM.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    609

    Re: The modern print dialog issue after Windows 11 22H2 update

    Quote Originally Posted by cliv View Post
    An alternative (and definitive) solution to restore the Legacy Print Dialog
    1. Type "cmd" select Run as administrator
    Code:
    reg add "HKCU\Software\Microsoft\Print\UnifiedPrintDialog" /v "PreferLegacyPrintDialog" /d 1 /t REG_DWORD /f
    OR

    2. Add to registry
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Print\UnifiedPrintDialog]
    "PreferLegacyPrintDialog"=dword:00000001
    In .NET, when I set bit .UseEXDialog = false, it also turns out a traditional style or run the exe file set "Run as Administrator".
    Also in .NET, at least, in my application, the modern print dialog cause the 2nd (underlet) window goes to foreground and foreground(my application) goes to underlet when <Print> button is being clicked.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    609

    Re: The modern print dialog issue after Windows 11 22H2 update

    Quote Originally Posted by cliv View Post
    An alternative (and definitive) solution to restore the Legacy Print Dialog
    1. Type "cmd" select Run as administrator
    Code:
    reg add "HKCU\Software\Microsoft\Print\UnifiedPrintDialog" /v "PreferLegacyPrintDialog" /d 1 /t REG_DWORD /f
    OR

    2. Add to registry
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Print\UnifiedPrintDialog]
    "PreferLegacyPrintDialog"=dword:00000001
    Thanks, We can read/write registry by temporarily set the value to 1, after app called "old style" Print Dialog, then restore original registry setting in our program.

  8. #8
    New Member
    Join Date
    Sep 2022
    Posts
    7

    Thumbs up Re: The modern print dialog issue after Windows 11 22H2 update

    Quote Originally Posted by DaveDavis View Post
    Thanks, We can read/write registry by temporarily set the value to 1, after app called "old style" Print Dialog, then restore original registry setting in our program.
    HI

    This preview line no longer advanced and stopped without continuing and it was impossible to print.

    I used this line and perfectly now I can print from my VB6 APP also with 23H2 of windows11...

    Code:
    reg add "HKCU\Software\Microsoft\Print\UnifiedPrintDialog" /v "PreferLegacyPrintDialog" /d 1 /t REG_DWORD /f
    If I wanted to restore the other mode how should I insert the line to re-enable "as WIN11 23H2 did before"?

    probably with:

    Code:
    reg delete "HKCU\Software\Microsoft\Print\UnifiedPrintDialog" /v "PreferLegacyPrintDialog" /f
    Thanks
    Last edited by ApipApip; May 19th, 2024 at 11:13 AM.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    609

    Re: The modern print dialog issue after Windows 11 22H2 update

    Code:
    bool bReginstryModified = ReadWriteReginstryForPrintDialogSetting();
    DialogResult dialogResult = printDialog.ShowDialog();
    if (bReginstryModified )
    {
          RestoreReginstryForLegacyPrintDialog();
    }    
    
    private bool ReadWriteReginstryForPrintDialogSetting() 
            {
                try
                {
                    RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\\\Microsoft\\\\Print\\\\UnifiedPrintDialog", true);
                    if (registryKey != null)
                    {
                        int num = Convert.ToInt32(registryKey.GetValue("PreferLegacyPrintDialog"));
                        if (num == 1)
                        {
                            registryKey.Close();
                            registryKey.Dispose();
                            registryKey = null;
                            return false;
                        }
                    }
                    else
                    {
                        registryKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\\\Microsoft\\\\Print\\\\UnifiedPrintDialog");
                        if (registryKey == null)
                        {
                            return false;
                        }
                    }
                    registryKey.SetValue("PreferLegacyPrintDialog", 1, RegistryValueKind.DWord);
                    registryKey.Close();
                    registryKey.Dispose();
                    registryKey = null;
                    return true;
                }
                catch
                {
                    //
                }
                return false;
            }
    
            private void RestoreReginstryForLegacyPrintDialog() 
            {
                try
                {
                    RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\\\Microsoft\\\\Print\\\\UnifiedPrintDialog", true);
                    if (registryKey != null)
                    {
                        registryKey.SetValue("PreferLegacyPrintDialog", 0, RegistryValueKind.DWord);
                        registryKey.Close();
                        registryKey.Dispose();
                        registryKey = null;
                    }
                }
                catch
                {
                    //
                }
            }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width