How use Procedure.Exec with C++Builder XE

398 Views Asked by At

I have a piece of code as show belowe, wich run well with C++Builder-6.

Now I have moved tha program to C++Builder-XE and the call to "RiconfiguraNodo << nomeNodo ...." give me the ambguity error report belowe.

I tried several way to rewrite the call to the ole proceudre "RiconfiguraNodo", but I didn't find a working solution.

How can I rewrite this snippet of code in way suitable for C++BuilderXE

Error reported:

  [BCC32 Error] UnitMain.cpp(262): E2015 Ambiguity between 'operator
 System::AutoCmd::<<(const System::Currency) at c:\program files
 (x86)\embarcadero\rad studio\8.0\include\windows\rtl\sysvari.h:3561'
 and 'operator System::AutoCmd::<<(const System::TDateTime) 
 at  c:\program files (x86)\embarcadero\rad
 studio\8.0\include\windows\rtl\sysvari.h:3562'   

 Full parser context
     UnitMain.cpp(245): parsing: void _fastcall TFormMain::RiconfiguraNodo(System::UnicodeString,System::UnicodeString,System::UnicodeString,System::UnicodeString)

Sample code:

Procedure RiconfiguraNodo( L"RiconfiguraNodo" );

if (VarServerPmvManager.IsEmpty() || VarServerPmvManager.IsNull())
{
    VarServerPmvManager = VarServerPmvManager.CreateObject(ProgId_ServerPmvmanager);
}

try
{
    VarServerPmvManager.Exec( RiconfiguraNodo << nomeNodo << ipAddress << tipoPmv << cmdType );
}
catch (Exception & ex)
{
    Mylog(Fun + Sysutils::Format("ERROR=[%s] ", ARRAYOFCONST((ex.Message))));
}
1

There are 1 best solutions below

0
On

I found the solution. The procedure exec simply require Variant instead of plain string

 Variant vNomeNodo, vIpAddress, vTipoPmv, vCmdType;

            vNomeNodo   = nomeNodo;
            vIpAddress  = ipAddress;
            vTipoPmv    = tipoPmv;
            vCmdType    = cmdType;


VarServerPmvManager.Exec( RiconfiguraNodo << vNomeNodo << vIpAddress << vTipoPmv << vCmdType );