---------------------------------------------------------------------------------------------------
                      [ENHANCED] VFP 9.0 FIX - THE MAXIMUM NUMBER OF WINDOW ITEMS TO DISPLAY IN THE WINDOW MENU
                                 January 2024
                 ---------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), the maximum number of window items to display in the Window menu is 9, now it can be set to 1 to 255.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun8a74ee :: ; proc near
             push ecx                                                        ;0x008a74ee :        51
             push ebx                                                        ;0x008a74ef :        53
             push ebp                                                        ;0x008a74f0 :        55
             push esi                                                        ;0x008a74f1 :        56
             mov esi , 0FFFFA007h                                            ;0x008a74f2 :        be07a0ffff
             push edi                                                        ;0x008a74f7 :        57
             xor edx , edx                                                   ;0x008a74f8 :        33d2
             mov ecx , esi                                                   ;0x008a74fa :        8bce
             call Fun42f404                                                  ;0x008a74fc :        e8037fb8ff
             test eax , eax                                                  ;0x008a7501 :        85c0
             je Label8a75b0                                                  ;0x008a7503 :        0f84a7000000
             mov ecx , esi                                                   ;0x008a7509 :        8bce
             call Fun4173cd                                                  ;0x008a750b :        e8bdfeb6ff
             mov ebx , eax                                                   ;0x008a7510 :        8bd8
             mov edi , 0FFFFA814h                                            ;0x008a7512 :        bf14a8ffff
             jmp Label8a752f                                                 ;0x008a7517 :        eb16

     Label8a7519 ::
             push ebx                                                        ;0x008a7519 :        53
             call Fun4173b3                                                  ;0x008a751a :        e894feb6ff
             test eax , eax                                                  ;0x008a751f :        85c0
             jnl Label8a752f                                                 ;0x008a7521 :        7d0c
             cmp eax , edi                                                   ;0x008a7523 :        3bc7
             jl Label8a752f                                                  ;0x008a7525 :        7c08
             push eax                                                        ;0x008a7527 :        50
             mov ecx , esi                                                   ;0x008a7528 :        8bce
             call Fun417e11                                                  ;0x008a752a :        e8e208b7ff

     Label8a752f ::
             dec ebx                                                         ;0x008a752f :        4b
             mov ecx , esi                                                   ;0x008a7530 :        8bce
             jns Label8a7519                                                 ;0x008a7532 :        79e5
             pushd offset Data92a90c                                                  ;0x008a7534 :        680ca99200
             pushd 0FFFFFFFEh                                                ;0x008a7539 :        6afe
             push edi                                                        ;0x008a753b :        57
             call Fun78d571                                                  ;0x008a753c :        e83060eeff
             push  dword ptr [ Data937fb0 ]                                  ;0x008a7541 :        ff35b07f9300
             mov ecx , edi                                                   ;0x008a7547 :        8bcf
             pushd 00h                                                       ;0x008a7549 :        6a00
             pushd 01h                                                       ;0x008a754b :        6a01


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF WINDOW ITEMS TO DISPLAY IN THE WINDOW MENU
     ;                                February 2019
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; The maximum number of window items to display in the Window menu.
     ;
     ; 2019/2/5, by ccb
     ;

     ;         pushd 09h                                                       ;0x008a754d :        6a09
             push dword ptr vfpa_sys9011_data


             push esi                                                        ;0x008a754f :        56
             call Fun8a724e                                                  ;0x008a7550 :        e8f9fcffff
             mov ebp , eax                                                   ;0x008a7555 :        8be8


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF WINDOW ITEMS TO DISPLAY IN THE WINDOW MENU
     ;                                February 2019
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; The maximum number of window items to display in the Window menu.
     ;
     ; 2019/2/5, by ccb
     ;

     ;         cmp ebp , 09h                                                   ;0x008a7557 :        83fd09
     ;         jne Label8a7599                                                 ;0x008a755a :        753d
     ;         pushd 0Ah                                                       ;0x008a755c :        6a0a
     ;         pop ebp                                                         ;0x008a755e :        5d
             cmp ebp , dword ptr vfpa_sys9011_data
             jne Label8a7599
             mov ebp , dword ptr vfpa_sys9011_data
             inc ebp


             mov ecx , 031Fh                                                 ;0x008a755f :        b91f030000
             call Fun42c583                                                  ;0x008a7564 :        e81a50b8ff
             push eax                                                        ;0x008a7569 :        50
             pushd 0FFFFFFFEh                                                ;0x008a756a :        6afe
             mov ebx , 0FFFFA81Eh                                            ;0x008a756c :        bb1ea8ffff
             push ebx                                                        ;0x008a7571 :        53
             mov ecx , esi                                                   ;0x008a7572 :        8bce
             call Fun78d571                                                  ;0x008a7574 :        e8f85feeff
             mov ecx , 040Bh                                                 ;0x008a7579 :        b90b040000
             call Fun42c583                                                  ;0x008a757e :        e80050b8ff
             push eax                                                        ;0x008a7583 :        50
             push ebx                                                        ;0x008a7584 :        53
             mov ecx , esi                                                   ;0x008a7585 :        8bce
             call Fun51e4e9                                                  ;0x008a7587 :        e85d6fc7ff
             pushd 01312D91h                                                 ;0x008a758c :        68912d3101
             push ebx                                                        ;0x008a7591 :        53
             mov ecx , esi                                                   ;0x008a7592 :        8bce
             call Fun51e472                                                  ;0x008a7594 :        e8d96ec7ff

     Label8a7599 ::
             test ebp , ebp                                                  ;0x008a7599 :        85ed
             jle Label8a75a8                                                 ;0x008a759b :        7e0b
             mov ecx , esi                                                   ;0x008a759d :        8bce
             call Fun41c46d                                                  ;0x008a759f :        e8c94eb7ff
             test eax , eax                                                  ;0x008a75a4 :        85c0
             jne Label8a75b0                                                 ;0x008a75a6 :        7508

     Label8a75a8 ::
             push edi                                                        ;0x008a75a8 :        57
             mov ecx , esi                                                   ;0x008a75a9 :        8bce
             call Fun417e11                                                  ;0x008a75ab :        e86108b7ff

     Label8a75b0 ::
             pop edi                                                         ;0x008a75b0 :        5f
             pop esi                                                         ;0x008a75b1 :        5e
             pop ebp                                                         ;0x008a75b2 :        5d
             pop ebx                                                         ;0x008a75b3 :        5b
             pop ecx                                                         ;0x008a75b4 :        59
             ret                                                             ;0x008a75b5 :        c3


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_vfp9fix61.asp


6. OTHER:

     For reference only, there is no guarantees.

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