Direct Input start fails
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
Popular Topics
Advertisement
Recommended Tutorials
Advertisement