Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help needed with ProjectHook Object
Message
From
29/11/2001 18:40:59
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
29/11/2001 16:24:54
Bill Emery
MedScribe Information Systems
Sylvania, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00587733
Message ID:
00587777
Views:
25
>I?m using VFP 6 SP 5 on Windows 98 SE. I?ve got a project file that I need to add 200 plus program files to which are referenced indirectly. Rather than use the point and click interface, I thought to add these file programmatically. Now comes the learning and growth experience.
>
>I RTFM up to and through ?The ProjectHook Object? and have tried to assign a project class in both Tools, Options, Projects and, with the project open, Project Info, Project Class. No luck, and I don?t understand how to create the class library that I need. Could someone please point me in the right direction and/or maybe provide a basic example of adding program files to the project? All the MSDN documentation I?m reading seems to be using circular logic.

You already got the answer to how to add one file. Building of a projecthook class has two steps: building the class and telling the project to use it. For the first, simply

Create Class MyPjxHook as projecthook of myhooks.vcx

To tell the project to use it, open project info (from rightclick anywhere in the project window, or from the menu), then check the ProjectClass checkbox and you'll be prompted with a class selector - take it to your class and there you are. Close the project, reopen it and it will instantiate your hook as it opens.

Couple of gotchas:
- don't keep anything else in this vcx, because you won't be able to recompile while the project is open: it will have the hook instantiated.
- traversing the files collection is slow; it's not a Fox array, it's a VB-like collection, and probably uses some roundabout mechanism. A faster way is to do a SQL select from the pjx file and traverse the cursor.
- if you return .f. from hook's .init the project won't open. May be good as a protection scheme, but then anyone with a grain of salt can open the project as a dbf and unhook.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform