Environment versions
Network:
Windows 2000 Server
>Hi guys,
>
>I found that in VFP9 the following is not working:
>I have de_hook.prg:
>
>[vfp_code]
>PUBLIC oDEHook
>m.oDEHook = CREATEOBJECT ("DEHook")
>RETURN
>
>DEFINE CLASS DEHook AS DataEnvironment
>Name = "DataEnvironment"
>
>PROCEDURE BeforeOpenTables
> Messagebox ("I'm in the hook")
> SET DELETED ON
> SET TALK OFF
> SET CONSOLE OFF
> SET CONFIRM ON
> SET CENTURY ON
> SET CONFIRM OFF
> SET EXCLUSIVE OFF
> SET SAFETY OFF
> SET TALK OFF
> SET MULTILOCKS ON
>ENDPROC
>
>ENDDEFINE
>[/vfp_code]
>
>After I run de_hook.prg in VFP7/8, each time I run any form, the procedure
>BeforeOpenTables in de_hook would run (hence the messagebox appear). But in
>VFP9, the procedure wouldn't run. After I run de_hook, I tried ?m.oDEHook in
>the command window and it returns (Objects) as it should be. Seems like VFP9
>just by pass the hook.
>
>Are there something I miss? Can anybody help me? If this behaviour is by
>design (I hate those sentences, 'by design'), are there any way around?
>
>TIA,
>Willianto
>P.S: I got this method from Igor Korolyov. Hi Igor, have you notice this
>VFP9 behaviour as well?
When you call de_hook.prg ?
I cannot see the message in VFP8 and this is corrected for me,
since for an isolated DE none call the OpenTables method,
then the BeforeOpenTables event cannot happen
Solution:
Put the BeforeOpenTables's code in DEHook.Init.
Fabio
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only