I tried to open 3DxTest demo solution inside 3DConnexion SDK by Visual Studio 2008 and everything work fine (3D Mouse works)
Because i need to implement these code to my own project. So i create a new project Win32 windows application (empty project and then try not empty project).
With empty project: I create MyMouse.c and copy all code from 3DxTest32.h and 3DxTest32.c to it. Then compile is OK, but when i run the text didn't change.
With none empty project: same thing happens, compile is OK, but 3D Mouse didn't work.
I try to change resource file, and config file as the demo solution, but nothing change.
So, can anybody tell me why compile is OK, but it doesn't work?
Problem: 3DConnexion doesn't work
Moderator: Moderators
Re: Problem: 3DConnexion doesn't work
You may need to create a profile for your new application. What profile does the 3Dx systray icon say the driver is using when your application is in focus?
-
- Posts: 7
- Joined: Mon Jul 08, 2013 2:24 am
Re: Problem: 3DConnexion doesn't work
I create new profile name mymouse as your instruction and it still doesn't work. I think the different is res/app.rc2 file, don't i?
-
- Posts: 7
- Joined: Mon Jul 08, 2013 2:24 am
Re: Problem: 3DConnexion doesn't work
Code: Select all
VS_VERSION_INFO VERSIONINFO
FILEVERSION IDR_3DXTEST_FILEVERSION_NUM
PRODUCTVERSION IDR_3DXWINCORE_PRODUCTVERSION_NUM
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "3DxTest Application"
VALUE "FileVersion", IDR_3DXTEST_FILEVERSION_STR
VALUE "InternalName", "3DxTest"
VALUE "LegalCopyright", IDR_LEGALCOPYRIGHT_ENUS
VALUE "OriginalFilename", "3DxTest.exe"
VALUE "ProductName", " 3DxTest Application"
VALUE "ProductVersion", IDR_3DXWINCORE_PRODUCTVERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
-
- Posts: 7
- Joined: Mon Jul 08, 2013 2:24 am
Re: Problem: 3DConnexion doesn't work
Here is my sample code, can you show me what is the problem? Because compile and run are OK, but i can not get 3DMouse handle.
Code: Select all
#include <windows.h>
#include <stdio.h>
#include "spwmacro.h" /* Common macros used by SpaceWare functions. */
#include "si.h" /* Required for any SpaceWare support within an app.*/
#include "siapp.h" /* Required for siapp.lib symbols */
SiOpenData oData; /* Platform-specific device data */
SiGetEventData eData; /* Platform-specific event data */
SiHdl hdl; /* 3DxWare device handle */
SiSpwEvent siEvent; /* 3DxWare data event */
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 8 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, // window class name
TEXT ("HelloWin"), // window caption
WS_OVERLAPPEDWINDOW, // window style
100, // initial x position
100, // initial y position
230, // initial x size
280, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL) ; // creation parameters
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
SiOpenWinInit (&oData, hwnd);
if ( (hdl = SiOpen ("HelloWin", SI_ANY_DEVICE, SI_NO_MASK,
SI_EVENT, &oData)) == SI_NO_HANDLE);
{
/* Get and display initialization error */
MessageBox (NULL, TEXT ("Could not open a 3DxWare device"),
szAppName, MB_ICONERROR) ;
}
while (GetMessage (&msg, NULL, 0, 0))
{
SiGetEventWinInit (&eData, msg.message, msg.wParam,
msg.lParam);
if (SiGetEvent (hdl, 0, &eData, &siEvent) == SI_IS_EVENT)
{
switch (siEvent.type)
{
case SI_MOTION_EVENT:
break;
case SI_ZERO_EVENT:
break;
case SI_BUTTON_EVENT:
break;
default:
break;
} /* end switch on 3DxWare event type*/
} /* end if the event was a 3DxWare event */
else
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
/*
* Close connection to the 3DxWare driver.
*/
SiClose (hdl);
SiTerminate ();
return msg.wParam ;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc ;
PAINTSTRUCT ps ;
switch (message)
{
case WM_CREATE:
return 0 ;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
EndPaint (hwnd, &ps) ;
printf("Paint");
return 0 ;
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
-
- Posts: 7
- Joined: Mon Jul 08, 2013 2:24 am
Re: Problem: 3DConnexion doesn't work
Oh gosh, the stupid error i have met. Can you distinguish 2 blocks of code below?
This code is work
This code is not
Because i copy it from document SDK, some fonts not work, i need to type on my own and then it works
This code is work
Code: Select all
SiOpenWinInit (&oData, hWnd);
if ( (hdl = SiOpen ("app name", SI_ANY_DEVICE, SI_NO_MASK,
SI_EVENT, &oData)) == SI_NO_HANDLE);
{
/* Get and display initialization error */
MessageBox (hWnd, "Could not open a 3DxWare device", NULL,
MB_ICONSTOP | MB_OK);
}
Code: Select all
SiOpenWinInit (&oData, hWnd);
if ( (hdl = SiOpen ("app name", SI_ANY_DEVICE, SI_NO_MASK,
SI_EVENT, &oData)) == SI_NO_HANDLE);
{
/* Get and display initialization error */
MessageBox (hWnd, "Could not open a 3DxWare device", NULL,
MB_ICONSTOP | MB_OK);
}
Re: Problem: 3DConnexion doesn't work
You have a suspicious semi-colon at the end of an if() statement.
There are no differences between the code snippets.
Did I win? Where's my prize?
There are no differences between the code snippets.
Did I win? Where's my prize?