comeoncn - Saturday, October 23, 2010 4:03 AM:
I tried to create a project to connect the Innovator server with C++.
code:
CComPtr<IIomFactoryComIncoming> pFactory ;
pFactory.CoCreateInstance(__uuidof(IomFactory));
// error occured
CComPtr<IHttpServerConnectionComIncoming> pConnection = pFactory->CreateHttpServerConnection(...);
The error is ---
error C2039: 'CreateHttpServerConnection' : is not a member of 'ATL::_NoAddRefReleaseOnCComPtr<T>' e:iom_mfciom_mfcdlg.cpp 166
Can anybody help me?
Environment: WINXP 32, VS2005, C++, Innovator 9.1
snnicky - Thursday, November 4, 2010 8:05 AM:
Here is working sample:
#import "c:WindowsMicrosoft.NETFrameworkv2.0.50727mscorlib.tlb" auto_rename
using namespace mscorlib;
#import "c: empIOM9.1.tlb" auto_rename
//......
void Ciom_mfcDlg::OnBnClickedButton1()
{
MessageBox(_T("start"));
CComPtr<IOM::IIomFactoryComIncoming> pFactory;
HRESULT hr = pFactory.CoCreateInstance(__uuidof(IOM::IomFactory));
if( !SUCCEEDED(hr) )
{
MessageBox(_T("error 1"));
return;
}
MessageBox(_T("here 1"));
CComPtr<IOM::IHttpServerConnectionComIncoming> pConnection = pFactory->CreateHttpServerConnection("localhost/.../InnovatorServer.aspx", "i91sp6", "admin", "innovator");
MessageBox(_T("here 2"));
CComPtr<IOM::IItemComIncoming> pItem = pConnection->Login();
MessageBox(_T("here 3"));
_bstr_t str = pItem->GetToString();
MessageBox(_T("here 4"));
MessageBox(str);
MessageBox(_T("end"));
}
The error you described may occur if pFactory is incorrectly declared. For example the error would happened if I would declared pFactory as
CComPtr<IOM::IIomFactoryComIncomingPtr> pFactory;
Error 1 error C2039: 'CreateHttpServerConnection' : is not a member of 'ATL::_NoAddRefReleaseOnCComPtr' d:snnicky...iom_mfciom_mfcdlg.cpp 176 1 iom_mfc
comeoncn - Saturday, November 6, 2010 7:21 AM:
Thanks very much for your tips.
I think it works now...