Archived

This topic is now archived and is closed to further replies.

Ilankt

IDirectInputDevice8::SetDataFormat cause my program to quit...!

Recommended Posts

i really dont know why, but every time i''m usint IDirectInputDevice8::SetDataFormat, the program quits... no errors, she just quit... why??? here is all my code(as before):
if(FAILED(DirectInput8Create(g_hInst,DIRECTINPUT_VERSION,IID_IDirectInput8,(void**)&g_pDI,NULL)))
   {
      MessageBox(g_hWnd,"DI: 1","Error",MB_OK);
      return FALSE;
   }
   if(FAILED(g_pDI->CreateDevice(GUID_SysKeyboard,&g_pDIDevice,NULL)))
   {
      MessageBox(g_hWnd,"DI: 2","Error",MB_OK);
      return FALSE;
   }
  	if(FAILED(g_pDIDevice->SetDataFormat(&c_dfDIKeyboard)))//THIS CAUSE THE PROGRAM TO QUIT

	{
	   
      MessageBox(NULL,"DI: 3","Error",MB_OK);
		return FALSE;
	}
   if(FAILED(g_pDIDevice->SetCooperativeLevel(g_hWnd,DISCL_FOREGROUND | DISCL_NONEXCLUSIVE)))
   {
      MessageBox(g_hWnd,"DI: 4","Error",MB_OK);
      return FALSE;
   }
   if(FAILED(g_pDIDevice->Acquire()))
	{
		MessageBox(NULL,"DI:5",NULL,MB_OK);
		return FALSE;
	}

Share this post


Link to post
Share on other sites