2 Attachment(s)
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?
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.
Re: The modern print dialog issue after Windows 11 22H2 update
Quote:
Originally Posted by
fafalone
".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.
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).
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
Re: The modern print dialog issue after Windows 11 22H2 update
Quote:
Originally Posted by
cliv
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.
Re: The modern print dialog issue after Windows 11 22H2 update
Quote:
Originally Posted by
cliv
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.
Re: The modern print dialog issue after Windows 11 22H2 update
Quote:
Originally Posted by
DaveDavis
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
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
{
//
}
}