Print Dialog in Windows 11 << Back



Since Windows 11 22H2, Microsoft has forced all Win32 apps (including VDF/DF apps) to use the new print dialog whenever you call the API PrintDlg. Unfortunately the new print dialog doesn't seem to take the inital values according to the documentations. You can pretty much Google "Print Dialog Windows 11 Initialize" and you will find a bunch of articles like this one.

The first way to get around the problem is to do a registry hack to force Windows 11 to use the legacy print dialog.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Print\UnifiedPrintDialog]
"PreferLegacyPrintDialog"=dword:00000001

The second way is to pass NULL as the parent window handle when calling PrintDlg. Also you have to remove out the Flag PD_USEDEVMODECOPIESANDCOLLATE.

    Object oPrint is a PrintDialog
        Set Copies to 5
        Set Orientation to DMORIENT_LANDSCAPE
        Function ParentWindowHandle returns handle // Augment to return 0. This forces Windows to use the legacy print dialog for your app only.
            Function_Return 0
        End_Function
    End_Object

The third way is to wait for Microsoft to fix the API. I wouldn't hold my breath on this one.






Free Web Hosting