2012-10-16 91 views
0

我有一段如下所示的代碼,用C++ Builder-6很好地運行。如何在C++ Builder中使用Procedure.Exec XE

現在我已經將該程序移至C++ Builder-XE,並調用「RiconfiguraNodo < < nomeNodo ....」給我下面的ambguity錯誤報告。

我嘗試了幾種方法來重新調用ole過程「RiconfiguraNodo」,但我沒有找到工作解決方案。

我怎麼能改寫的方式適用於C++ BuilderXE

錯誤此代碼片段報道:

[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) 

示例代碼:

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)))); 
} 

回答

0

我發現解決方案。 程序exec只需要Variant而不是普通字符串

Variant vNomeNodo, vIpAddress, vTipoPmv, vCmdType; 

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


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