AnsweredAssumed Answered

Setting the mouse cursor in a custom application

Question asked by Adjutant on Mar 5, 2012
Latest reply on Mar 7, 2012 by Adjutant
Hi,
I'm writing a custom application (DotNet 4.0, Windows Forms) that uses ArcObjects SDK in order to achieve custom mapping tool functionality.
The map control in instantiated, initialized and docked within the main form of the application. It correctly loads and displays maps and other features tested this far.

There is a problem I am experiencing with loading the mouse cursor.
Using the mouse down and mouse up events of the main map control, I've added code to set the mouse cursor accordingly:


    void axMapControl_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
    {
      int rightMouseButton = 2;
      if (e.button == rightMouseButton)
      {
        //Cursor = Cursors.NoMove2D;

        IMouseCursor appCursor = new MouseCursorClass();
        appCursor.SetCursor(2);
      }
    }

    void axMapControl_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e)
    {
      //Cursor = Cursors.Default;
     
      IMouseCursor appCursor = new MouseCursorClass();
      appCursor.SetCursor(3);
    }


If I run the mouse down code above it throws an exception :
"Retrieving the COM class factory for component with CLSID {DCAB4344-69D0-492A-9468-9A89A8E9B571} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."
NOTE - I have only ArcEngine installed (not ArcDesktop, or any of the other ESRI applications). Is this the problem? - Does ESRI.ArcGIS.Framework only apply to ArcView/ ArcMap/ ArcDesktop?) If yes, how should I be setting the cursor through arc objects SDK for a custom mapping application?

(Another test : Setting the cursor directly using DotNet (see commented code above) works correctly)

Outcomes