----------------------------------------------------------------
[BUG/PRB.] VFP 9.0 FIX - FIX THE GRID.REFRESH METHOD
January 2026
----------------------------------------------------------------
CCB
1. BUG:
In vfp9 (and vfp6, vfp7, vfp8), if a grid is empty, and the empty grid has focus,
when we call the Grid.Refresh() method in some events, VFP cannot refresh the grid correctly.
The bug occurs in the following events:
Timer.Timer() event
Header.Click() event
ToolBar.Click() event
ON events, for example,
ON BAR command
ON ERROR command
ON ESCAPE command
ON EXIT BAR command
ON EXIT MENU command
ON EXIT PAD command
ON EXIT POPUP command
ON KEY command
ON KEY LABEL command
ON PAD command
ON PAGE command
ON READERROR command
ON SELECTION BAR command
ON SELECTION MENU command
ON SELECTION PAD command
ON SELECTION POPUP command
ON SHUTDOWN command
In VFP Advanced, if we enable fixing the Grid.Refresh method, if a grid is empty, and the empty grid has focus,
when we call the Grid.Refresh() method in some events, VFP can refresh the grid correctly.
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Fun45d4e2 :: ; proc near
push ebp ;0x0045d4e2 : 55
mov ebp , esp ;0x0045d4e3 : 8bec
sub esp , 0B0h ;0x0045d4e5 : 81ecb0000000
mov ecx , dword ptr [ ebp + 8 ] ;0x0045d4eb : 8b4d08
push ebx ;0x0045d4ee : 53
mov eax , 01h ;0x0045d4ef : b801000000
push esi ;0x0045d4f4 : 56
mov esi , dword ptr [ Data9388dc ] ;0x0045d4f5 : 8b35dc889300
lea ebx , dword ptr [ ecx + 4 * ecx ] ;0x0045d4fb : 8d1c89
shl ebx , 05h ;0x0045d4fe : c1e305
mov dword ptr [ ebp - 36 ] , eax ;0x0045d501 : 8945dc
mov dword ptr [ ebp - 8 ] , eax ;0x0045d504 : 8945f8
test byte ptr [ ebx + esi + 48 ] , 02h ;0x0045d507 : f644333002
push edi ;0x0045d50c : 57
mov dword ptr [ ebp - 20 ] , 00h ;0x0045d50d : c745ec00000000
jne Label45d735 ;0x0045d514 : 0f851b020000
call Fun51b6c8 ;0x0045d51a : e8a9e10b00
test eax , eax ;0x0045d51f : 85c0
mov dword ptr [ ebp - 28 ] , eax ;0x0045d521 : 8945e4
je Label45d547 ;0x0045d524 : 7421
mov edi , dword ptr [ ebx + esi + 24 ] ;0x0045d526 : 8b7c3318
test edi , edi ;0x0045d52a : 85ff
je Label45d547 ;0x0045d52c : 7419
mov edx , 0331h ;0x0045d52e : ba31030000
Label45d533 ::
cmp edi , eax ;0x0045d533 : 3bf8
jne Label451a6c ;0x0045d535 : 0f853145ffff
Label45d53b ::
test edi , edi ;0x0045d53b : 85ff
je Label45d547 ;0x0045d53d : 7408
cmp edi , eax ;0x0045d53f : 3bf8
jne Label4526c8 ;0x0045d541 : 0f858151ffff
Label45d547 ::
mov eax , dword ptr [ ebp - 8 ] ;0x0045d547 : 8b45f8
test eax , eax ;0x0045d54a : 85c0
mov esi , dword ptr [ ebx + esi + 108 ] ;0x0045d54c : 8b74336c
je Label5f8895 ;0x0045d550 : 0f843fb31900
test esi , esi ;0x0045d556 : 85f6
mov dword ptr [ ebp - 32 ] , esi ;0x0045d558 : 8975e0
je Label5f8845 ;0x0045d55b : 0f84e4b21900
mov eax , dword ptr [esi] ;0x0045d561 : 8b06
mov ecx , dword ptr [ eax + 0520h ] ;0x0045d563 : 8b8820050000
test ecx , ecx ;0x0045d569 : 85c9
movzx edi ,word ptr [ eax - 8 ] ;0x0045d56b : 0fb778f8
je Label45d576 ;0x0045d56f : 7405
call Fun519956 ;0x0045d571 : e8e0c30b00
Label45d576 ::
mov ecx , dword ptr [ Data9370f8 ] ;0x0045d576 : 8b0df8709300
mov dword ptr [ ebp - 16 ] , edi ;0x0045d57c : 897df0
mov edi , dword ptr [esi] ;0x0045d57f : 8b3e
and dword ptr [ edi + 96 ] , 0FEFFFFFFh ;0x0045d581 : 816760fffffffe
mov ecx , dword ptr [ecx] ;0x0045d588 : 8b09
mov eax , dword ptr [ edi + 12 ] ;0x0045d58a : 8b470c
test eax , eax ;0x0045d58d : 85c0
mov ebx , dword ptr [ ecx + 24 ] ;0x0045d58f : 8b5918
mov dword ptr [ ebp - 12 ] , edi ;0x0045d592 : 897df4
mov dword ptr [ ebp - 40 ] , ebx ;0x0045d595 : 895dd8
je Label45d5bb ;0x0045d598 : 7421
mov edx , dword ptr [ ecx + 32 ] ;0x0045d59a : 8b5120
test edx , edx ;0x0045d59d : 85d2
je Label5f884c ;0x0045d59f : 0f84a7b21900
Label45d5a5 ::
mov dword ptr [ ebp - 76 ] , eax ;0x0045d5a5 : 8945b4
mov eax , dword ptr [ eax + 68 ] ;0x0045d5a8 : 8b4044
mov dword ptr [ ebp - 72 ] , eax ;0x0045d5ab : 8945b8
pushd 01h ;0x0045d5ae : 6a01
lea eax , dword ptr [ ebp - 88 ] ;0x0045d5b0 : 8d45a8
lea ecx , dword ptr [ ebp - 76 ] ;0x0045d5b3 : 8d4db4
call Fun53c6cc ;0x0045d5b6 : e811f10d00
Label45d5bb ::
mov eax , dword ptr [ edi + 92 ] ;0x0045d5bb : 8b475c
test eax , 0800000h ;0x0045d5be : a900008000
jne Label45d6a4 ;0x0045d5c3 : 0f85db000000
test byte ptr ah , 020h ;0x0045d5c9 : f6c420
je Label45d6a4 ;0x0045d5cc : 0f84d2000000
lea edx , dword ptr [ ebp - 24 ] ;0x0045d5d2 : 8d55e8
lea eax , dword ptr [ ebp + 0FFFFFF54h ] ;0x0045d5d5 : 8d8554ffffff
call Fun42c27f ;0x0045d5db : e89fecfcff
pushd 00h ;0x0045d5e0 : 6a00
push eax ;0x0045d5e2 : 50
call Fun42c2be ;0x0045d5e3 : e8d6ecfcff
add esp , 08h ;0x0045d5e8 : 83c408
test eax , eax ;0x0045d5eb : 85c0
mov dword ptr [ ebp - 20 ] , eax ;0x0045d5ed : 8945ec
jne Label45d67f ;0x0045d5f0 : 0f8589000000
mov edi , dword ptr [ ebp - 12 ] ;0x0045d5f6 : 8b7df4
or dword ptr [ edi + 92 ] , 0800000h ;0x0045d5f9 : 814f5c00008000
mov eax , dword ptr [ edi + 12 ] ;0x0045d600 : 8b470c
test eax , eax ;0x0045d603 : 85c0
je Label45d67f ;0x0045d605 : 7478
mov ecx , dword ptr [ ebp - 28 ] ;0x0045d607 : 8b4de4
xor esi , esi ;0x0045d60a : 33f6
test ecx , ecx ;0x0045d60c : 85c9
je Label45d628 ;0x0045d60e : 7418
push esi ;0x0045d610 : 56
mov edx , 04h ;0x0045d611 : ba04000000
call Fun436ddb ;0x0045d616 : e8c097fdff
;
; -----------------------------------------------------
; VFP 9.0 FIX - FIX THE GRID.REFRESH METHOD
; December 2025
; -----------------------------------------------------
; CCB
;
; In vfp9, if a grid is empty, and the empty grid has focus,
; when we call the Grid.Refresh() method in some events, VFP cannot refresh the grid correctly.
; In VFP Advanced, if a grid is empty, and the empty grid has focus,
; when we call the Grid.Refresh() method in some events, VFP can refresh the grid correctly.
;
; 2025/12/4, by ccb
;
cmp dword ptr vfpa_sys9196_data,00h
je Label45d61b
cmp dword ptr [ esp + 0C0h ] , offset Label45d7a5 ;; Fun45d73e .. ; proc near
jne Label45d61b
mov ecx , dword ptr [ edi + 20 ]
imul ecx , ecx , 074h
cmp dword ptr [ ecx + edi + 0198h ] , 00h
jne Label45d61b
jmp Label45d623
Label45d61b ::
cmp dword ptr [ edi + 06D0h ] , eax ;0x0045d61b : 3987d0060000
je Label45d628 ;0x0045d621 : 7405
Label45d623 ::
mov esi , 01h ;0x0045d623 : be01000000
Label45d628 ::
test esi , esi ;0x0045d628 : 85f6
je Label45d638 ;0x0045d62a : 740c
mov ecx , dword ptr [ edi + 053Ch ] ;0x0045d62c : 8b8f3c050000
push ecx ;0x0045d632 : 51
call Fun519c4f ;0x0045d633 : e817c60b00
Label45d638 ::
mov eax , dword ptr [ edi + 06D8h ] ;0x0045d638 : 8b87d8060000
test eax , eax ;0x0045d63e : 85c0
jne Label5f8859 ;0x0045d640 : 0f8513b21900
Label45d646 ::
mov eax , dword ptr [ ebp - 36 ] ;0x0045d646 : 8b45dc
test eax , eax ;0x0045d649 : 85c0
je Label45d67f ;0x0045d64b : 7432
mov eax , dword ptr [ edi + 052Ch ] ;0x0045d64d : 8b872c050000
test eax , eax ;0x0045d653 : 85c0
jne Label5f8869 ;0x0045d655 : 0f850eb21900
Label45d65b ::
mov eax , 01h ;0x0045d65b : b801000000
Label45d660 ::
mov edx , dword ptr [ edi + 8 ] ;0x0045d660 : 8b5708
;
; -----------------------------------------------------
; VFP 9.0 FIX - FIX THE GRID.REFRESH METHOD
; December 2025
; -----------------------------------------------------
; CCB
;
; In vfp9, if a grid is empty, and the empty grid has focus,
; when we call the Grid.Refresh() method in some events, VFP cannot refresh the grid correctly.
; In VFP Advanced, if a grid is empty, and the empty grid has focus,
; when we call the Grid.Refresh() method in some events, VFP can refresh the grid correctly.
;
; 2025/12/4, by ccb
;
; mov dword ptr vfpa_gridrefresh_isgridrefresh2,01h
push eax ;0x0045d663 : 50
push edx ;0x0045d664 : 52
call Fun45d2b3 ;0x0045d665 : e849fcffff
;
; -----------------------------------------------------
; VFP 9.0 FIX - FIX THE GRID.REFRESH METHOD
; December 2025
; -----------------------------------------------------
; CCB
;
; In vfp9, if a grid is empty, and the empty grid has focus,
; when we call the Grid.Refresh() method in some events, VFP cannot refresh the grid correctly.
; In VFP Advanced, if a grid is empty, and the empty grid has focus,
; when we call the Grid.Refresh() method in some events, VFP can refresh the grid correctly.
;
; 2025/12/4, by ccb
;
Label45d669 ::
; mov dword ptr vfpa_gridrefresh_isgridrefresh2,00h
Label45d66a ::
test eax , eax ;0x0045d66a : 85c0
je Label5f887d ;0x0045d66c : 0f840bb21900
Label45d672 ::
mov ecx , dword ptr [ edi + 12 ] ;0x0045d672 : 8b4f0c
mov edx , 01h ;0x0045d675 : ba01000000
call Fun4adf98 ;0x0045d67a : e819090500
Label45d67f ::
lea eax , dword ptr [ ebp - 24 ] ;0x0045d67f : 8d45e8
push eax ;0x0045d682 : 50
lea eax , dword ptr [ ebp + 0FFFFFF54h ] ;0x0045d683 : 8d8554ffffff
call Fun42d200 ;0x0045d689 : e872fbfcff
mov esi , dword ptr [ ebp - 32 ] ;0x0045d68e : 8b75e0
mov edi , dword ptr [esi] ;0x0045d691 : 8b3e
mov eax , dword ptr [ edi + 92 ] ;0x0045d693 : 8b475c
mov ebx , dword ptr [ ebp - 40 ] ;0x0045d696 : 8b5dd8
and eax , 0FF7FFFFFh ;0x0045d699 : 25ffff7fff
mov dword ptr [ ebp - 12 ] , edi ;0x0045d69e : 897df4
mov dword ptr [ edi + 92 ] , eax ;0x0045d6a1 : 89475c
Label45d6a4 ::
mov ecx , dword ptr [ Data9370f8 ] ;0x0045d6a4 : 8b0df8709300
mov edx , dword ptr [ecx] ;0x0045d6aa : 8b11
mov eax , dword ptr [ edx + 8 ] ;0x0045d6ac : 8b4208
test eax , eax ;0x0045d6af : 85c0
je Label5f8889 ;0x0045d6b1 : 0f84d2b11900
lea ebx , dword ptr [ebx] ;0x0045d6b7 : 8d1b
Label45d6b9 ::
cmp dword ptr [ eax + 68 ] , ebx ;0x0045d6b9 : 395844
je Label45d6cb ;0x0045d6bc : 740d
mov eax , dword ptr [ eax + 12 ] ;0x0045d6be : 8b400c
test eax , eax ;0x0045d6c1 : 85c0
je Label5f8889 ;0x0045d6c3 : 0f84c0b11900
jmp Label45d6b9 ;0x0045d6c9 : ebee
Label45d6cb ::
mov dword ptr [ ebp - 64 ] , eax ;0x0045d6cb : 8945c0
pushd 01h ;0x0045d6ce : 6a01
xor eax , eax ;0x0045d6d0 : 33c0
lea ecx , dword ptr [ ebp - 64 ] ;0x0045d6d2 : 8d4dc0
mov dword ptr [ ebp - 60 ] , ebx ;0x0045d6d5 : 895dc4
call Fun53c6cc ;0x0045d6d8 : e8efef0d00
mov eax , dword ptr [ Data9370f8 ] ;0x0045d6dd : a1f8709300
mov ecx , dword ptr [eax] ;0x0045d6e2 : 8b08
mov ecx , dword ptr [ ecx + 32 ] ;0x0045d6e4 : 8b4920
test ecx , ecx ;0x0045d6e7 : 85c9
je Label45d6f5 ;0x0045d6e9 : 740a
mov edx , 01h ;0x0045d6eb : ba01000000
call Fun45b26f ;0x0045d6f0 : e87adbffff
Label45d6f5 ::
mov edx , dword ptr [ edi + 06D8h ] ;0x0045d6f5 : 8b97d8060000
mov ecx , dword ptr [ ebp + 8 ] ;0x0045d6fb : 8b4d08
or edx , 08h ;0x0045d6fe : 83ca08
mov dword ptr [ edi + 06D8h ] , edx ;0x0045d701 : 8997d8060000
call Fun4586f0 ;0x0045d707 : e8e4afffff
mov edx , dword ptr [esi] ;0x0045d70c : 8b16
mov eax , dword ptr [ edx + 0520h ] ;0x0045d70e : 8b8220050000
test eax , eax ;0x0045d714 : 85c0
je Label45d720 ;0x0045d716 : 7408
mov ebx , dword ptr [ ebp - 16 ] ;0x0045d718 : 8b5df0
call Fun416a98 ;0x0045d71b : e87893fbff
Label45d720 ::
mov ebx , dword ptr [ ebp - 16 ] ;0x0045d720 : 8b5df0
mov eax , esi ;0x0045d723 : 8bc6
call Fun416a98 ;0x0045d725 : e86e93fbff
mov ecx , dword ptr [ ebp - 20 ] ;0x0045d72a : 8b4dec
test ecx , ecx ;0x0045d72d : 85c9
jne Label5f8890 ;0x0045d72f : 0f855bb11900
Label45d735 ::
pop edi ;0x0045d735 : 5f
pop esi ;0x0045d736 : 5e
pop ebx ;0x0045d737 : 5b
mov esp , ebp ;0x0045d738 : 8be5
pop ebp ;0x0045d73a : 5d
ret 04h ;0x0045d73b : c20400
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_vfp9fix398.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix14.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix141.asp
2, foxite.com:
https://www.foxite.com/archives/filtered-records-in-grid-0000093013.htm
https://www.foxite.com/archives/filtered-grid-issue-0000506168.htm
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|