-----------------------------------------------------------------------------------
                        [BUG/PRB.] VFP 9.0 FIX - FIX THE OLE BOUND CONTROLS IN THE GRID CONTROL
                                February 2026
                 -----------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), if we use the OLE Bound controls in the Grid control, sometimes VFP will crash.

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

     The bug occurs when Column.Sparse=.F., it does not occur when Column.Sparse=.T. (the default setting).

     In VFP Advanced, if we use the OLE Bound controls in the Grid control, we ALWAYS set Column.Sparse=.T.
     for the OLE Bound controls in the Grid control on Windows 11 or later, VFP will run fine.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label5fc4bf ::


     ;
     ;                 ----------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE OLE BOUND CONTROLS IN THE GRID CONTROL
     ;                                February 2026
     ;                 ----------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, if we use the OLE Bound controls in the Grid control, sometimes VFP will crash.
     ;
     ; 2026/2/22, by ccb
     ;

             cmp dword ptr vfpa_modifyform_isdoform,00h
             je Label5fc4c2
             cmp dword ptr vfpa_sys9206_data,00h
             je Label5fc4c2
             cmp dword ptr vfpa_lmm_osversion,0A00h
             jb Label5fc4c2
             cmp dword ptr vfpa_lmm_osbuildnumber,22000
             jb Label5fc4c2

             mov  edx , dword ptr [ esp + 0134h ]
             mov  ecx , dword ptr [ Data9388dc ]
             lea esi ,  dword ptr [ edx + 4 * edx ]
             shl esi , 05h
             add esi , ecx
             cmp  word ptr [ esi + 16 ] , 033Bh
             jne Label5fc4c2
             mov edx , dword ptr [ esi + 8 ]
             test edx , edx
             je Label5fc4c2

     Label5fc4c0 ::
             mov  ecx , dword ptr [ Data9388dc ]
             lea eax ,  dword ptr [ edx + 4 * edx ]
             shl eax , 05h
             add eax , ecx
             cmp  word ptr [ eax + 16 ] , 0349h
             je Label5fc4c1
             inc edx
             cmp edx , dword ptr [ esi + 12 ]
             jbe Label5fc4c0
             jmp Label5fc4c2

     Label5fc4c1 ::
             mov  ecx , dword ptr [ esp + 013Ch ]
             mov eax , 01h
             jmp Label5fc4d2


     Label5fc4c2 ::
             mov  eax , dword ptr [ edi + 012Ch ]                            ;0x005fc4bf :        8b872c010000
             mov  ecx , dword ptr [ esp + 013Ch ]                            ;0x005fc4c5 :        8b8c243c010000
             shr eax , 013h                                                  ;0x005fc4cc :        c1e813
             and eax , 01h                                                   ;0x005fc4cf :        83e001

     Label5fc4d2 ::
             mov  dword ptr [ebx] , eax                                      ;0x005fc4d2 :        8903
             mov  eax , dword ptr [ecx]                                      ;0x005fc4d4 :        8b01
             jmp Label512b03                                                 ;0x005fc4d6 :        e92866f1ff


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.

     IMPORTANT NOTE FOR WINDOWS 11:
     On Windows 11 or later, we can also run the programs compiled with Visual FoxPro 9.0 or earlier versions in compatibility mode to solve the problem.


5. REFERENCE WEBSITES:

     1, baiyujia.com:
     http://www.baiyujia.com
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix411.asp


6. OTHER:

     For reference only, there is no guarantees.

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