2010-10-13 115 views
0

我包含對編碼的第三方引用。但是,當我使用它時,我的編碼會顯示錯誤。在非託管中使用託管類對象

我的代碼:在TagInfo.h

ref class Globals 
{ 
public: 
    static DUAL_INOUTLib::DualInOut^ objVM; 
}; 

進出口使用它在我的編碼爲在TagInfo.cpp

void CTagController :: ReceiveLivePoints() 
{ 
     float PV,SV,MV,P,I,D;    

    CString name = GetTagName(); 
    System::String^ TgName = gcnew String(name); 
    double ds; 
    **Globals::objVM = gcnew DUAL_INOUTLib::DualInOut; 
    Globals::objVM->Open_InOut("ShareMemory", "FRACT", p); 
    Globals::objVM->Get_real(p, TgName, _T("PV"), ds);** 

    PV = float(ds); 
} 

但它顯示了行全局錯誤:: objVM = gcnew DUAL_INOUTLib :: DualInOut as

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in FOPStation.exe Additional information: Retrieving the COM class factory for component with CLSID {52762B50-F702-11D2-9EB1-00C04F888C49} failed due to the following error: 8001010d.

TagInfo.cpp包含更多類像,CTagbase,CTagController,CTagIndicator等等,...我想在每個類中使用此DualInOut來獲取值

回答

0

您應該嘗試瞭解有關該錯誤的更多信息。你可以谷歌錯誤代碼,這與this thread,也許這有助於?