Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Pass Parameters to Init with CreateObject
Message
From
07/12/2006 01:05:08
Donald Lowrey
Data Technology Corporation
Las Vegas, Nevada, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
How to Pass Parameters to Init with CreateObject
Miscellaneous
Thread ID:
01175496
Message ID:
01175496
Views:
57
Passing params to an object created from a prg file works fine, but when passing to an exe, I get a "data type mismatch" error.

I know that params with CreateObject will automatically be passed to the Init() event of that class. In example #2, a COM exe, the data type mismatch error occurs when the Init Event fires. I thought at first that this is a value by reference vs. value type issue, but I seem to be stuck. Your thoughts are appreciated.

# 1 Object created from prg where test is a class defined as Custom (or Session, if you prefer) OlePublic.
SET PROCEDURE TO oMyObj ADDITIVE
oMyObj = CREATEOBJECT("test", 1, .t. , "Hello World")
# 2 Now, with the prg file compiled as an exe, named "testexe"
oMyObj = CREATEOBJECT("testexe.test", 1, .t. , "Hello World")
The Init() method in class "test" is the same in both examples.
FUNCTION INIT
LPARAMETERS nVal, lBool, cStr
..do something
ENDFUNC
Thanks for taking a look.

Don Lowrey
Next
Reply
Map
View

Click here to load this message in the networking platform