-------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - THE TOP LEVEL FORM CAPTION DISAPPEARED
                                 January 2024
                 -------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), sometimes the top level form (ShowWindow=2) caption disappeared on Windows 10.
     In VFP Advanced, it will ALWAYS send the WM_NCPAINT message to the window to display the top level form (ShowWindow=2) caption.

     The bug only occurs on Windows 10, it does not occur on early Windows XP, Windows Vista, Windows 7, Windows 8 and Windows 8.1.

     The bug was reported by Yousfi Benameur.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label5566dd ::


     ;
     ;                 --------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE TOP LEVEL FORM CAPTION DISAPPEARED
     ;                                  April 2017
     ;                 --------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, sometimes the top level form (ShowWindow=2) caption disappeared on Windows 10.
     ; In VFP Advanced, it will ALWAYS send the WM_NCPAINT message to the window to display the top level form (ShowWindow=2) caption.
     ;
     ; 2017/4/2, by ccb
     ;

             push 0FFFFFFF0h
             push dword ptr [ ebp + 0E4h ]
             call GetWindowLongA
             ; WS_CHILD (0x40000000)
             test eax , 40000000h
             je Label5566e9


             mov  eax , dword ptr [edi]                                      ;0x005566dd :        8b07
             test  byte ptr [ eax + 68 ] , 01h                               ;0x005566df :        f6404401
             je Label42e744                                                  ;0x005566e3 :        0f845b80edff

     Label5566e9 ::
             push esi                                                        ;0x005566e9 :        56
             push  dword ptr [ ebp + 0ECh ]                                  ;0x005566ea :        ffb5ec000000
             pushd 085h                                                      ;0x005566f0 :        6885000000
             push  dword ptr [ ebp + 0E4h ]                                  ;0x005566f5 :        ffb5e4000000
             call  DefWindowProcA                              ;0x005566fb :        ff1520739100
             xor edx , edx                                                   ;0x00556701 :        33d2
             mov ecx , edi                                                   ;0x00556703 :        8bcf
             call Fun43506d                                                  ;0x00556705 :        e863e9edff
             jmp Label42e744                                                 ;0x0055670a :        e93580edff


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


6. OTHER:

     For reference only, there is no guarantees.

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