COM does not support passing parameters to the Init method. You'll have to instantiate the object, then pass the parameters to another method. Many people call it Initialize or something similar.
>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
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer