-------------------------------------------------
                      VFP 9.0 FIX - THE PRINT PREVIEW TOOLBAR
                                 January 2019
                 -------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), it will ALWAYS show the Print Preview toolbar.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun62673d :: ; proc near
             push ecx                                                        ;0x0062673d :        51
             push edi                                                        ;0x0062673e :        57
             mov edi , 0FFFFBC00h                                            ;0x0062673f :        bf00bcffff
             push edi                                                        ;0x00626744 :        57
             call Fun49ec74                                                  ;0x00626745 :        e82a85e7ff
             test eax , eax                                                  ;0x0062674a :        85c0
             jne Label626799                                                 ;0x0062674c :        754b
             mov ecx , 0915h                                                 ;0x0062674e :        b915090000
             call Fun42c583                                                  ;0x00626753 :        e82b5ee0ff


     ;
     ;                 -------------------------------------------------
     ;                      VFP 9.0 FIX - THE PRINT PREVIEW TOOLBAR
     ;                                 October 2018
     ;                 -------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, it will ALWAYS show the Print Preview toolbar.
     ; In VFP Advanced, it can show or hide the Print Preview toolbar.
     ;
     ; 2018/10/9, by ccb
     ;

             mov dword ptr vfpa_showprintpreview_iscreatewindow,01h
             mov dword ptr vfpa_showprintpreview_hwnd,00h


             push eax                                                        ;0x00626758 :        50
             mov edx , 024Dh                                                 ;0x00626759 :        ba4d020000
             mov ecx , edi                                                   ;0x0062675e :        8bcf
             call Fun40f96f                                                  ;0x00626760 :        e80a92deff  \r\n	


     ;
     ;                 -------------------------------------------------
     ;                      VFP 9.0 FIX - THE PRINT PREVIEW TOOLBAR
     ;                                 October 2018
     ;                 -------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, it will ALWAYS show the Print Preview toolbar.
     ; In VFP Advanced, it can show or hide the Print Preview toolbar.
     ;
     ; 2018/10/9, by ccb
     ;

             mov dword ptr vfpa_showprintpreview_iscreatewindow,00h


             pushd 01h                                                       ;0x00626765 :        6a01
             mov eax , 01000h                                                ;0x00626767 :        b800100000
             call Fun41114e                                                  ;0x0062676c :        e8dda9deff
             cmp  dword ptr [ esp + 12 ] , 00h                               ;0x00626771 :        837c240c00
             jne Label62678d                                                 ;0x00626776 :        7515
             pushd 0800h                                                     ;0x00626778 :        6800080000
             call Fun43b78b                                                  ;0x0062677d :        e80950e1ff
             test eax , eax                                                  ;0x00626782 :        85c0
             je Label62678d                                                  ;0x00626784 :        7407
             call Fun8f8dba                                                  ;0x00626786 :        e82f262d00
             jmp Label626799                                                 ;0x0062678b :        eb0c

     Label62678d ::


     ;
     ;                 -------------------------------------------------
     ;                      VFP 9.0 FIX - THE PRINT PREVIEW TOOLBAR
     ;                                 October 2018
     ;                 -------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, it will ALWAYS show the Print Preview toolbar.
     ; In VFP Advanced, it can show or hide the Print Preview toolbar.
     ;
     ; 2018/10/9, by ccb
     ;

             mov dword ptr vfpa_showprintpreview_isshowwindow,01h


             xor edx , edx                                                   ;0x0062678d :        33d2
             pushd 00h                                                       ;0x0062678f :        6a00
             inc edx                                                         ;0x00626791 :        42
             mov ecx , edi                                                   ;0x00626792 :        8bcf
             call Fun8f890c                                                  ;0x00626794 :        e873212d00


     ;
     ;                 -------------------------------------------------
     ;                      VFP 9.0 FIX - THE PRINT PREVIEW TOOLBAR
     ;                                 October 2018
     ;                 -------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, it will ALWAYS show the Print Preview toolbar.
     ; In VFP Advanced, it can show or hide the Print Preview toolbar.
     ;
     ; 2018/10/9, by ccb
     ;

             mov dword ptr vfpa_showprintpreview_isshowwindow,00h
             mov dword ptr vfpa_showprintpreview_hwnd,00h


     Label626799 ::
             pop edi                                                         ;0x00626799 :        5f
             pop ecx                                                         ;0x0062679a :        59
             ret 04h                                                         ;0x0062679b :        c20400

     Now In VFP Advanced, it can show or hide the Print Preview toolbar.

     In vfp9 and VFP Advanced, if we set ReportBehavior 90,
     we can also use the ReportPreview.ToolbarIsVisible property to show or hide the Print Preview toolbar.


4. APPLIES TO:

     VFP 6.0.8167.0
     VFP 6.0.8961.0 (SP5)

     VFP 7.0.0.9262
     VFP 7.0.0.9465 (SP1)

     VFP 8.0.0.2521
     VFP 8.0.0.3117 (SP1)

     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
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix50.asp

     2, foxite.com:
     https://www.foxite.com/archives/hiding-print-preview-toolbar-0000050256.htm
     https://www.foxite.com/archives/code-in-displaying-print-preview-toolbr-0000028805.htm


6. OTHER:

     For reference only, there is no guarantees.

     Any questions or suggestions, please send me an email at ccb2000@163.com.