Archived

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

error acquiering keyboard

Recommended Posts

First of all I already searched the forum, but didn''t found a solution to my problem. Secondly acquiering of the keyboard worked fine a couple of days ago, with the same code now my problem when I try to acquire the keyboard the first time it fails so I added this code :

if FAILED(g_hr = g_lpDIKeyboard->Acquire())
{
Write2Log("Acquiring of keyboard failed, trying again") ;
g_hr = g_lpDIKeyboard->Acquire() ;
if (FAILED(g_hr))
{
g_hr = g_lpDIKeyboard->Acquire() ;
while(g_hr == DIERR_INPUTLOST)
g_hr = g_lpDIKeyboard->Acquire() ;
Write2Log("Keyboard acquired") ;
} // end of if

//return false ;

} // end of if

else
{
Write2Log("Keyboard acquired") ;
} // end of else


btw in my Log file it says : "Acquiring of keyboard failed, trying again" and then "Keyboard acquired" later I get the same error when I try to acquire the mouse so there I also added the same code now in my menuloop I have this code :

{
g_lpDIKeyboard->GetDeviceState(sizeof(buffer),(LPVOID)&buffer) ;

if (KEYDOWN(buffer, DIK_ESCAPE))
{
// when pressing escape, exit game

g_CGE_GameState = kill ;
}

if (KEYDOWN(buffer, DIK_UP) && bKeyUp)
{
// when pressing arrow up

bKeyUp = true ;
}
else
{
bKeyUp = false ;
}

if (KEYDOWN(buffer, DIK_DOWN) && bKeyDown)
{
// when pressing arrow down

bKeyDown = true ;
}
else
{
bKeyDown = false ;
}


and in my loop I can''t use the keyboard anymore again and a couple of days ago all worked fine (then I added code for creation of fonts) if any1 could help me out here I would really apreciate it thanx in advance

• Forum Statistics

• Total Topics
628328
• Total Posts
2982098

• 22
• 9
• 9
• 13
• 11