Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing a _SCREEN hook
Message
From
11/04/2002 08:34:03
 
 
To
11/04/2002 08:03:06
Charles Richard
Nvo Management Systems
Boisbriand, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00643491
Message ID:
00643665
Views:
25
Hi!

Instead of using the Destroy event of the screen, create the code in a separate PRG (or procedure in Main.PRG module - first program that starts when you run EXE) that will do all similar things. Then File-Exit will run that program. To catch the screen close by "X" button just use the ON SHUTDOWN command. There was no need in the hook for Destroy event of the _Screen object before, that is why I thought the things you're trying to do by hooks might be possible to do in another way.

Try to avoid hooks at all cost, use them only when you really do not have any other solution, and nobody propose something at such sites like Universal Thread ;)

Hope this helps.

>Thanks Vlad.
>
>The destroy traps all type of application shutdown, (File-Exit, the close box or Alt+F4). _screen is the main form of the app, to avoid problems related to an "as desktop" form. This example is almost the same as the working application, just more succinct. In destroy, open forms are closed, open files are also closed and databases are released. It also resets the development environment, removing the icon and the background image. The hook needs to be removed to prevent problems in the development environment following a test. I.E. the class browser, for some reason, fires the destroy method while opening, leading to some C5 errors or failure to open properly. I want to avoid restarting VFP after a test and am almost successful except for the remaining hooks.
>
>If you don't know how to unhook it, then there may not be an existing way to do it.
>
>But I can live with it ...
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform