HOW TO
Code:
#import "c:\program files\common files\esri\mo2x.ocx" raw_interfaces_only no_implementation no_namespace
Code:
void COcxcreateDlg::OnButton1()
{
// Standard IClassFactory2 interface. Used to create instances
// of objects which are licensed.
IClassFactory2Ptr ipCF2;
// Standard COM creation function. Used to obtain a class
// factory for a particular object
// (in this case, the map control i.e. Map.)
HRESULT hr = ::CoGetClassObject(__uuidof(Map), CLSCTX_ALL,
0,
IID_IClassFactory2, (void**)&ipCF2);
if (FAILED(hr))
return;
// The license key.
_bstr_t bKey (L"Copyright (c) 1999 ESRI, Inc.");
// Create an instance of the Map control, request IOleControl
//interface initially.
IOleControlPtr ipOleControl;
ipCF2->CreateInstanceLic(0, 0, IID_IOleControl, bKey,
(void**)&ipOleControl);
// IOleControl is used to add controls into their
// containing frame application.
}
Article ID:000006264
Get help from ArcGIS experts
Download the Esri Support App