Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing a _SCREEN hook
Message
From
10/04/2002 17:08:12
Charles Richard
Nvo Management Systems
Boisbriand, Quebec, Canada
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Removing a _SCREEN hook
Miscellaneous
Thread ID:
00643491
Message ID:
00643491
Views:
51
The following code implements a hook to _screen for the destroy event:
To test it, you just have to run the code then issue the following command:
_Screen.Destroy
If you issue it again, a wait window will confirm the object is no longer there. Why then does _Screen still access the hooked method and how do I un hook it? (Notice that an attempt is made in the code but this does not work)

Thanks to anyone who can help
_SCREEN.AddObject('oHook', 'ScreenHook')

DEFINE CLASS ScreenHook AS Custom
  oScreen = _Screen

  PROCEDURE INIT
    This.oScreen = _Screen
  ENDPROC

  PROCEDURE Destroy
     WAIT WINDOW 'Destroy Hook'
     This.oScreen = NULL
  ENDPROC

  PROCEDURE oScreen.destroy
    IF TYPE('This.oHook') = 'O'
      IF VARTYPE(This.oHook) = 'O'
        WAIT WINDOW 'oHook exists'
        This.RemoveObject('oHook')
      ENDIF
    ENDIF
    WAIT WINDOW '_Screen Destroy'
  ENDPROC
ENDDEFINE
Charles Richard
NVO Management Systems
crichard@nvo.ca
Next
Reply
Map
View

Click here to load this message in the networking platform