Post questions, comments and feedback to our 3Dconnexion Windows Development Team.
Moderator: Moderators
malfatti
Posts: 6 Joined: Wed May 08, 2013 6:42 am
Post
by malfatti » Mon Jul 22, 2013 7:57 am
Hi all!
I´am writing you expecting some help because I no have ideia how to solve my problem.
I have two codes, the first is the 3DxTest that comes with 3DConnecion SDK. This code works rigth. The problem is, that in my opengl graphics application, that I use the same code that 3DTests, the function SiOpen returns NULL;
Here is my codes:
Code: Select all
bool CVRMouse3D::Init(HWND hWndMain)
{
//variaveis locais
int res;
SiOpenData oData;
//Inicialização do dispositivo
if (SiInitialize() == SPW_DLL_LOAD_ERROR)
{
return false;
}
SiOpenWinInit(&oData, hWndMain);
SiSetUiMode(NULL, SI_UI_ALL_CONTROLS);
devHdl = SiOpen ("DefaultApp", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &oData);
return devHdl ? true : false;
}
I have tested the hwndmain reference and its a valid pointer. Some ideia?
Thank you!
malfatti
Posts: 6 Joined: Wed May 08, 2013 6:42 am
Post
by malfatti » Mon Jul 22, 2013 8:48 am
Here is the code that I use to create my Window:
Code: Select all
void CVRWindow::Show()
{
WNDCLASSEX windowClass;//Window class
DWORD dwExStyle;//Window extended style
DWORD dwStyle;//Window style
RECT windowRect;//Rect used to store the window dimensions
/*Init window rect values*/
windowRect.left = (long) 0;
windowRect.right = lWindowWidth;
windowRect.top = (long) 0;
windowRect.bottom = lWindowHeight;
/*Fill out the window class structure*/
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.lpfnWndProc = MainWindowProc;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = hInstance;
windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);//Default icon
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);//Default arrow
windowClass.hbrBackground = NULL;//Don´t need background
windowClass.lpszMenuName = NULL;//No Menu
windowClass.lpszClassName = "DefaultApp";//Window class name
windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO);//Windows logo small
//Register the window class
if (!RegisterClassEx(&windowClass))
{
return;
}
/*Testing the fullScreen flag*/
if (bFullScreen)
{
DEVMODE dmScreenSettings;//Device mode
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));//Inits the device
dmScreenSettings.dmSize = sizeof(dmScreenSettings);//configure the size
dmScreenSettings.dmPelsWidth = lWindowWidth;//Screen width
dmScreenSettings.dmPelsHeight = lWindowHeight;//Screen height
dmScreenSettings.dmBitsPerPel = uiWindowDepth;//bits per pixel
dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;//Config the pixels type
/*Test if the screen change was sucessful*/
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
{
//Setting display mode failed, switch to windowed
MessageBox(NULL, "Configuração de vídeo não disponível",NULL, MB_OK);//Show the error message
bFullScreen = false;//Change resolution back
}
}
//Verify if we are still in fullscreen mode
if (bFullScreen)
{
dwExStyle = WS_EX_APPWINDOW;
dwStyle = WS_POPUP;
ShowCursor(FALSE);
}
else
{
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
dwStyle = WS_CAPTION |WS_SYSMENU;
}
/*****Adjust window to true requested size******/
AdjustWindowRectEx(&windowRect,dwStyle, FALSE, dwExStyle);
/******Class registered, so now we will create our window*****/
hwnd = CreateWindowEx(NULL,
"DefaultApp",
cTitle,
dwStyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
xPos, yPos,
windowRect.right - windowRect.left,
windowRect.bottom - windowRect.top,
NULL,
NULL,
hInstance,
NULL);
/******Show the window*****/
ShowWindow(hwnd,SW_SHOW);
UpdateWindow ( hwnd );
}
malfatti
Posts: 6 Joined: Wed May 08, 2013 6:42 am
Post
by malfatti » Mon Jul 22, 2013 4:39 pm
Trying to solve this problem I paste the code of my project into that visual studio project that comes with SDK and works!
So my conclusion is that in my own project exist some missing configuration parameter!
I will to comare both projects to discover what is missing.
regargs.