SpaceNavigator, MFC 64-bit, UNICODE, VS2008, cant find dev

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

Moderator: Moderators

Post Reply
jdbrinton
Posts: 3
Joined: Wed Nov 18, 2009 9:39 pm

SpaceNavigator, MFC 64-bit, UNICODE, VS2008, cant find dev

Post by jdbrinton »

Straight up from the textbook...

Code: Select all

CFrameWnd::Create(........)
{
	SiOpenData oData;
	SiInitialize ();
	SiOpenWinInit (&oData, GetSafeHwnd());
	if ((m_DevHdl = SiOpen ("Buddy", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &oData)) == NULL )
	{
		char buf[1000];
		sprintf(buf, "no supported 3DxWare device\n");
		AfxMessageBox(L"no supported 3DxWare device\n",0, 0);
		SiTerminate();
	}
	else
	{
		AfxMessageBox(L"3DxWare device found!\n", NULL, MB_OK);
		SiSetUiMode (&m_DevHdl, SI_UI_ALL_CONTROLS);
	}
}
never finds the device.

I compiled siapp using the source code found in the 3Dconnexion 3DxWare SDK/lib/siapp/src.... Totally helpless here.

thx for your help![/code]
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

That code looks reasonable. I'd make sure the hwnd you are sending exists.

You probably want to make a scg file for your app, but it isn't necessary.

Take a look at the driver's log file to see if it is complaining about your connection request. Turn on the log file in the 3DxWare GUI. It is saved in %appdata%/3dconnexion/3dxware.

Why did you recompile siapp? Use the libs we ship if possible. Make sure you have the latest SDK from the archive section of our web site.
jdbrinton
Posts: 3
Joined: Wed Nov 18, 2009 9:39 pm

Post by jdbrinton »

Hi jwick, thanks for the reply.

Here's the log when I attempt to run the code below:

21:11:32.807: UdCtl: Protocol 30 request to open connection for hwnd 0x0.
21:11:32.807: UdCtl: Open request denied due to bad parameters.
21:11:32.807: Driver Si: Attempt to call UdCtlOpen failed

Frappin' frap! It looks like from CFrameWnd::Create I must call the parent call first before getting a HWnd. The following code works:

Code: Select all

	// Initialize 3DxWare

	CFrameWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, lpszMenuName, dwExStyle, pContext);

	SiOpenData oData;
	SiInitialize ();
	SiOpenWinInit (&oData, GetSafeHwnd());
	wchar_t buf[1000];
	wsprintf(buf, L"GetSafeHwnd: 0x%016x\n", (long long)GetSafeHwnd());
	AfxMessageBox(buf, 0, 0);

	if ((m_DevHdl = SiOpen ("App name", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &oData)) == NULL )
	{
		SiTerminate();
		AfxMessageBox(L"Sorry - No supported 3DxWare device available.\n", NULL, MB_OK);
	}
	else
	{
		AfxMessageBox(L"3DxWare device found!\n", NULL, MB_OK);
		SiSetUiMode (&m_DevHdl, SI_UI_ALL_CONTROLS);
	}
	return 1;
Thanks for the log suggestion, I wouldnt've got it w/o!
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Isn't there a better place to put that code? OnInitDialog or something that gets called after the whole create process is done?
Post Reply