------------------------------------------------------------ [BUG/PRB.] VFP 9.0 FIX - PAGE SETUP DIALOG BOX January 2021 ------------------------------------------------------------ CCB 1. BUG: In vfp9, the Page Setup Dialog Box has no the Printer button on Windows Vista or later. There is no the bug in vfp6, vfp7 and vfp8. Please refer to the picture pagesetup9.jpg: ![]() 2. CAUSE: In vfp6, vfp7 and vfp8, it call the PrintDlgA Windows API to show the Page Setup Dialog Box. In vfp9, it call the PageSetupDlgA Windows API to show the Page Setup Dialog Box. But for some about security reasons, the Printer button has been removed on Windows Vista or later. 3. RESOLUTION: We can write some code to fix the BUG. vfpa_pagesetupdlga proc push ebp mov ebp,esp sub esp,48h push eax push ebx push ecx push edx push esi push edi pushfd mov esi,dword ptr [ebp+08h] lea edi,dword ptr [ebp-48h] xor eax,eax cld movsd sub dword ptr [edi-4],(54h-42h) movsd movsd movsd stosd movsd ; PD_PRINTSETUP (0x00000040) + PD_ENABLESETUPTEMPLATE (0x00008000) mov dword ptr [edi-4],00000040h+00008000h stosw stosw stosw stosw stosw add esi,4*2+4*4+4*4 movsd mov dword ptr [edi-4],00400000h movsd stosd movsd add esi,4 stosd movsd mov dword ptr [edi-4],0616h stosd movsd lea eax,dword ptr [ebp-48h] push eax call PrintDlgA mov dword ptr [ebp-04h],eax lea esi,dword ptr [ebp-48h] mov edi,dword ptr [ebp+08h] xor eax,eax cld movsd add dword ptr [edi-4],(54h-42h) movsd movsd movsd add esi,4 movsd ; PSD_DISABLEMARGINS (0x00000010) mov dword ptr [edi-4],00000010h add esi,2*5 add edi,4*2+4*4+4*4 movsd movsd add esi,4 movsd add edi,4 add esi,4 movsd add esi,4 movsd popfd pop edi pop esi pop edx pop ecx pop ebx pop eax mov eax,dword ptr [ebp-04h] mov esp,ebp pop ebp ret 04h vfpa_pagesetupdlga endp We can use the vfpa_pagesetupdlga() function instead of the PageSetupDlgA Windows API, then the Page Setup Dialog Box will show the Printer and Properties buttons. Please refer to the picture pagesetup.jpg: ![]() 4. APPLIES TO: VFP 9.0.0.2412 VFP 9.0.0.3504 (SP1) VFP 9.0.0.4611 (SP2) VFP 9.0.0.5015 (SP2) VFP 9.0.0.5411 (SP2) VFP 9.0.0.5721 (SP2) VFP 9.0.0.5815 (SP2) VFP 9.0.0.6303 (SP2) VFP 9.0.0.6602 (SP2) VFP 9.0.0.7423 (SP2) The bug has been fixed in VFP Advanced. 5. REFERENCE WEBSITES: 1, baiyujia.com: http://www.baiyujia.com 2, foxite.com: http://www.foxite.com/archives/sys1037-not-having-printers-button-0000158140.htm http://www.foxite.com/archives/printer-button-on-page-set-up-sys1037-0000318953.htm 3, microsoft.com: http://connect.microsoft.com/VisualStudio/feedback/details/286313/vfp-sys-1037-no-longer-has-a-printer-button-in-vista http://social.msdn.microsoft.com/Forums/en-US/adcf515c-a1f3-4dce-a2b6-b0ad8286fb42/cant-switch-printers-from-vfp 6. OTHER: For reference only, there is no guarantees. Any questions or suggestions, please send me an email at ccb2000@163.com. |