Skip to main content
gamedev.net
🔒 Locked

Weird acquire error

Started by The C modest god Oct 26, 2005 at 4:43 AM 4 replies 750+ views
Original Post
The C modest god
The C modest god
In directinput8, is it possible that acquire of directInputDevice8 will throw the following error: The specified property cannot be changed. This value is equal to the E_ACCESSDENIED standard COM return value. What does this error means in respect to acquire? Thanks in advance.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:
DesignerX
DesignerX
A qoute from the SDK :

Another application has a higher priority level, preventing this call from succeeding. This value is equal to the E_ACCESSDENIED standard COM return value. This error can be returned when an application has only foreground access to a device but is attempting to acquire the device while in the background.
There is nothing that can't be solved. Just people that can't solve it. :)
The C modest god
The C modest god
Quote:
Original post by DesignerX
A qoute from the SDK :

Another application has a higher priority level, preventing this call from succeeding. This value is equal to the E_ACCESSDENIED standard COM return value. This error can be returned when an application has only foreground access to a device but is attempting to acquire the device while in the background.

This is not the same error. The error I got was DIERR_READONLY.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:
The C modest god
The C modest god
What I did is pass as a parameter the buffer size of the buffered mouse and then set the property of buffer size in the mouse.
So should I only create the input device and get the property of the buffer size without trying to change it?
Is that the way to do it?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:
DesignerX
DesignerX
Can you write you input initalization code here ?
There is nothing that can't be solved. Just people that can't solve it. :)
The C modest god
The C modest god
Gladly
void InputDevice::Initialize (LPDIRECTINPUT8 pDInput, DIDEVICEINSTANCE & DIDInstance, DWORD dwFlags, HWND hWnd){	this->LocalFree();	this->hWnd = hWnd;	this->pDeviceData = &DIDInstance	GlobalError::pErrH->HandleDirectInputError (pDInput->CreateDevice (DIDInstance.guidInstance, &this->pDevice, NULL));	memset (&this->Caps, 0, sizeof(DIDEVCAPS));	this->Caps.dwSize = sizeof(DIDEVCAPS);	GlobalError::pErrH->HandleDirectInputError (this->pDevice->GetCapabilities (&this->Caps));	this->ObjectInstances.Initialize (512);	this->ObjectInstanceAmount = 0;	GlobalError::pErrH->HandleDirectInputError (this->pDevice->EnumObjects (MYDIEnumDeviceObjectsCallback, this, DIDFT_ALL));	this->ObjectInstances.KeepDataAndReduce (this->ObjectInstanceAmount);	GlobalError::pErrH->HandleDirectInputError (this->pDevice->SetCooperativeLevel(hWnd, dwFlags));	this->bStatePoll = FALSE;	if (this->GetCaps().dwFlags&DIDC_POLLEDDEVICE)		this->bStatePoll = TRUE;}voidInputDevice::InitializeSimpleMouse (LPDIRECTINPUT8 pDInput, DIDEVICEINSTANCE & DIDInstance, DWORD dwFlags, HWND hWnd, DWORD BufferSize, LogFile & LogF){	DIDATAFORMAT Format;	DWORD counter, CurrentObject, CurrentByte;	this->LocalFree();	this->Initialize (pDInput, DIDInstance, dwFlags, hWnd);	this->bRelativeAxes = TRUE;	this->pLogF = &LogF	if (this->GetCaps().dwAxes>2)		this->dwObjectsAmount = 2;	else		this->dwObjectsAmount = this->GetCaps().dwAxes;	this->dwObjectsAmount+=this->GetCaps().dwButtons;	this->pObjectData = new DIOBJECTDATAFORMAT[this->dwObjectsAmount];	this->Buffer.Initialize (BufferSize);	Format.dwSize = sizeof (DIDATAFORMAT);	Format.dwFlags = DIDF_RELAXIS;	Format.dwObjSize = sizeof (DIOBJECTDATAFORMAT);	Format.dwNumObjs = this->dwObjectsAmount;	Format.rgodf = this->pObjectData;	CurrentByte = 0;	CurrentObject = 0;	for (counter=0; (counter<2) && (counter<this->GetCaps().dwAxes); counter++)	{		(this->pObjectData+CurrentObject)->pguid = NULL;		(this->pObjectData+CurrentObject)->dwOfs = CurrentByte;		(this->pObjectData+CurrentObject)->dwType = DIDFT_AXIS | DIDFT_ANYINSTANCE;		(this->pObjectData+CurrentObject)->dwFlags = 0;		CurrentObject++;		CurrentByte+=4;	}	for (; counter<this->dwObjectsAmount; counter++)	{		(this->pObjectData+CurrentObject)->pguid = NULL;		(this->pObjectData+CurrentObject)->dwOfs = CurrentByte;		(this->pObjectData+CurrentObject)->dwType = DIDFT_BUTTON | DIDFT_ANYINSTANCE;		(this->pObjectData+CurrentObject)->dwFlags = 0;		CurrentObject++;		CurrentByte+=1;	}	Format.dwDataSize = (!!(CurrentByte%4)+(CurrentByte/4))*4;	this->SetDataFormat (&Format);	this->SetPropertyWORD (DIPROP_BUFFERSIZE, (BYTE)this->Buffer.GetObjectsAmount());	this->CurrentObjectsAmount = 0;}void InputDevice::SetPropertyWORD (REFGUID PropType, WORD Data){	DIPROPDWORD DIWord;	DIPROPHEADER DIProp;	DIProp.dwHeaderSize = sizeof(DIPROPHEADER);	DIProp.dwSize = sizeof (DIPROPDWORD);	DIProp.dwHow = DIPH_DEVICE;	DIProp.dwObj = 0;	DIWord.diph = DIProp;	DIWord.dwData = Data;	GlobalError::pErrH->HandleDirectInputError (this->pDevice->SetProperty (PropType, &DIProp));}
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.