Skip to main content
gamedev.net
🔒 Locked

DirectInput - SetCooperativeLevel()

Started by andyb716 Dec 21, 2004 at 11:34 AM 2 replies 900+ views
Original Post
andyb716
andyb716
Hi, I'm trying to make a mouse class, but it gives me this complier error when I try to run it. 'Microsoft.DirectX.DirectInput.Device.SetCooperativeLevel(System.IntPtr, Microsoft.DirectX.DirectInput.CooperativeLevelFlags)' is inaccessible due to its protection level


private Device m_DIDevice = null;

public Mouse(IntPtr windowPtr)
{
	m_DIDevice = new Device(SystemGuid.Mouse);
	m_DIDevice.SetCooperativeLevel(windowPtr, CooperativeLevelFlags.Background | CooperativeLevelFlags.NonExclusive);
	m_DIDevice.Properties.AxisModeAbsolute = true;
	m_DIDevice.Acquire();
}


andyb716
andyb716
Has anybody else had this problem?
TheMac
TheMac
I have, and I'm using the same code. I spend an entire day with that problem, and finally just gave up on it. Can't help, but thought I'd say I have the same problem.
andyb716
andyb716
I figured it out it was the IntPtr I was passing in it should be a Control

private Device m_DIDevice = null;public Mouse(Control Owner){	m_DIDevice = new Device(SystemGuid.Mouse);	m_DIDevice.SetCooperativeLevel(Owner, CooperativeLevelFlags.Background | CooperativeLevelFlags.NonExclusive);	m_DIDevice.Properties.AxisModeAbsolute = true;	m_DIDevice.Acquire();}

Topic Locked

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

Sign in to reply to this topic.