Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Protecting VFP Class
Message
 
 
To
17/04/2000 16:26:00
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00360614
Message ID:
00360701
Views:
7
Hi Scott,

When you say "protection", I get the feeling you mean that you do not want other developers changing your source code.

If that is the case, then there is something that you can do without having to touch the VCX. You can build the VCX into an EXE, and use the SET CLASSLIB to set the classlib to the classes in the EXE. This approach can also be used with PRGs.

Here's how.

Let's say you have a class called StringPacker in a VCX called GreenBay.VCX.
Create a project called NFL. Add the GreenBay.vcx into the project. Create a prg call FakeMain.Prg and put a comment in the prg. Set this PRG as the main program. The reason for creating the FakeMain is that under certain versions of VFP you must have a program or form as the main program or else you cannot build an EXE. Build the NFL.EXE.

Now when you want to use the class:

SET CLASSLIB TO GreenBay IN NFL.EXE ADDITIVE
loPacker = CREATEOBJECT("StringPacker")
.... code goes here

With this done, you can brand the EXE as was referred to in another reply to you, to protect your source.

Hope this helps,
Rick


>Can someone tell me how to protect a class so it cannot be changed? I'm writing a class to unpack a string and don;t want it to be changed once I'm done?
>
>
>Thank you
Rick Hodder
MCP Visual Foxpro
C#, VB.NET Developer
Independent Consultant
www.RickHodder.com
MyBlog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform