Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COM classes access function in PRG?
Message
From
07/11/2001 04:43:30
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
 
 
To
07/11/2001 04:07:27
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00578381
Message ID:
00578391
Views:
27
This message has been marked as the solution to the initial question of the thread.
>I created a project for my COM server (EXE). The project consists of two classes (CLASS1 and CLASS2) and a program (MAIN.PRG). Is it possible (or useless?) to:
>1. Set environment variables (such SET DELETED, SET DATE, etc) in MAIN.PRG that will affect how the classes will work?
No the prg is doesn't run in COM
>2. Create a function (MYFUNC) in MAIN.PRG that will be accessible by the classes since MYFUNC is needed by those two classes?
the answer is again No.
>
>I just want to eliminate duplicate codes in my project. If there is a better/right way to do this please show me how.
If you whant to do this then use the following
DEFINE CLASS mybaseCom AS Session

PROCEDURE Init
   This.SetupEnvironment()
ENDPROC
PROTECTED PROCEDURE SetupEnvironment 
   SET DELETE ON 
   SET DATE TO SHORT
   aditional set enviroment stuff
ENDPROC
PROCEDURE MyFunc(param1,param2,paramn) AS String
...Pur your base code where if any 
ENDPROC
ENDDEFINE

DEFINE CLASS Class1 AS mybaseCom OLEPUBLIC

PROCEDURE MyFunc(param1,param2,paramn) AS String
...Put the specified code here and call dodefault if ids the case
ENDPROC
ENDDEFINE

DEFINE CLASS Class2 AS mybaseCom OLEPUBLIC

PROCEDURE MyFunc(param1,param2,paramn) AS String
...Put the specified code here and call dodefault if ids the case
ENDPROC
ENDDEFINE
Alexandre Palma
Senior Application Architect
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform