AnsweredAssumed Answered

ArcEngine AXCtl Error

Question asked by mahesh_b on Dec 14, 2015

Hi i am have installed "ArcEngine 10.2 with SDK cross platform C++ and Qt 5.4" in windows 7. I have used the mention below ActiveX controls header files in my application, while debug the application its through the error like :: QAXApplication member already defined

or declared.

#include <ArcSDK.h>

#include <AxCtl/qt4axctl.h>                        --> this qt4axctl will support only for Qt 4 or it will support Qt 5. version also.

#include <Ao/AoControls.h>

 

Is there is any supporting files are there related to the Qt 5.version, or same code will work on Qt 5 also. mention below are sample codes.

 

..................................................................................................................

 

void add_toolbar_items(IToolbarControl* pToolbar);

 

int main(int argc, char **argv)

{

  // Initialize the Engine

  ::AoInitialize(NULL);

  {

  IAoInitializePtr ipInit(CLSID_AoInitialize);

  esriLicenseStatus status;

  ipInit->Initialize(esriLicenseProductCodeEngine, &status);

   if (status != esriLicenseCheckedOut)

  {

  printf("Invalid Licensing.\n");

  AoExit(0);

  }

  }

 

  QApplication qapp(argc, argv);

 

  QVBox vbox(NULL);

  vbox.resize(500 , 400);

 

  QAxCtl tlb(AoPROGID_ToolbarControl, &vbox, "Toolbar Control");

  tlb.setMinimumHeight(30);

  tlb.setMaximumHeight(30);

 

  QSplitter split(&vbox);

 

  QAxCtl toc(AoPROGID_TOCControl, &split, "TOC Control");

  QAxCtl glb(AoPROGID_GlobeControl, &split, "Globe Control");

 

  qapp.setMainWidget(&vbox);

 

  vbox.show();

 

  {

  IToolbarControlPtr ipToolbar;

  IGlobeControlPtr ipGlobe;

  ITOCControlPtr ipToc;

  HRESULT hr;

 

  hr = tlb.getInterface((IUnknown **)&ipToolbar);

  hr = toc.getInterface((IUnknown **)&ipToc);

  hr = glb.getInterface((IUnknown **)&ipGlobe);

 

   if (ipToolbar != 0)

  ipToolbar->SetBuddyControl(ipGlobe);

   if (ipToc != 0)

  ipToc->SetBuddyControl(ipGlobe);

 

  add_toolbar_items(ipToolbar);

  }

 

  qapp.exec(); 

 

  // Uninitialize the engine

  {

  IAoInitializePtr ipInit(CLSID_AoInitialize);

  ipInit->Shutdown();

  }

  ::AoUninitialize();

 

  AoExit(0);

  return 0;

}

 

void add_toolbar_items(IToolbarControl* pToolbar)

{

  CComVariant varTool;

  long itemIndex;

 

  if (!pToolbar)

   return;

 

  varTool = L"esriGlobeCore.ControlsGlobeOpenDocCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeZoomInOutTool";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_TRUE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeFixedZoomInCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeFixedZoomOutCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobePanTool";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeFullExtentCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeNavigateTool";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeRotateForwardCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeRotateBackCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeRotateClockwiseCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeRotateCounterClockwiseCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeSpinClockwiseCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeSpinCounterClockwiseCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeSpinFasterCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeSpinSlowerCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeSpinStopCommand";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeTargetCenterTool";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeTargetZoomTool";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeWalkTool";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriGlobeCore.ControlsGlobeSelectFeaturesTool";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

  varTool = L"esriControlCommands.ControlsSelectTool";

  pToolbar->AddItem(varTool, 0, -1, VARIANT_FALSE, 0,

  esriCommandStyleIconOnly, &itemIndex);

}

Outcomes