Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

625 lines
20 KiB

  1. // DIConfigTestDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "DIConfigTest.h"
  5. #include "DIConfigTestDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CAboutDlg dialog used for App About
  13. class CAboutDlg : public CDialog
  14. {
  15. public:
  16. CAboutDlg();
  17. // Dialog Data
  18. //{{AFX_DATA(CAboutDlg)
  19. enum { IDD = IDD_ABOUTBOX };
  20. //}}AFX_DATA
  21. // ClassWizard generated virtual function overrides
  22. //{{AFX_VIRTUAL(CAboutDlg)
  23. protected:
  24. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  25. //}}AFX_VIRTUAL
  26. // Implementation
  27. protected:
  28. //{{AFX_MSG(CAboutDlg)
  29. //}}AFX_MSG
  30. DECLARE_MESSAGE_MAP()
  31. };
  32. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  33. {
  34. //{{AFX_DATA_INIT(CAboutDlg)
  35. //}}AFX_DATA_INIT
  36. }
  37. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  38. {
  39. CDialog::DoDataExchange(pDX);
  40. //{{AFX_DATA_MAP(CAboutDlg)
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  44. //{{AFX_MSG_MAP(CAboutDlg)
  45. // No message handlers
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CDIConfigTestDlg dialog
  50. CDIConfigTestDlg::CDIConfigTestDlg(CWnd* pParent /*=NULL*/)
  51. : CDialog(CDIConfigTestDlg::IDD, pParent)
  52. {
  53. //{{AFX_DATA_INIT(CDIConfigTestDlg)
  54. m_bEditConfiguration = FALSE;
  55. m_bEditLayout = FALSE;
  56. //}}AFX_DATA_INIT
  57. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  58. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  59. }
  60. void CDIConfigTestDlg::DoDataExchange(CDataExchange* pDX)
  61. {
  62. CDialog::DoDataExchange(pDX);
  63. //{{AFX_DATA_MAP(CDIConfigTestDlg)
  64. DDX_Check(pDX, IDC_EDITCFG, m_bEditConfiguration);
  65. DDX_Check(pDX, IDC_EDITLAYOUT, m_bEditLayout);
  66. //}}AFX_DATA_MAP
  67. }
  68. BEGIN_MESSAGE_MAP(CDIConfigTestDlg, CDialog)
  69. //{{AFX_MSG_MAP(CDIConfigTestDlg)
  70. ON_WM_SYSCOMMAND()
  71. ON_WM_PAINT()
  72. ON_WM_QUERYDRAGICON()
  73. ON_BN_CLICKED(IDC_VIAFRAME, OnViaFrame)
  74. ON_BN_CLICKED(IDC_VIADI, OnViaDI)
  75. //}}AFX_MSG_MAP
  76. END_MESSAGE_MAP()
  77. /////////////////////////////////////////////////////////////////////////////
  78. // CDIConfigTestDlg message handlers
  79. class sint
  80. {
  81. public:
  82. sint() : blint(0) {boink();}
  83. sint(int i ) : blint(i) {boink();}
  84. ~sint() {static volatile int i = 0; i++;}
  85. void boink() {static volatile int i = 0; i++;}
  86. int blint;
  87. };
  88. BOOL CDIConfigTestDlg::OnInitDialog()
  89. {
  90. CDialog::OnInitDialog();
  91. // Add "About..." menu item to system menu.
  92. // IDM_ABOUTBOX must be in the system command range.
  93. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  94. ASSERT(IDM_ABOUTBOX < 0xF000);
  95. CMenu* pSysMenu = GetSystemMenu(FALSE);
  96. if (pSysMenu != NULL)
  97. {
  98. CString strAboutMenu;
  99. strAboutMenu.LoadString(IDS_ABOUTBOX);
  100. if (!strAboutMenu.IsEmpty())
  101. {
  102. pSysMenu->AppendMenu(MF_SEPARATOR);
  103. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  104. }
  105. }
  106. // Set the icon for this dialog. The framework does this automatically
  107. // when the application's main window is not a dialog
  108. SetIcon(m_hIcon, TRUE); // Set big icon
  109. SetIcon(m_hIcon, FALSE); // Set small icon
  110. // TODO: Add extra initialization here
  111. Init();
  112. m_bEditConfiguration = TRUE;
  113. m_bEditLayout = TRUE;
  114. UpdateData(FALSE);
  115. CList<sint, sint> Fraggle, doig;
  116. Fraggle.AddTail(1);
  117. Fraggle.AddTail(10);
  118. Fraggle.AddTail(199);
  119. Fraggle.AddTail(991);
  120. doig.AddTail(&Fraggle);
  121. Fraggle.AddTail(&doig);
  122. return TRUE; // return TRUE unless you set the focus to a control
  123. }
  124. DWORD CDIConfigTestDlg::GetCDFlags()
  125. {
  126. UpdateData();
  127. return m_bEditConfiguration ? DICD_EDIT : DICD_DEFAULT;
  128. }
  129. void CDIConfigTestDlg::OnSysCommand(UINT nID, LPARAM lParam)
  130. {
  131. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  132. {
  133. CAboutDlg dlgAbout;
  134. dlgAbout.DoModal();
  135. }
  136. else
  137. {
  138. CDialog::OnSysCommand(nID, lParam);
  139. }
  140. }
  141. // If you add a minimize button to your dialog, you will need the code below
  142. // to draw the icon. For MFC applications using the document/view model,
  143. // this is automatically done for you by the framework.
  144. void CDIConfigTestDlg::OnPaint()
  145. {
  146. if (IsIconic())
  147. {
  148. CPaintDC dc(this); // device context for painting
  149. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  150. // Center icon in client rectangle
  151. int cxIcon = GetSystemMetrics(SM_CXICON);
  152. int cyIcon = GetSystemMetrics(SM_CYICON);
  153. CRect rect;
  154. GetClientRect(&rect);
  155. int x = (rect.Width() - cxIcon + 1) / 2;
  156. int y = (rect.Height() - cyIcon + 1) / 2;
  157. // Draw the icon
  158. dc.DrawIcon(x, y, m_hIcon);
  159. }
  160. else
  161. {
  162. CDialog::OnPaint();
  163. }
  164. }
  165. // The system calls this to obtain the cursor to display while the user drags
  166. // the minimized window.
  167. HCURSOR CDIConfigTestDlg::OnQueryDragIcon()
  168. {
  169. return (HCURSOR) m_hIcon;
  170. }
  171. #define TOW(a) L##a
  172. LPWSTR names[] = {TOW("My Name!")};
  173. /*// {D20376C0-819C-11d3-8FB2-00C04F8EC627}
  174. static const GUID g_AppGuid =
  175. { 0xd20376c0, 0x819c, 0x11d3, { 0x8f, 0xb2, 0x0, 0xc0, 0x4f, 0x8e, 0xc6, 0x27 } };
  176. */
  177. static const GUID g_AppGuid =
  178. { 0x238d8220, 0x7a5d, 0x11d3, { 0x8f, 0xb2, 0x0, 0xc0, 0x4f, 0x8e, 0xc6, 0x27 } };
  179. void CDIConfigTestDlg::Init()
  180. {
  181. #define NUMBER_OF_SEMANTICS 18
  182. //for axes commands: AXIS_LR and AXIS_UD
  183. #define AXIS_MASK 0x80000000l
  184. #define AXIS_LR (AXIS_MASK | 1)
  185. #define AXIS_UD (AXIS_MASK | 2)
  186. // "Keyboard" commands
  187. #define KEY_STOP 0x00000001l
  188. #define KEY_DOWN 0x00000002l
  189. #define KEY_LEFT 0x00000004l
  190. #define KEY_RIGHT 0x00000008l
  191. #define KEY_UP 0x00000010l
  192. #define KEY_FIRE 0x00000020l
  193. #define KEY_THROW 0x00000040l
  194. #define KEY_SHIELD 0x00000080l
  195. #define KEY_DISPLAY 0x00000100l
  196. #define KEY_QUIT 0x00000200l
  197. #define KEY_EDIT 0x00000400l
  198. static DIACTIONW g_rgGameAction[] = {
  199. {AXIS_UD, DIAXIS_FPS_MOVE, 0, TOW("Forward"),},
  200. {AXIS_LR, DIAXIS_FPS_ROTATE, 0, TOW("Rotate"),},
  201. {KEY_FIRE, DIBUTTON_FPS_FIRE, 0, TOW("Fire"),},
  202. {KEY_THROW, DIBUTTON_FPS_WEAPONS, 0, TOW("Change Weapon"),},
  203. {KEY_SHIELD, DIBUTTON_FPS_APPLY, 0, TOW("Shield"),},
  204. {KEY_STOP, DIBUTTON_FPS_SELECT, 0, TOW("Pause"),},
  205. {KEY_THROW, DIBUTTON_FPS_CROUCH, 0, TOW("Hyper space"),},
  206. {KEY_THROW, DIBUTTON_FPS_JUMP, 0, TOW("Launch Probe"),},
  207. {KEY_DISPLAY,DIBUTTON_FPS_DISPLAY, 0, TOW("Display"),},
  208. {KEY_QUIT, DIBUTTON_FPS_MENU, 0, TOW("Quit Game"),},
  209. {KEY_EDIT, DIBUTTON_FPS_DODGE, 0, TOW("Edit Configuration"),},
  210. {KEY_LEFT, DIKEYBOARD_LEFT, 0, TOW("Turn +"),},
  211. {KEY_RIGHT, DIKEYBOARD_RIGHT, 0, TOW("Turn -"),},
  212. {KEY_UP, DIKEYBOARD_UP, 0, TOW("Move Up"),},
  213. {KEY_DOWN, DIKEYBOARD_DOWN, 0, TOW("Move Down"),},
  214. {KEY_STOP, DIKEYBOARD_S, 0, TOW("Stop Game"),},
  215. {KEY_FIRE, DIKEYBOARD_SPACE, 0, TOW("Shoot"),},
  216. {KEY_THROW, DIKEYBOARD_T, 0, TOW("Throw"),},
  217. {KEY_SHIELD, DIKEYBOARD_H, 0, TOW("Shield"),},
  218. {KEY_DISPLAY,DIKEYBOARD_D, 0, TOW("Display"),},
  219. {KEY_QUIT, DIKEYBOARD_Q, 0, TOW("Quit Game"),},
  220. {KEY_EDIT, DIKEYBOARD_E, 0, TOW("Edit Configuration"),},
  221. {AXIS_LR, DIMOUSE_XAXIS, 0, TOW("Turn"), },
  222. {AXIS_UD, DIMOUSE_YAXIS, 0, TOW("Move"), },
  223. {KEY_FIRE, DIMOUSE_BUTTON0, 0, TOW("Fire"), },
  224. {KEY_SHIELD, DIMOUSE_BUTTON1, 0, TOW("Shield"),},
  225. {KEY_THROW, DIMOUSE_BUTTON2, 0, TOW("Change Weapon"),},
  226. // {KEY_THROW, DIMOUSE_BUTTON3, 0, TOW("Hyper Space"),},
  227. // {KEY_THROW, DIMOUSE_BUTTON4, 0, TOW("Launch Probe"),},
  228. // {KEY_THROW, DIMOUSE_WHEEL, 0, TOW("Next Level"),},
  229. };
  230. /* {AXIS_LR, DIAXIS_SPACESIM_LATERAL, 0, TOW("Turn"),},
  231. {AXIS_UD, DIAXIS_SPACESIM_MOVE, 0, TOW("Move"),},
  232. {KEY_FIRE, DIBUTTON_SPACESIM_FIRE, 0, TOW("Shoot"),},
  233. {KEY_STOP, DIBUTTON_SPACESIM_TARGET, 0, TOW("Stop Game"),},
  234. {KEY_THROW, DIBUTTON_SPACESIM_WEAPONS, 0, TOW("Throw"),},
  235. {KEY_SHIELD, DIBUTTON_SPACESIM_GEAR, 0, TOW("Shield"),},
  236. {KEY_DISPLAY,DIBUTTON_SPACESIM_DISPLAY, 0, TOW("Display"),},
  237. {KEY_QUIT, DIBUTTON_SPACESIM_MENU, 0, TOW("Quit Game"),},
  238. {KEY_LEFT, DIPHYSICAL_KEYBOARD | DIK_LEFT, 0, TOW("Turn anti-clockwise"),},
  239. {KEY_RIGHT, DIPHYSICAL_KEYBOARD | DIK_RIGHT, 0, TOW("Turn clockwise"),},
  240. {KEY_UP, DIPHYSICAL_KEYBOARD | DIK_UP, 0, TOW("Move Up"),},
  241. {KEY_DOWN, DIPHYSICAL_KEYBOARD | DIK_DOWN, 0, TOW("Move Down"),},
  242. {KEY_STOP, DIPHYSICAL_KEYBOARD | DIK_S, 0, TOW("Stop Game"),},
  243. {KEY_FIRE, DIPHYSICAL_KEYBOARD | DIK_F, 0, TOW("Shoot"),},
  244. {KEY_THROW, DIPHYSICAL_KEYBOARD | DIK_T, 0, TOW("Throw"),},
  245. {KEY_SHIELD, DIPHYSICAL_KEYBOARD | DIK_H, 0, TOW("Shield"),},
  246. {KEY_DISPLAY,DIPHYSICAL_KEYBOARD | DIK_D, 0, TOW("Display"),},
  247. {KEY_QUIT, DIPHYSICAL_KEYBOARD | DIK_Q, 0, TOW("Quit Game"),}};
  248. */
  249. ZeroMemory(&m_diActF, sizeof(DIACTIONFORMATW));
  250. m_diActF.dwSize = sizeof(DIACTIONFORMATW);
  251. m_diActF.dwActionSize = sizeof(DIACTIONW);
  252. wcscpy(m_diActF.tszApplicationName, TOW("FF Donuts"));
  253. m_diActF.guidApplication = g_AppGuid;
  254. m_diActF.dwGenre = DIVIRTUAL_FIGHTING_FPS;
  255. m_diActF.dwNumActions = sizeof(g_rgGameAction) / sizeof(DIACTIONW);
  256. m_diActF.dwDataSize = m_diActF.dwNumActions * sizeof(DWORD);
  257. m_diActF.rgoAction = g_rgGameAction;
  258. m_diActF.lAxisMin = -100;
  259. m_diActF.lAxisMax = 100;
  260. m_diActF.dwBufferSize = 16;
  261. }
  262. void GetDIHResultStrings(HRESULT hr, CString *pHR, CString *pMeaning);
  263. void CDIConfigTestDlg::OnViaFrame()
  264. {
  265. // AfxMessageBox(_T("Disabled"));
  266. Prepare();
  267. //load up the dll containing the framework, and run it
  268. IDirectInputActionFramework* pIFrame = NULL;
  269. HRESULT hres = ::CoCreateInstance(CLSID_CDirectInputActionFramework, NULL, CLSCTX_INPROC_SERVER, IID_IDIActionFramework, (LPVOID*)&pIFrame);
  270. if (SUCCEEDED(hres))
  271. {
  272. hres = pIFrame->ConfigureDevices(NULL, &m_Params, GetCDFlags(), NULL);
  273. pIFrame->Release();
  274. if (FAILED(hres))
  275. {
  276. CString str, hr, m;
  277. GetDIHResultStrings(hres, &hr, &m);
  278. str.Format(_T("ConfigureDevices() failed!\n\nhres = %s\n\n%s"), (LPCTSTR)hr, (LPCTSTR)m);
  279. AfxMessageBox(str, MB_ICONERROR);
  280. }
  281. }
  282. else
  283. {
  284. AfxMessageBox(_T("Couldn't load Dll!"), MB_ICONERROR);
  285. }
  286. }
  287. void CDIConfigTestDlg::OnViaDI()
  288. {
  289. Prepare();
  290. //set up DInput and call ConfigureDevices
  291. IDirectInput8W* pDInput = NULL;
  292. HRESULT hres = S_OK;
  293. DWORD dwVer = DIRECTINPUT_VERSION;
  294. if (SUCCEEDED(hres = DirectInputCreateEx(AfxGetApp()->m_hInstance, dwVer, IID_IDirectInput8W, (LPVOID *)&pDInput, NULL)))
  295. {
  296. BOOL bChanged = FALSE;
  297. hres = pDInput->ConfigureDevices(NULL, &m_Params, GetCDFlags(), NULL);
  298. pDInput->Release();
  299. if (FAILED(hres))
  300. {
  301. CString str, hr, m;
  302. GetDIHResultStrings(hres, &hr, &m);
  303. str.Format(_T("ConfigureDevices() failed!\n\nhres = %s\n\n%s"), (LPCTSTR)hr, (LPCTSTR)m);
  304. int ret = AfxMessageBox(str, MB_ICONERROR);
  305. }
  306. }
  307. }
  308. // {FD4ACE13-7044-4204-8B15-095286B12EAD}
  309. static const GUID GUID_DIConfigAppEditLayout =
  310. { 0xfd4ace13, 0x7044, 0x4204, { 0x8b, 0x15, 0x9, 0x52, 0x86, 0xb1, 0x2e, 0xad } };
  311. void CDIConfigTestDlg::Prepare()
  312. {
  313. UpdateData();
  314. if (m_bEditLayout)
  315. m_diActF.guidApplication = GUID_DIConfigAppEditLayout;
  316. else
  317. m_diActF.guidApplication = g_AppGuid;
  318. DICONFIGUREDEVICESPARAMSW &p = m_Params;
  319. ZeroMemory(&p, sizeof(DICONFIGUREDEVICESPARAMSW));
  320. p.dwSize = sizeof(DICONFIGUREDEVICESPARAMSW);
  321. ZeroMemory(&p.dics, sizeof(DICOLORSET));
  322. p.dics.dwSize = sizeof(DICOLORSET);
  323. /**/
  324. p.dwcUsers = 4;
  325. p.lptszUserNames = TOW("Alpha\0Beta\0Epsilon\0Theta\0\0");
  326. /*/
  327. p.dwcUsers = 1;
  328. p.lptszUserNames = TOW("User 1\0\0");
  329. /**/
  330. p.dwcFormats = 1;
  331. p.lprgFormats = &m_diActF;
  332. p.hwnd = m_hWnd;
  333. //p.dics = ;
  334. p.lpUnkDDSTarget = NULL;
  335. }
  336. void GetDIHResultStrings(HRESULT hr, CString *pHR, CString *pMeaning)
  337. {
  338. LPCTSTR tszhr = NULL, tszMeaning = NULL;
  339. switch (hr)
  340. {
  341. case DI_BUFFEROVERFLOW:
  342. tszhr = _T("DI_BUFFEROVERFLOW");
  343. tszMeaning = _T("The device buffer overflowed and some input was lost. This value is equal to the S_FALSE standard COM return value.");
  344. break;
  345. case DI_DOWNLOADSKIPPED:
  346. tszhr = _T("DI_DOWNLOADSKIPPED");
  347. tszMeaning = _T("The parameters of the effect were successfully updated, but the effect could not be downloaded because the associated device was not acquired in exclusive mode.");
  348. break;
  349. case DI_EFFECTRESTARTED:
  350. tszhr = _T("DI_EFFECTRESTARTED");
  351. tszMeaning = _T("The effect was stopped, the parameters were updated, and the effect was restarted.");
  352. break;
  353. /* case DI_NOEFFECT:
  354. tszhr = _T("DI_NOEFFECT");
  355. tszMeaning = _T("The operation had no effect. This value is equal to the S_FALSE standard COM return value.");
  356. break;*/
  357. /* case DI_NOTATTACHED:
  358. tszhr = _T("DI_NOTATTACHED");
  359. tszMeaning = _T("The device exists but is not currently attached. This value is equal to the S_FALSE standard COM return value.");
  360. break;*/
  361. case DI_OK:
  362. tszhr = _T("DI_OK");
  363. tszMeaning = _T("The operation completed successfully. This value is equal to the S_OK standard COM return value.");
  364. break;
  365. case DI_POLLEDDEVICE:
  366. tszhr = _T("DI_POLLEDDEVICE");
  367. tszMeaning = _T("The device is a polled device. As a result, device buffering will not collect any data and event notifications will not be signaled until the IDirectInputDevice2::Poll method is called.");
  368. break;
  369. /* case DI_PROPNOEFFECT:
  370. tszhr = _T("DI_PROPNOEFFECT");
  371. tszMeaning = _T("The change in device properties had no effect. This value is equal to the S_FALSE standard COM return value.");
  372. break;*/
  373. case DI_TRUNCATED:
  374. tszhr = _T("DI_TRUNCATED");
  375. tszMeaning = _T("The parameters of the effect were successfully updated, but some of them were beyond the capabilities of the device and were truncated to the nearest supported value.");
  376. break;
  377. case DI_TRUNCATEDANDRESTARTED:
  378. tszhr = _T("DI_TRUNCATEDANDRESTARTED");
  379. tszMeaning = _T("Equal to DI_EFFECTRESTARTED | DI_TRUNCATED.");
  380. break;
  381. case DIERR_ACQUIRED:
  382. tszhr = _T("DIERR_ACQUIRED");
  383. tszMeaning = _T("The operation cannot be performed while the device is acquired.");
  384. break;
  385. case DIERR_ALREADYINITIALIZED:
  386. tszhr = _T("DIERR_ALREADYINITIALIZED");
  387. tszMeaning = _T("This object is already initialized ");
  388. break;
  389. case DIERR_BADDRIVERVER:
  390. tszhr = _T("DIERR_BADDRIVERVER");
  391. tszMeaning = _T("The object could not be created due to an incompatible driver version or mismatched or incomplete driver components.");
  392. break;
  393. case DIERR_BETADIRECTINPUTVERSION:
  394. tszhr = _T("DIERR_BETADIRECTINPUTVERSION");
  395. tszMeaning = _T("The application was written for an unsupported prerelease version of DirectInput.");
  396. break;
  397. case DIERR_DEVICEFULL:
  398. tszhr = _T("DIERR_DEVICEFULL");
  399. tszMeaning = _T("The device is full.");
  400. break;
  401. case DIERR_DEVICENOTREG:
  402. tszhr = _T("DIERR_DEVICENOTREG");
  403. tszMeaning = _T("The device or device instance is not registered with DirectInput. This value is equal to the REGDB_E_CLASSNOTREG standard COM return value.");
  404. break;
  405. case DIERR_EFFECTPLAYING:
  406. tszhr = _T("DIERR_EFFECTPLAYING");
  407. tszMeaning = _T("The parameters were updated in memory but were not downloaded to the device because the device does not support updating an effect while it is still playing.");
  408. break;
  409. case DIERR_HASEFFECTS:
  410. tszhr = _T("DIERR_HASEFFECTS");
  411. tszMeaning = _T("The device cannot be reinitialized because there are still effects attached to it.");
  412. break;
  413. case DIERR_GENERIC :
  414. tszhr = _T("DIERR_GENERIC");
  415. tszMeaning = _T("An undetermined error occurred inside the DirectInput subsystem. This value is equal to the E_FAIL standard COM return value.");
  416. break;
  417. case DIERR_HANDLEEXISTS :
  418. tszhr = _T("DIERR_HANDLEEXISTS");
  419. tszMeaning = _T("The device already has an event notification associated with it. This value is equal to the E_ACCESSDENIED standard COM return value.");
  420. break;
  421. case DIERR_INCOMPLETEEFFECT:
  422. tszhr = _T("DIERR_INCOMPLETEEFFECT");
  423. tszMeaning = _T("The effect could not be downloaded because essential information is missing. For example, no axes have been associated with the effect, or no type-specific information has been supplied.");
  424. break;
  425. case DIERR_INPUTLOST :
  426. tszhr = _T("DIERR_INPUTLOST");
  427. tszMeaning = _T("Access to the input device has been lost. It must be reacquired.");
  428. break;
  429. case DIERR_INVALIDPARAM :
  430. tszhr = _T("DIERR_INVALIDPARAM");
  431. tszMeaning = _T("An invalid parameter was passed to the returning function, or the object was not in a state that permitted the function to be called. This value is equal to the E_INVALIDARG standard COM return value.");
  432. break;
  433. case DIERR_MOREDATA:
  434. tszhr = _T("DIERR_MOREDATA");
  435. tszMeaning = _T("Not all the requested information fitted into the buffer.");
  436. break;
  437. case DIERR_NOAGGREGATION :
  438. tszhr = _T("DIERR_NOAGGREGATION");
  439. tszMeaning = _T("This object does not support aggregation.");
  440. break;
  441. case DIERR_NOINTERFACE :
  442. tszhr = _T("DIERR_NOINTERFACE");
  443. tszMeaning = _T("The specified interface is not supported by the object. This value is equal to the E_NOINTERFACE standard COM return value.");
  444. break;
  445. case DIERR_NOTACQUIRED :
  446. tszhr = _T("DIERR_NOTACQUIRED");
  447. tszMeaning = _T("The operation cannot be performed unless the device is acquired.");
  448. break;
  449. case DIERR_NOTBUFFERED:
  450. tszhr = _T("DIERR_NOTBUFFERED");
  451. tszMeaning = _T("The device is not buffered. Set the DIPROP_BUFFERSIZE property to enable buffering.");
  452. break;
  453. case DIERR_NOTDOWNLOADED:
  454. tszhr = _T("DIERR_NOTDOWNLOADED");
  455. tszMeaning = _T("The effect is not downloaded.");
  456. break;
  457. case DIERR_NOTEXCLUSIVEACQUIRED :
  458. tszhr = _T("DIERR_NOTEXCLUSIVEACQUIRED");
  459. tszMeaning = _T("The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode.");
  460. break;
  461. case DIERR_NOTFOUND :
  462. tszhr = _T("DIERR_NOTFOUND");
  463. tszMeaning = _T("The requested object does not exist.");
  464. break;
  465. case DIERR_NOTINITIALIZED :
  466. tszhr = _T("DIERR_NOTINITIALIZED");
  467. tszMeaning = _T("This object has not been initialized.");
  468. break;
  469. /* case DIERR_OBJECTNOTFOUND :
  470. tszhr = _T("DIERR_OBJECTNOTFOUND");
  471. tszMeaning = _T("The requested object does not exist.");
  472. break;*/
  473. case DIERR_OLDDIRECTINPUTVERSION :
  474. tszhr = _T("DIERR_OLDDIRECTINPUTVERSION");
  475. tszMeaning = _T("The application requires a newer version of DirectInput.");
  476. break;
  477. /* case DIERR_OTHERAPPHASPRIO :
  478. tszhr = _T("DIERR_OTHERAPPHASPRIO");
  479. tszMeaning = _T("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.");
  480. break;*/
  481. case DIERR_OUTOFMEMORY :
  482. tszhr = _T("DIERR_OUTOFMEMORY");
  483. tszMeaning = _T("The DirectInput subsystem couldn't allocate sufficient memory to complete the call. This value is equal to the E_OUTOFMEMORY standard COM return value.");
  484. break;
  485. /* case DIERR_READONLY :
  486. tszhr = _T("DIERR_READONLY");
  487. tszMeaning = _T("The specified property cannot be changed. This value is equal to the E_ACCESSDENIED standard COM return value.");
  488. break;*/
  489. case DIERR_REPORTFULL :
  490. tszhr = _T("DIERR_REPORTFULL");
  491. tszMeaning = _T("More information was requested to be sent than can be sent to the device.");
  492. break;
  493. case DIERR_UNPLUGGED:
  494. tszhr = _T("DIERR_UNPLUGGED");
  495. tszMeaning = _T("The operation could not be completed because the device is not plugged in.");
  496. break;
  497. case DIERR_UNSUPPORTED :
  498. tszhr = _T("DIERR_UNSUPPORTED");
  499. tszMeaning = _T("The function called is not supported at this time. This value is equal to the E_NOTIMPL standard COM return value.");
  500. break;
  501. case E_PENDING :
  502. tszhr = _T("E_PENDING");
  503. tszMeaning = _T("Data is not yet available.");
  504. break;
  505. default:
  506. if (pMeaning != NULL)
  507. *pMeaning = _T("Unknown.");
  508. if (pHR != NULL)
  509. pHR->Format(_T("(Unknown = %08X (%d))"), hr, hr);
  510. return;
  511. }
  512. if (pMeaning != NULL)
  513. *pMeaning = tszMeaning;
  514. if (pHR != NULL)
  515. *pHR = tszhr;
  516. }