Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
COM Parameters
Message
De
16/03/2001 13:21:20
Monte Murdock
Universal American Mortgage Company
Clearwater, Floride, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00485944
Message ID:
00486016
Vues:
12
>>>>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform