Advertisement

Direct Input start fails

Started by May 27, 2001 12:48 PM
-1 comments, last by mikesc 23 years, 8 months ago
When I call my DirectInput Init-Function,the programm crashes. Here is the function : int CInput::DI_Init(void) { CWindow Window; if ( DirectInputCreateEx( Window.hInstance, DIRECTINPUT_VERSION, IID_IDirectInput7, (void**)&g_DI, NULL ) ) { return(false); } if ( g_DI->CreateDeviceEx( GUID_SysKeyboard, IID_IDirectInputDevice7, (void**)&g_KDIDev, NULL ) ) { return(false); } if ( g_KDIDev->SetDataFormat(&c_dfDIKeyboard) ) { return(false); } if ( g_KDIDev->SetCooperativeLevel(Window.hWnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE) ) { return(false); } if (g_KDIDev) g_KDIDev->Acquire(); else return(false); return(true); } The Class : class CInput { public: int DI_Init(void); void DX_End(void); void GetState(void); bool CheckKey(unsigned char key); CInput(); BYTE buffer[256]; LPDIRECTINPUT7 g_DI; LPDIRECTINPUTDEVICE7 g_KDIDev; }; must I have a constructor for the device objects or the buffer ,and to wich value must I set them ? Thank you.

This topic is closed to new replies.

Advertisement