------------------------------------------------------------
[BUG/PRB.] VFP 9.0 FIX - PRIVATE DATA SESSION
January 2026
------------------------------------------------------------
CCB
1. BUG:
The default values for a form with a private data session are as follows:
SET TALK ON
SET SAFETY ON
Usually, if a form or a report uses a private data session, we need to insert some code:
SET TALK OFF
SET SAFETY OFF
...
into the PROCEDURE Form.Load() or the PROCEDURE Form.Init().
If we use a data environment in a form or a report,
we need to insert the code into the PROCEDURE DataEnvironment.BeforeOpenTables() or the PROCEDURE DataEnvironment.Init().
Sometimes, we don't know the form uses a private data session or not.
For example,
in the class library, we can set:
DataSession = 1 && default data session
but in the form (it is subclassed from the class library), we can set:
DataSession = 2 && private data session
then the form (and the class library) uses a private data session,
so we need to insert the code into the PROCEDURE Form.Load() or the PROCEDURE Form.Init() in the class library.
For example, in vfp9, we can run the code:
_REPORTPREVIEW=FULLPATH("REPORTPREVIEW.APP")
_REPORTOUTPUT=FULLPATH("REPORTOUTPUT.APP")
SET REPORTBEHAVIOR 90
REPORT FORM ...
But the applications REPORTPREVIEW.APP and REPORTOUTPUT.APP use a private data session,
they will display some messages in the form,
please refer to the picture testreport-vfp9.jpg:
If we can set the default values for a form with a private data session are as follows:
SET TALK OFF
SET SAFETY OFF
then we needn't to insert the code into the PROCEDURE Form.Load() or the PROCEDURE Form.Init().
The default values in VFP Multi-threaded Runtime are as follows:
SET TALK OFF
SET SAFETY OFF
2. CAUSE:
The following code set the default values to (for a data session):
SET TALK ON
SET SAFETY ON
Label414da1 ::
mov eax , dword ptr [ ebp + 8 ] ;0x00414da1 : 8b4508
cmp eax , ebx ;0x00414da4 : 3bc3
jne Label4c0e61 ;0x00414da6 : 0f85b5c00a00
mov dword ptr [ esi + 0E8h ] , edi ;0x00414dac : 89bee8000000
Label414db2 ::
mov dword ptr [ esi + 0118h ] , edi ;0x00414db2 : 89be18010000
mov dword ptr [ esi + 0110h ] , edi ;0x00414db8 : 89be10010000
Label414dbe ::
mov ecx , dword ptr [ Data9370f4 ] ;0x00414dbe : 8b0df4709300
mov eax , dword ptr [ Data935778 ] ;0x00414dc4 : a178579300
3. RESOLUTION:
We can write some code to set the default values to (for a private data session):
SET TALK OFF
SET SAFETY OFF
Label414da1 ::
mov eax , dword ptr [ ebp + 8 ] ;0x00414da1 : 8b4508
cmp eax , ebx ;0x00414da4 : 3bc3
jne Label4c0e61 ;0x00414da6 : 0f85b5c00a00
mov dword ptr [ esi + 0E8h ] , edi ;0x00414dac : 89bee8000000
Label414db2 ::
mov dword ptr [ esi + 0118h ] , edi ;0x00414db2 : 89be18010000
mov dword ptr [ esi + 0110h ] , edi ;0x00414db8 : 89be10010000
;
; -------------------------------------------------
; VFP 9.0 FIX - PRIVATE DATA SESSION
; May 2015
; -------------------------------------------------
; CCB
;
; The default values for a form with a private data session are as follows:
; SET TALK OFF
; SET SAFETY OFF
;
; 2015/5/4, by ccb
;
cmp dword ptr [esi] , 02h
jb Label414dbe
mov dword ptr [ esi + 0118h ] , 00h
mov dword ptr [ esi + 0110h ] , 00h
Label414dbe ::
mov ecx , dword ptr [ Data9370f4 ] ;0x00414dbe : 8b0df4709300
mov eax , dword ptr [ Data935778 ] ;0x00414dc4 : a178579300
Now in VFP Advanced, the report will not display any messages in the form,
please refer to the picture testreport-vfpa.jpg:
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
http://www.baiyujia.com/vfpdocuments/f_vfp9fix174.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix175.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix176.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix234.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix280.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix281.asp
2, foxite.com:
http://weblogs.foxite.com/andykramek/2008/12/21/datasessions-in-visual-foxpro/
http://www.foxite.com/archives/set-talk-off-0000129339.htm
3, microsoft.com:
https://social.msdn.microsoft.com/Forums/en-US/cc04eed3-c9e6-467c-a618-c6c02d68b6b0/set-talk-off-cant-remove-system-wordings
4, tech-archive.net:
http://www.tech-archive.net/Archive/Fox/microsoft.public.fox.programmer.exchange/2008-01/msg00039.html
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|