----------------------------------------------------------
                      VFP 9.0 FIX - THE DOCKED COMMAND WINDOW IS SHOWN
                                  March 2017
                 ----------------------------------------------------------
                                    CCB



1. BUG:

     In vfp9 (and vfp7, vfp8), if the Command window is dockable,
     sometimes the main Visual FoxPro window is not shown, but the docked Command window is shown.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label4352af ::
             mov  esi , dword ptr [esi]                                      ;0x004352af :        8b36
             mov  eax , dword ptr [ esi + 68 ]                               ;0x004352b1 :        8b4644
             test  byte ptr ah , 01h                                         ;0x004352b4 :        f6c401
             jne Label5aa71a                                                 ;0x004352b7 :        0f855d541700
             test al , 08h                                                   ;0x004352bd :        a808
             jne Label5aa72b                                                 ;0x004352bf :        0f8566541700


     ;
     ;                 ----------------------------------------------------------
     ;                      VFP 9.0 FIX - THE DOCKED COMMAND WINDOW IS SHOWN
     ;                                  March 2017
     ;                 ----------------------------------------------------------
     ;                                     CCB
     ;
     ; If the Command window is dockable,
     ; sometimes the main Visual FoxPro window is not shown, but the docked Command window is shown.
     ;
     ; 2017/3/5, by ccb
     ;

             cmp dword ptr [ esp + 16 ] , 05h
             jne Label4352c5

             mov eax , dword ptr [ Data93e6d0 ]
             test eax , eax
             je Label4352c5
             mov eax , dword ptr [eax]
             mov eax , dword ptr [eax]
             cmp dword ptr [esi] , eax
             jne Label4352c5

             mov eax , dword ptr [ Data937794 ]
             test eax , eax
             je Label4352c5
             mov eax , dword ptr [eax]
             mov eax , dword ptr [eax]
             push eax
             call IsWindowVisible
             test eax , eax
             je Label4352d3


     Label4352c5 ::
             mov  eax , dword ptr [ esp + 16 ]                               ;0x004352c5 :        8b442410
             mov  esi , dword ptr [esi]                                      ;0x004352c9 :        8b36
             push eax                                                        ;0x004352cb :        50
             push esi                                                        ;0x004352cc :        56
             call  ShowWindow                                  ;0x004352cd :        ff158c729100

     Label4352d3 ::
             pop edi                                                         ;0x004352d3 :        5f
             pop esi                                                         ;0x004352d4 :        5e
             pop ebp                                                         ;0x004352d5 :        5d
             pop ebx                                                         ;0x004352d6 :        5b
             pop ecx                                                         ;0x004352d7 :        59
             ret                                                             ;0x004352d8 :        c3


4. APPLIES TO:

     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 e-mail to ccb2000@163.com.