DIDevice.h
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:3k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1998-1999 DXGuide. All Rights Reserved.
- // File: DIDevice.h
- #ifndef _DIDEVICE__H
- #define _DIDEVICE__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- #include <dinput.h>
- class CDIDevice : public CObject
- {
- friend class CDirectInput;
- DECLARE_SERIAL(CDIDevice);
- protected:
- CDIDevice(void);
- virtual ~CDIDevice();
- public:
- virtual bool Create(LPDIRECTINPUT7 lpDI, HWND hWnd);
- virtual HRESULT Update(void);
- protected:
- void SetDeviceInfo(const DIDEVICEINSTANCE* pDIDeviceInstance);
- public:
- DIDEVICEINSTANCE* GetDeviceInfo(void) const;
- LPGUID GetGuid(void) const;
- CString GetDeviceName(void) const;
- CString GetDescription(void) const;
- CString GetFullDescription(void) const;
- int GetDeviceType(void) const;
- int GetSubDeviceType(void) const;
- bool IsGeneric(void) const;
- bool IsKeyboard(void) const;
- bool IsMouse(void) const;
- bool IsJoyStick(void) const;
- int Unit(void); // get unit number
- public:
- HRESULT Acquire(void);
- HRESULT GetCapabilities(LPDIDEVCAPS lpDIDevCaps);
- HRESULT GetDeviceData(LPDIDEVICEOBJECTDATA rgdod,
- LPDWORD pdwInOut, DWORD dwFlags = 0);
- HRESULT GetDeviceInfo(LPDIDEVICEINSTANCE pdidi);
- HRESULT GetDeviceState(DWORD cbData, LPVOID lpvData);
- HRESULT GetObjectInfo(LPDIDEVICEOBJECTINSTANCE pdidoi,
- DWORD dwObj = 0, DWORD dwHow = DIPH_DEVICE);
- HRESULT GetProperty(REFGUID rguidProp, LPDIPROPHEADER pdiph);
- HRESULT Initialize(HINSTANCE hinst, DWORD dwVersion, REFGUID rguid);
- HRESULT RunControlPanel(HWND hwnd);
- protected:
- HRESULT SetCooperativeLevel(HWND hwnd, DWORD dwFlags);
- public:
- HRESULT SetDataFormat(LPCDIDATAFORMAT lpdf);
- HRESULT SetEventNotification(HANDLE hEvent);
- HRESULT SetProperty(REFGUID rguidProp, LPCDIPROPHEADER pdiph);
- HRESULT SetPropertyDword(REFGUID rguidProp, DWORD dwVal);
- HRESULT SetPropertyDword(REFGUID rguidProp, DWORD dwOffset, DWORD dwVal);
- HRESULT SetPropertyRangeID(REFGUID rguidProp, DWORD dwObj, LONG lMin, LONG lMax);
- HRESULT SetPropertyRangeOffset(REFGUID rguidProp, DWORD dwOffset, LONG lMin, LONG lMax);
- HRESULT Unacquire(void);
- HRESULT Poll(void);
- bool IsBuffered(void) const;
- HRESULT SetBuffered(DWORD dwBufferSize = 16);
- HRESULT FlushBuffer(DWORD& dwItems);
- HRESULT GetDeviceDataItems(DWORD& dwItems);
- bool IsBufferOverflow(void);
- LPDIDEVICEOBJECTDATA GetBufferData(DWORD& dwItems);
- protected:
- LPDIRECTINPUTDEVICE7 m_lpDirectInputDevice;
- protected:
- DIDEVICEINSTANCE* m_pDIDeviceInstance; // device information
- LPDIDEVICEOBJECTDATA m_pDIDeviceObjectData;
- DWORD m_dwBufferSize;
- };
- #include "DIDevice.inl"
- #endif // _DIDEVICE__H