Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COM Parameters
Message
From
16/03/2001 13:21:20
Monte Murdock
Universal American Mortgage Company
Clearwater, Florida, United States
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00485944
Message ID:
00486016
Views:
13
>>>>Can you pass parameters to COM DLL objects? If so what is the syntax?
>>>
>>>Monte,
>>>You would pass parameters the same as if were a regular VFP object.
>>>
>>>myreturnvalue = COMObject.Method(param1, param2, param3)
>>>
>>>The only difference with COM objects is you can't pass parameters directly to the Init using CreateObject/AddObject/NewObject. You need to create another method that accepts those parameters and does whatever processing you need done.
>>
>>Here is an example of what I'm doing...
>>
>>
DEFINE CLASS ComSecurity AS SESSION OLEPUBLIC
>>
>>    cSQLServer = "TEST"
>>    cDatabase = "TEST"
>>
>>    FUNCTION Init
>       * parameters deleted because they don't work in COM
>>      RETURN .T.
>>    ENDFUNC
><
>
>     FUNCTION SetProps
>       LPARAMETERS tcSqlServer, tcDatabase
>       This.cSqlServer = tcSqlServer
>       This.cDatabase  = tcDatabase
>     ENDFUNC
>
>>ENDDEFINE
>>
>>I compile the code above into a COM MTDLL and from my command window execute the following code.
>>osec = createobject('comsecurity.comsecurity',"X","Y")
>>? oSec.cSqlServer
>>Result: .F.
>>? oSec.cDatabase
>>Result: .F.
>>
>>What am I doing wroing?
>
>See the bold text from my other response. Add something like the new function I added above to set those properties.

Thank you.
Previous
Reply
Map
View

Click here to load this message in the networking platform