get_Sensor call crashes on customer machine.

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
Nihit
Posts: 8
Joined: Mon Oct 26, 2009 6:30 pm

get_Sensor call crashes on customer machine.

Post by Nihit »

Hi,
Our company has implemented 3D Connexion API in our code similar to the way it is implemented in Cube3DPolling sample application. However on one customer WinXP 32 bit machine the call get_Sensor crashed. The machine was using SpaceNavigator mouse with driver installed about two years back. He had a few configurations saved in the driver. I couldnt get an opportunity to find many details on the customer machine, however I would be interested to know if some similar crash has been observed on call to get_Sensor?
I am writing the InitializeCOM code here.
Should I cover the InitializeCOM call in our code in try/catch.

Code: Select all


HRESULT CView3DComEventReceiver::InitializeCOM()
{
  HRESULT hr=S_OK;
  CComPtr<IUnknown> _3DxDevice;

  // Create the device object
  if (!s_p3DxDevice)
  {
    hr = _3DxDevice.CoCreateInstance(__uuidof(Device));
    s_p3DxDevice = _3DxDevice;
  }
  else
  {
    s_p3DxDevice->AddRef();
    _3DxDevice.Attach(s_p3DxDevice);
  }

  if (SUCCEEDED(hr))
  {
    CComPtr<ISimpleDevice> _3DxSimpleDevice;
    hr = _3DxDevice.QueryInterface(&_3DxSimpleDevice);

    if (SUCCEEDED(hr))
    {
      // Set the preferences we want to use
      _3DxSimpleDevice->LoadPreferences(L"Ansoft");

      // Get the interfaces to the sensor and the keyboard;
      if (!m_pISensor)
      {
        hr = _3DxSimpleDevice->get_Sensor(&m_pISensor);
        if (SUCCEEDED(hr))
        {
          hr = __hook(&_ISensorEvents::SensorInput, m_pISensor, &CView3DComEventReceiver::OnSensorInput);
        }
        else
        {
          AnsDebug(2, ACHAR("Could not connect to SensorInput of 3D Mouse Device, get_Sensor failed\n"));
        }
      }

      if(!m_pIKeyboard)
      {
        hr = _3DxSimpleDevice->get_Keyboard(&m_pIKeyboard);
        if (SUCCEEDED(hr))
        {
          hr = __hook(&_IKeyboardEvents::KeyDown, m_pIKeyboard, &CView3DComEventReceiver::OnKeyDown);
          hr = __hook(&_IKeyboardEvents::KeyUp, m_pIKeyboard, &CView3DComEventReceiver::OnKeyUp);
        }
        else
        {
          AnsDebug(2, ACHAR("Could not connect to Keyboard of 3D Mouse Device, get_Keyboard failed\n"));
        }
      }
      // Connect to the driver
      hr = _3DxSimpleDevice->Connect();

      if (!SUCCEEDED(hr))
      {
        AnsDebug(2, ACHAR("Could not connect to 3D Mouse Device, Connect failed\n"));
      }
    }
    else
    {
      AnsDebug(2, ACHAR("Could not QueryInterface 3D Mouse Device, QueryInterface failed\n"));
    }
    //_3DxDevice.Release();
  }
  else
  {
    //::MessageBox (NULL, _T("Could not Create 3D Mouse Device"), _T("CoCreateInstance failed"), MB_ICONERROR|MB_OK);
    AnsDebug(2, ACHAR("Could not Create 3D Mouse Device, CoCreateInstance failed\n"));
  }
  _3DxDevice.Detach();
  return hr;
}



Thanks,
Nihit
Nihit
Posts: 8
Joined: Mon Oct 26, 2009 6:30 pm

No Replies

Post by Nihit »

Hi,
I havent received any reply. Can someone please answer my question above?

Nihit
ngomes
Moderator
Moderator
Posts: 3334
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Post by ngomes »

Answer provided by e-mail on March 10th.
Nuno Gomes
Post Reply