问题描述
我正在使用directx 9.0c托管,我想访问我的触摸屏设备。
I'm working with directx 9.0c managed, and i would like to acces to my touchscreen device.
要初始化此设备,我会这样做
To initialize this device i do that
private static Microsoft.DirectX.DirectInput.Device touchscreenDevice;
public static void TouchscreenDeviceInit(Control _controlRender)
{
Microsoft.DirectX.DirectInput.CooperativeLevelFlags coopFlags;
coopFlags = Microsoft.DirectX.DirectInput.CooperativeLevelFlags.Exclusive;
coopFlags | = Microsoft.DirectX.DirectInput.CooperativeLevelFlags.Foreground;
TouchscreenDeviceInit(_controlRender,coopFlags);
}
public static void TouchscreenDeviceInit(Control _controlRender,Microsoft.DirectX.DirectInput.CooperativeLevelFlags _coopFlags)
{
DeviceList gameControllerList = Microsoft.DirectX。 DirectInput.Manager.GetDevices(Microsoft.DirectX.DirectInput.DeviceType.ScreenPointer,EnumDevicesFlags.AllDevices);
if(gameControllerList.Count> 0)
{
//移动到第一个设备
gameControllerList.MoveNext();
DeviceInstance deviceInstance =(DeviceInstance)gameControllerList.Current;
////从这个控制器创建一个设备。
touchscreenDevice = new Microsoft.DirectX.DirectInput.Device(deviceInstance.InstanceGuid);
touchscreenDevice.SetCooperativeLevel(_controlRender,CooperativeLevelFlags.Background | CooperativeLevelFlags.NonExclusive);
}
}
public static void TouchscreenDeviceInit(Control _controlRender) { Microsoft.DirectX.DirectInput.CooperativeLevelFlags coopFlags; coopFlags = Microsoft.DirectX.DirectInput.CooperativeLevelFlags.Exclusive; coopFlags |= Microsoft.DirectX.DirectInput.CooperativeLevelFlags.Foreground; TouchscreenDeviceInit(_controlRender, coopFlags); } public static void TouchscreenDeviceInit(Control _controlRender, Microsoft.DirectX.DirectInput.CooperativeLevelFlags _coopFlags) { DeviceList gameControllerList = Microsoft.DirectX.DirectInput.Manager.GetDevices(Microsoft.DirectX.DirectInput.DeviceType.ScreenPointer, EnumDevicesFlags.AllDevices); if (gameControllerList.Count > 0) { // Move to the first device gameControllerList.MoveNext(); DeviceInstance deviceInstance = (DeviceInstance)gameControllerList.Current; //// create a device from this controller. touchscreenDevice = new Microsoft.DirectX.DirectInput.Device(deviceInstance.InstanceGuid); touchscreenDevice.SetCooperativeLevel(_controlRender, CooperativeLevelFlags.Background | CooperativeLevelFlags.NonExclusive); } }
设备似乎已正确创建。
我打开设备
touchscreenDevice.Acquire(); //Active the device
现在,我想获取此设备的值,我不知道该怎么做。
Now, i want to get the values of this device and i don't know how to do that.
请帮助我。
推荐答案
您可以将您的问题发布到所述论坛以获得及时答复。
You can post your question to the said forum for a prompt answer.
这篇关于带有driectx的触摸屏设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!