--------------------------------------------------------------------------------------------
                      [ENHANCED] VFP 9.0 FIX - THE DIRECTION OF THE LIST PORTION OF THE COMBOBOX CONTROL
                                 January 2024
                 --------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), for the combobox control, after the drop-down arrow is clicked,
     the list portion is shown above or below the combobox control automatically,
     now we we can set the list portion is always shown above the combobox control,
     or the list portion is always shown below the combobox control.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun6d620f :: ; proc near
             push ebp                                                        ;0x006d620f :        55
             mov ebp , esp                                                   ;0x006d6210 :        8bec
             sub esp , 01Ch                                                  ;0x006d6212 :        83ec1c
             mov  ecx , dword ptr [ ebp + 12 ]                               ;0x006d6215 :        8b4d0c
             push ebx                                                        ;0x006d6218 :        53
             push esi                                                        ;0x006d6219 :        56
             mov ebx , eax                                                   ;0x006d621a :        8bd8
             call Fun4173cd                                                  ;0x006d621c :        e8ac11d4ff
             xor esi , esi                                                   ;0x006d6221 :        33f6
             cmp eax , esi                                                   ;0x006d6223 :        3bc6
             mov  dword ptr [ ebp - 8 ] , eax                                ;0x006d6225 :        8945f8
             je Label6d64a3                                                  ;0x006d6228 :        0f8475020000
             mov  ecx , dword ptr [ ebp + 12 ]                               ;0x006d622e :        8b4d0c
             xor edx , edx                                                   ;0x006d6231 :        33d2
             inc edx                                                         ;0x006d6233 :        42
             call Fun42f404                                                  ;0x006d6234 :        e8cb91d5ff
             mov  dword ptr [ ebp - 4 ] , eax                                ;0x006d6239 :        8945fc
             mov eax ,  dword ptr [ Data939528 ]                             ;0x006d623c :        a128959300
             cmp eax , 01h                                                   ;0x006d6241 :        83f801
             je Label6d626a                                                  ;0x006d6244 :        7424
             cmp eax , esi                                                   ;0x006d6246 :        3bc6
             je Label6d626a                                                  ;0x006d6248 :        7420
             push  dword ptr [ ebp + 24 ]                                    ;0x006d624a :        ff7518
             mov  eax , dword ptr [ ebp + 20 ]                               ;0x006d624d :        8b4514
             push  dword ptr [ ebp + 28 ]                                    ;0x006d6250 :        ff751c
             push  dword ptr [ ebp - 8 ]                                     ;0x006d6253 :        ff75f8
             push  dword ptr [ ebp + 16 ]                                    ;0x006d6256 :        ff7510
             push  dword ptr [ ebp + 12 ]                                    ;0x006d6259 :        ff750c
             push ebx                                                        ;0x006d625c :        53
             push  dword ptr [ ebp + 8 ]                                     ;0x006d625d :        ff7508
             call Fun6d6036                                                  ;0x006d6260 :        e8d1fdffff
             jmp Label6d64a3                                                 ;0x006d6265 :        e939020000

     Label6d626a ::
             mov  eax , dword ptr [ ebp - 4 ]                                ;0x006d626a :        8b45fc
             push edi                                                        ;0x006d626d :        57
             mov  edi , dword ptr [ ebp + 16 ]                               ;0x006d626e :        8b7d10
             call Fun41ba03                                                  ;0x006d6271 :        e88d57d4ff
             cmp eax , 0FFFFFFFFh                                            ;0x006d6276 :        83f8ff
             jne Label6d628a                                                 ;0x006d6279 :        750f
             mov  ecx , dword ptr [ ebp - 4 ]                                ;0x006d627b :        8b4dfc
             xor edx , edx                                                   ;0x006d627e :        33d2
             call Fun43de2a                                                  ;0x006d6280 :        e8a57bd6ff
             mov  eax , dword ptr [eax]                                      ;0x006d6285 :        8b00
             mov  dword ptr [ ebp + 16 ] , eax                               ;0x006d6287 :        894510

     Label6d628a ::
             mov  edi , dword ptr [ ebp - 4 ]                                ;0x006d628a :        8b7dfc
             call Fun78b845                                                  ;0x006d628d :        e8b3550b00
             cmp  dword ptr [ ebp + 24 ] , esi                               ;0x006d6292 :        397518
             jne Label6d62a2                                                 ;0x006d6295 :        750b
             xor ecx , ecx                                                   ;0x006d6297 :        33c9
             push esi                                                        ;0x006d6299 :        56
             inc ecx                                                         ;0x006d629a :        41
             xor eax , eax                                                   ;0x006d629b :        33c0
             call Fun544cfe                                                  ;0x006d629d :        e85ceae6ff

     Label6d62a2 ::
             mov  eax , dword ptr [ ebp - 4 ]                                ;0x006d62a2 :        8b45fc
             push esi                                                        ;0x006d62a5 :        56
             push esi                                                        ;0x006d62a6 :        56
             lea esi ,  dword ptr [ ebp - 28 ]                               ;0x006d62a7 :        8d75e4
             call Fun437e58                                                  ;0x006d62aa :        e8a91bd6ff
             mov  eax , dword ptr [ ebp - 16 ]                               ;0x006d62af :        8b45f0
             sub  eax , dword ptr [ ebp - 24 ]                               ;0x006d62b2 :        2b45e8
             mov  edi , dword ptr [ ebp + 16 ]                               ;0x006d62b5 :        8b7d10
             mov  dword ptr [ ebp + 12 ] , eax                               ;0x006d62b8 :        89450c
             mov  eax , dword ptr [ ebp - 20 ]                               ;0x006d62bb :        8b45ec
             sub  eax , dword ptr [ ebp - 28 ]                               ;0x006d62be :        2b45e4
             mov  dword ptr [ ebp + 28 ] , eax                               ;0x006d62c1 :        89451c
             mov  eax , dword ptr [ ebp - 4 ]                                ;0x006d62c4 :        8b45fc
             call Fun41ba03                                                  ;0x006d62c7 :        e83757d4ff
             push eax                                                        ;0x006d62cc :        50
             mov  eax , dword ptr [ ebp - 4 ]                                ;0x006d62cd :        8b45fc
             call Fun78dc34                                                  ;0x006d62d0 :        e85f790b00
             mov  esi , dword ptr [ ebp - 16 ]                               ;0x006d62d5 :        8b75f0
             sub  esi , dword ptr [ ebp - 24 ]                               ;0x006d62d8 :        2b75e8
             xor edi , edi                                                   ;0x006d62db :        33ff
             cmp  dword ptr [ ebp + 32 ] , edi                               ;0x006d62dd :        397d20
             jg Label6d62ea                                                  ;0x006d62e0 :        7f08
             mov eax ,  dword ptr [ Data94571c ]                             ;0x006d62e2 :        a11c579400
             mov  dword ptr [ ebp + 32 ] , eax                               ;0x006d62e7 :        894520

     Label6d62ea ::
             cmp  dword ptr [ ebp + 24 ] , edi                               ;0x006d62ea :        397d18
             jne Label6d62fe                                                 ;0x006d62ed :        750f
             mov  eax , dword ptr [ ebp - 8 ]                                ;0x006d62ef :        8b45f8
             mov  ecx , dword ptr [ ebp + 32 ]                               ;0x006d62f2 :        8b4d20
             cmp ecx , eax                                                   ;0x006d62f5 :        3bc8
             jnl Label6d6304                                                 ;0x006d62f7 :        7d0b
             mov  dword ptr [ ebp + 12 ] , ecx                               ;0x006d62f9 :        894d0c
             jmp Label6d6307                                                 ;0x006d62fc :        eb09

     Label6d62fe ::
             mov  eax , dword ptr [ ebp + 12 ]                               ;0x006d62fe :        8b450c
             cdq                                                             ;0x006d6301 :        99
             idiv esi                                                        ;0x006d6302 :        f7fe

     Label6d6304 ::
             mov  dword ptr [ ebp + 12 ] , eax                               ;0x006d6304 :        89450c

     Label6d6307 ::
             mov  eax , dword ptr [ ebp + 20 ]                               ;0x006d6307 :        8b4514
             mov  eax , dword ptr [ eax + 12 ]                               ;0x006d630a :        8b400c
             mov  dword ptr [ ebx + 4 ] , eax                                ;0x006d630d :        894304
             mov  eax , dword ptr [ ebp + 12 ]                               ;0x006d6310 :        8b450c
             cmp  dword ptr [ ebp - 8 ] , eax                                ;0x006d6313 :        3945f8
             je Label6d634a                                                  ;0x006d6316 :        7432
             mov  edi , dword ptr [ ebp + 16 ]                               ;0x006d6318 :        8b7d10
             mov  eax , dword ptr [ ebp - 4 ]                                ;0x006d631b :        8b45fc
             call Fun41ba03                                                  ;0x006d631e :        e8e056d4ff
             mov  ecx , dword ptr [ ebp + 12 ]                               ;0x006d6323 :        8b4d0c
             mov  dword ptr [ ebp + 24 ] , eax                               ;0x006d6326 :        894518
             mov  eax , dword ptr [ ebp - 8 ]                                ;0x006d6329 :        8b45f8
             cmp eax , ecx                                                   ;0x006d632c :        3bc1
             mov edx , eax                                                   ;0x006d632e :        8bd0
             jl Label6d6334                                                  ;0x006d6330 :        7c02
             mov edx , ecx                                                   ;0x006d6332 :        8bd1

     Label6d6334 ::
             mov edi , eax                                                   ;0x006d6334 :        8bf8
             sub edi , edx                                                   ;0x006d6336 :        2bfa
             cmp  dword ptr [ ebp + 24 ] , edi                               ;0x006d6338 :        397d18
             jl Label6d634d                                                  ;0x006d633b :        7c10
             cmp eax , ecx                                                   ;0x006d633d :        3bc1
             jnl Label6d6343                                                 ;0x006d633f :        7d02
             mov ecx , eax                                                   ;0x006d6341 :        8bc8

     Label6d6343 ::
             sub eax , ecx                                                   ;0x006d6343 :        2bc1
             mov  dword ptr [ ebp + 24 ] , eax                               ;0x006d6345 :        894518
             jmp Label6d634d                                                 ;0x006d6348 :        eb03

     Label6d634a ::
             mov  dword ptr [ ebp + 24 ] , edi                               ;0x006d634a :        897d18

     Label6d634d ::
             mov  ecx , dword ptr [ ebp + 24 ]                               ;0x006d634d :        8b4d18
             mov  edi , dword ptr [ ebp + 12 ]                               ;0x006d6350 :        8b7d0c
             mov  edx , dword ptr [ ebp - 4 ]                                ;0x006d6353 :        8b55fc
             mov  edx , dword ptr [edx]                                      ;0x006d6356 :        8b12
             lea eax ,  dword ptr [ ecx + edi ]                              ;0x006d6358 :        8d0439
             cmp  eax , dword ptr [ edx + 68 ]                               ;0x006d635b :        3b4244
             mov  dword ptr [ ebp - 12 ] , eax                               ;0x006d635e :        8945f4
             jle Label6d6368                                                 ;0x006d6361 :        7e05
             imul edi , esi                                                  ;0x006d6363 :        0faffe
             jmp Label6d6392                                                 ;0x006d6366 :        eb2a

     Label6d6368 ::
             xor edi , edi                                                   ;0x006d6368 :        33ff
             cmp ecx , eax                                                   ;0x006d636a :        3bc8
             mov  dword ptr [ ebp + 32 ] , ecx                               ;0x006d636c :        894d20
             jnl Label6d6392                                                 ;0x006d636f :        7d21

     Label6d6371 ::
             push  dword ptr [ ebp + 32 ]                                    ;0x006d6371 :        ff7520
             mov  eax , dword ptr [ ebp - 4 ]                                ;0x006d6374 :        8b45fc
             lea esi ,  dword ptr [ ebp - 28 ]                               ;0x006d6377 :        8d75e4
             call Fun78dc34                                                  ;0x006d637a :        e8b5780b00
             mov  eax , dword ptr [ ebp - 16 ]                               ;0x006d637f :        8b45f0
             sub  eax , dword ptr [ ebp - 24 ]                               ;0x006d6382 :        2b45e8
             add edi , eax                                                   ;0x006d6385 :        03f8
             inc  dword ptr [ ebp + 32 ]                                     ;0x006d6387 :        ff4520
             mov  eax , dword ptr [ ebp + 32 ]                               ;0x006d638a :        8b4520
             cmp  eax , dword ptr [ ebp - 12 ]                               ;0x006d638d :        3b45f4
             jl Label6d6371                                                  ;0x006d6390 :        7cdf

     Label6d6392 ::
             mov eax ,  dword ptr [ Data93a8b8 ]                             ;0x006d6392 :        a1b8a89300
             lea esi ,  dword ptr [ ebp - 28 ]                               ;0x006d6397 :        8d75e4
             mov  dword ptr [ ebp + 32 ] , eax                               ;0x006d639a :        894520
             call Fun425c32                                                  ;0x006d639d :        e890f8d4ff
             test eax , eax                                                  ;0x006d63a2 :        85c0
             jne Label6d63af                                                 ;0x006d63a4 :        7509
             mov  eax , dword ptr [ ebp - 24 ]                               ;0x006d63a6 :        8b45e8
             sub  eax , dword ptr [ ebp - 16 ]                               ;0x006d63a9 :        2b45f0
             add  dword ptr [ ebp + 32 ] , eax                               ;0x006d63ac :        014520

     Label6d63af ::
             mov  eax , dword ptr [ ebx + 4 ]                                ;0x006d63af :        8b4304
             mov  ecx , dword ptr [ ebp + 8 ]                                ;0x006d63b2 :        8b4d08
             add eax , edi                                                   ;0x006d63b5 :        03c7
             mov  dword ptr [ ebx + 12 ] , eax                               ;0x006d63b7 :        89430c
             mov  ecx , dword ptr [ecx]                                      ;0x006d63ba :        8b09
             mov  ecx , dword ptr [ ecx + 0A8h ]                             ;0x006d63bc :        8b89a8000000
             add ecx , eax                                                   ;0x006d63c2 :        03c8


     ;
     ;                 ---------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE DIRECTION OF THE LIST PORTION OF THE COMBOBOX CONTROL
     ;                                February 2019
     ;                 ---------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; The direction of the list portion of the combobox control.
     ;
     ; 2019/2/18, by ccb
     ;

             cmp dword ptr vfpa_sys9012_data,01h
             je Label6d63da
             cmp dword ptr vfpa_sys9012_data,02h
             je Label6d63c7


             cmp  ecx , dword ptr [ ebp + 32 ]                               ;0x006d63c4 :        3b4d20
             jl Label6d63da                                                  ;0x006d63ca :        7c0e

     Label6d63c7 ::
             mov  ecx , dword ptr [ ebp + 20 ]                               ;0x006d63c7 :        8b4d14
             mov  eax , dword ptr [ ecx + 4 ]                                ;0x006d63cc :        8b4104
             sub eax , edi                                                   ;0x006d63cf :        2bc7
             dec eax                                                         ;0x006d63d1 :        48
             mov  dword ptr [ ebx + 4 ] , eax                                ;0x006d63d2 :        894304
             add eax , edi                                                   ;0x006d63d5 :        03c7
             mov  dword ptr [ ebx + 12 ] , eax                               ;0x006d63d7 :        89430c

     Label6d63da ::
             mov  ecx , dword ptr [ ebp + 20 ]                               ;0x006d63c7 :        8b4d14
             mov  eax , dword ptr [ ecx + 8 ]                                ;0x006d63da :        8b4108
             mov  edx , dword ptr [ecx]                                      ;0x006d63dd :        8b11
             mov esi , eax                                                   ;0x006d63df :        8bf0
             sub esi , edx                                                   ;0x006d63e1 :        2bf2
             lea edx ,  dword ptr [ esi - 2 ]                                ;0x006d63e3 :        8d56fe
             cmp  edx , dword ptr [ ebp + 28 ]                               ;0x006d63e6 :        3b551c
             jle Label6d63ee                                                 ;0x006d63e9 :        7e03
             mov  dword ptr [ ebp + 28 ] , edx                               ;0x006d63eb :        89551c

     Label6d63ee ::
             mov  edx , dword ptr [ ebp + 8 ]                                ;0x006d63ee :        8b5508
             mov  edx , dword ptr [edx]                                      ;0x006d63f1 :        8b12
             mov  esi , dword ptr [ edx + 0ACh ]                             ;0x006d63f3 :        8bb2ac000000
             add  esi , dword ptr [ecx]                                      ;0x006d63f9 :        0331
             mov  edx , dword ptr [ ebp + 28 ]                               ;0x006d63fb :        8b551c
             add esi , edx                                                   ;0x006d63fe :        03f2
             cmp  esi , dword ptr [ Data93a810 ]                             ;0x006d6400 :        3b3510a89300
             jl Label6d6429                                                  ;0x006d6406 :        7c21
             mov  ecx , dword ptr [ ebp + 8 ]                                ;0x006d6408 :        8b4d08
             mov  dword ptr [ ebx + 8 ] , eax                                ;0x006d640b :        894308
             sub eax , edx                                                   ;0x006d640e :        2bc2
             add eax , 0FFFFFFFEh                                            ;0x006d6410 :        83c0fe
             mov  dword ptr [ebx] , eax                                      ;0x006d6413 :        8903
             mov  ecx , dword ptr [ecx]                                      ;0x006d6415 :        8b09
             mov  ecx , dword ptr [ ecx + 0ACh ]                             ;0x006d6417 :        8b89ac000000
             add eax , ecx                                                   ;0x006d641d :        03c1
             jns Label6d6434                                                 ;0x006d641f :        7913
             mov  dword ptr [ebx] , ecx                                      ;0x006d6421 :        890b
             lea eax ,  dword ptr [ ecx + edx - 2 ]                          ;0x006d6423 :        8d4411fe
             jmp Label6d6431                                                 ;0x006d6427 :        eb08

     Label6d6429 ::
             mov  eax , dword ptr [ecx]                                      ;0x006d6429 :        8b01
             mov  dword ptr [ebx] , eax                                      ;0x006d642b :        8903
             mov  eax , dword ptr [ecx]                                      ;0x006d642d :        8b01
             add eax , edx                                                   ;0x006d642f :        03c2

     Label6d6431 ::
             mov  dword ptr [ ebx + 8 ] , eax                                ;0x006d6431 :        894308

     Label6d6434 ::
             mov  esi , dword ptr [ ebp - 4 ]                                ;0x006d6434 :        8b75fc
             push  dword ptr [ ebp + 16 ]                                    ;0x006d6437 :        ff7510
             xor edx , edx                                                   ;0x006d643a :        33d2
             mov eax , esi                                                   ;0x006d643c :        8bc6
             call Fun4158f5                                                  ;0x006d643e :        e8b2f4d3ff
             pushd 00h                                                       ;0x006d6443 :        6a00
             mov edx , eax                                                   ;0x006d6445 :        8bd0
             mov ecx , esi                                                   ;0x006d6447 :        8bce
             call Fun416bd8                                                  ;0x006d6449 :        e88a07d4ff
             mov  edx , dword ptr [ ebp + 24 ]                               ;0x006d644e :        8b5518
             pushd 01h                                                       ;0x006d6451 :        6a01
             mov ecx , esi                                                   ;0x006d6453 :        8bce
             call Fun4c25d3                                                  ;0x006d6455 :        e879c1deff
             mov  eax , dword ptr [ebx]                                      ;0x006d645a :        8b03
             mov  ebx , dword ptr [ ebx + 4 ]                                ;0x006d645c :        8b5b04
             pushd 00h                                                       ;0x006d645f :        6a00
             push ebx                                                        ;0x006d6461 :        53
             push eax                                                        ;0x006d6462 :        50
             mov ebx , esi                                                   ;0x006d6463 :        8bde
             call Fun4c763c                                                  ;0x006d6465 :        e8d211dfff
             mov ecx , esi                                                   ;0x006d646a :        8bce
             call Fun46f36f                                                  ;0x006d646c :        e8fe8ed9ff
             neg eax                                                         ;0x006d6471 :        f7d8
             sbb eax , eax                                                   ;0x006d6473 :        1bc0
             not eax                                                         ;0x006d6475 :        f7d0
             and  eax , dword ptr [ ebp + 28 ]                               ;0x006d6477 :        23451c
             xor ecx , ecx                                                   ;0x006d647a :        33c9
             push edi                                                        ;0x006d647c :        57
             inc ecx                                                         ;0x006d647d :        41
             mov edi , esi                                                   ;0x006d647e :        8bfe
             call Fun544cfe                                                  ;0x006d6480 :        e879e8e6ff
             mov  eax , dword ptr [ ebp - 8 ]                                ;0x006d6485 :        8b45f8
             cmp  dword ptr [ ebp + 12 ] , eax                               ;0x006d6488 :        39450c
             pop edi                                                         ;0x006d648b :        5f
             jl Label6d6494                                                  ;0x006d648c :        7c06
             cmp  dword ptr [ ebp + 24 ] , 00h                               ;0x006d648e :        837d1800
             je Label6d64a3                                                  ;0x006d6492 :        740f

     Label6d6494 ::
             mov  esi , dword ptr [ ebp - 4 ]                                ;0x006d6494 :        8b75fc
             mov eax , esi                                                   ;0x006d6497 :        8bc6
             call Fun473ea1                                                  ;0x006d6499 :        e803dad9ff
             call Fun78c884                                                  ;0x006d649e :        e8e1630b00

     Label6d64a3 ::
             pop esi                                                         ;0x006d64a3 :        5e
             pop ebx                                                         ;0x006d64a4 :        5b
             leave                                                           ;0x006d64a5 :        c9
             ret 01Ch                                                        ;0x006d64a6 :        c21c00


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

     2, sunyear.com.tw:
     http://vfp.sunyear.com.tw/viewtopic.php?t=6986


6. OTHER:

     For reference only, there is no guarantees.

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