LPDIRECTINPUTDEVICE8::Acquire() error

Started by
6 comments, last by Evil Steve 17 years, 9 months ago
Hi! I get DIERR_OTHERAPPHASPRIO error from LPDIRECTINPUTDEVICE8::Acquire() why? Thanks!
Advertisement
How about you run a search in the SDK documentation and read what it says about DIERR_OTHERAPPHASPRIO?
Sirob Yes.» - status: Work-O-Rama.
This could happen when your program is running on the background while it only has foreground acces. Do a loop until you can acquire.

I captured data from the device this way:
hr = mlpDIKeyboard->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), didod, &dwElements, 0 );if( FAILED(hr) ) {	// Error	hr = mlpDIKeyboard->Acquire();	while( hr == DIERR_INPUTLOST ) 		hr = mlpDIKeyboard->Acquire();	        // hr may be DIERR_OTHERAPPHASPRIO or other errors.  This	// may occur when the app is minimized or in the process of 	// switching, so just try again later 	return !FAILED(hr); }


You can see that I keep acquiring until it works. But when I receive your error message it just doesn't do anything.

This message can occure when you application is trying to access the device, when it is in the background, but you only have foreground access. You can avoid that by using other creation flags.

GBS
GBS
:) I can't find the solution of this problem!
Can you tell me excactly when you receive the error, is your window selected? Is it foreground or background? And with what flags did you create the device?

GBS
GBS
	//	keyboard	hr = IO_Object->CreateDevice(GUID_SysKeyboard, &IO_KeyboardDevice, NULL);	if(FAILED(hr)){		e2::Error("Error(1):", ERR_LEVEL0);		return -1;	}	hr=IO_KeyboardDevice->SetDataFormat( &c_dfDIKeyboard );	if(FAILED(hr)){		e2::Error("Error(2):", ERR_LEVEL0);		return -1;	}	hr = IO_KeyboardDevice->SetCooperativeLevel(MainWindowHandle, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);	if(FAILED(hr)){		e2::Error("Error(3):", ERR_LEVEL0);		return -1;	}	IO_KeyboardDevice->Acquire();      // ***
Thank you for the information.

Here again a piece of code straight out of my engine:

// Blabla initialization of the keyboard device, setting buffer size etc.// Try to aqcuirehr = mlpDIKeyboard->Acquire();if (FAILED(hr) && hr != DIERR_OTHERAPPHASPRIO){      // Error here (not shown)}


As you can see here I dont care if this error pops up straight after initialization. This is because it's possible that when you create the device your window is still in the background. (Very likely in your case)

It doesnt matter that you receive the DIERR_OTHERAPPHASPRIO error. You can just ignore it. As long as you acquire it on a latter time.

Hope this helps,

GBS
GBS
As GraphicsBas said, you can;t acquire your device immediately after creating the window, because it isn't properly constructed yet. You need to wait till you've processed a few window message first, or request background access instead of foreground.

This topic is closed to new replies.

Advertisement