Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing a _SCREEN hook
Message
De
10/04/2002 17:08:12
Charles Richard
Nvo Management Systems
Boisbriand, Québec, Canada
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Removing a _SCREEN hook
Divers
Thread ID:
00643491
Message ID:
00643491
Vues:
52
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform