Connect to Esri map service using c++ in stand alone desktop app

489
0
06-26-2012 02:45 PM
SueJenkins
New Contributor
Can anyone tell me how to do this?  Here is my code.  The Open call returns E_INVALIDARG.

IAGSServerConnectionFactoryPtr AGSConnectionFactory;
AGSConnectionFactory.CreateInstance(CLSID_AGSServerConnectionFactory);
IPropertySetPtr connectionProps;
connectionProps.CreateInstance(CLSID_PropertySet);

VARIANT TestURL = _variant_t("http://server.arcgisonline.com/arcgis/services/");
hr = connectionProps->SetProperty(BSTR("connectiontype"), _variant_t(esriAGSConnectionTypeInternet));
hr = connectionProps->SetProperty(BSTR("url"), TestURL);

IAGSServerConnectionPtr AGSConnection;
AGSConnection.CreateInstance(CLSID_AGSServerConnection);
hr = AGSConnectionFactory->Open(connectionProps, 0, &AGSConnection);
0 Kudos
0 Replies