Leaked source code of windows server 2003
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.

811 lines
23 KiB

  1. /*++
  2. Copyright (c) 1994-1998, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. mousemov.c
  5. Abstract:
  6. This module contains the routines for the Mouse Pointer Property Sheet
  7. page.
  8. Revision History:
  9. --*/
  10. //
  11. // Include Files.
  12. //
  13. #include "main.h"
  14. #include "util.h"
  15. #include "rc.h"
  16. #include "mousehlp.h"
  17. extern void WINAPI CenterDlgOverParent (HWND hWnd);
  18. #define SAFE_DESTROYICON(hicon) if (hicon) { DestroyIcon(hicon); hicon=NULL; }
  19. //
  20. // Constant Declarations.
  21. //
  22. #define TRAILMIN 2
  23. #define TRAILMAX (TRAILMIN + 5) // range of 8 settings
  24. //
  25. // Motion trackbar parameters.
  26. //
  27. const int MOTION_TB_MIN = 0;
  28. const int MOTION_TB_MAX = 10;
  29. const int MOTION_TB_STEP = 1;
  30. //
  31. // Typedef Declarations.
  32. //
  33. typedef struct
  34. {
  35. int Thresh1;
  36. int Thresh2;
  37. int Accel;
  38. } GETMOUSE;
  39. //
  40. // Dialog Data.
  41. //
  42. typedef struct tag_MouseGenStr
  43. {
  44. int nMotion;
  45. int nOrigMotion;
  46. BOOL fOrigEnhancedMotion;
  47. short nTrailSize;
  48. short nOrigTrailSize;
  49. HWND hWndTrailScroll;
  50. BOOL fOrigSnapTo;
  51. HWND hWndSpeedScroll;
  52. HWND hDlg;
  53. BOOL fOrigVanish;
  54. BOOL fOrigSonar;
  55. } MOUSEPTRSTR, *PMOUSEPTRSTR, *LPMOUSEPTRSTR;
  56. //
  57. // Context Help Ids.
  58. //
  59. const DWORD aMouseMoveHelpIds[] =
  60. {
  61. IDC_GROUPBOX_1, IDH_COMM_GROUPBOX,
  62. MOUSE_SPEEDSCROLL, IDH_MOUSE_POINTERSPEED,
  63. IDC_GROUPBOX_4, IDH_COMM_GROUPBOX,
  64. MOUSE_SNAPDEF, IDH_MOUSE_SNAPTO,
  65. MOUSE_PTRSNAPDEF, IDH_MOUSE_SNAPTO,
  66. IDC_GROUPBOX_5, IDH_COMM_GROUPBOX,
  67. MOUSE_TRAILS, IDH_MOUSE_POINTER_TRAILS,
  68. MOUSE_TRAILSCROLLTXT1, IDH_MOUSE_POINTER_TRAILS,
  69. MOUSE_TRAILSCROLLTXT2, IDH_MOUSE_POINTER_TRAILS,
  70. MOUSE_TRAILSCROLL, IDH_MOUSE_POINTER_TRAILS,
  71. MOUSE_VANISH, IDH_MOUSE_VANISH,
  72. MOUSE_SONAR, IDH_MOUSE_SONAR,
  73. MOUSE_ENHANCED_MOTION, IDH_MOUSE_ENHANCED_MOTION,
  74. 0,0
  75. };
  76. BOOL
  77. _IsValidTrackbarMotionValue(
  78. int nMotionTrackbar
  79. )
  80. {
  81. return (MOTION_TB_MIN <= nMotionTrackbar && MOTION_TB_MAX >= nMotionTrackbar);
  82. }
  83. //
  84. // Sets the mouse acceleration settings.
  85. // If the "Enhanced Motion" checkbox is checked we disable acceleration and
  86. // let USER handle it based on the "motion" setting.
  87. // If the checkbox is unchecked, we default to what was "low" acceleration
  88. // in Windows 2000. Therefore, it is critical that the MOUSE_ENHANCED_MOTION
  89. // checkbox be in the proper configuration before calling this function.
  90. //
  91. DWORD
  92. _SetPointerAcceleration(
  93. HWND hwndDlg,
  94. UINT fWinIni
  95. )
  96. {
  97. DWORD dwResult = ERROR_SUCCESS;
  98. GETMOUSE gm = { 0, 0, 0 };
  99. if (IsDlgButtonChecked(hwndDlg, MOUSE_ENHANCED_MOTION))
  100. {
  101. gm.Thresh1 = 6;
  102. gm.Thresh2 = 10;
  103. gm.Accel = 1;
  104. }
  105. if (!SystemParametersInfo(SPI_SETMOUSE, 0, (PVOID)&gm, fWinIni))
  106. {
  107. dwResult = GetLastError();
  108. ASSERTMSG(0,
  109. "SystemParametersInfo(SPI_SETMOUSE) failed with error %d",
  110. dwResult);
  111. }
  112. return dwResult;
  113. }
  114. //
  115. // Sets the mouse motion settings based on the current position of
  116. // the motion trackbar and the configuration of the "enhanced motion"
  117. // checkbox.
  118. //
  119. DWORD
  120. _SetPointerMotion(
  121. HWND hwndDlg,
  122. int nMotionTrackbar, // Trackbar position [0 - 10]
  123. UINT fWinIni
  124. )
  125. {
  126. DWORD dwResult = ERROR_SUCCESS;
  127. int nSpiSpeedValue;
  128. //
  129. // Calculations below depend on a trackbar max value of 10.
  130. // If the trackbar scaling changes, the expressions calculating
  131. // the system parameter below must also change.
  132. //
  133. ASSERT(0 == MOTION_TB_MIN);
  134. ASSERT(10 == MOTION_TB_MAX);
  135. ASSERT(_IsValidTrackbarMotionValue(nMotionTrackbar));
  136. if (0 == nMotionTrackbar)
  137. {
  138. //
  139. // SPI_SETMOUSESPEED doesn't accept 0 so we set a lower-bound
  140. // of 1.
  141. //
  142. nSpiSpeedValue = 1;
  143. } else {
  144. nSpiSpeedValue = nMotionTrackbar * 2;
  145. }
  146. //
  147. // Ensure pointer acceleration is correctly set before setting
  148. // the speed value.
  149. //
  150. dwResult = _SetPointerAcceleration(hwndDlg, fWinIni);
  151. if (ERROR_SUCCESS == dwResult)
  152. {
  153. if (!SystemParametersInfo(SPI_SETMOUSESPEED,
  154. 0,
  155. IntToPtr(nSpiSpeedValue),
  156. fWinIni))
  157. {
  158. dwResult = GetLastError();
  159. ASSERTMSG(0,
  160. "SystemParametersInfo(SPI_SETMOUSESPEED) failed with error %d",
  161. dwResult);
  162. }
  163. }
  164. return dwResult;
  165. }
  166. //
  167. // Retrieves the motion trackbar setting based on the values returned
  168. // by SystemParametersInfo.
  169. //
  170. DWORD
  171. _GetPointerMotion(
  172. HWND hwndDlg,
  173. int *pnMotionTrackbar,
  174. BOOL *pfEnhancedMotion
  175. )
  176. {
  177. BOOL fEnhancedMotion = FALSE;
  178. int nSpiSpeedValue = 0;
  179. int nMotionTrackbar = 0;
  180. GETMOUSE gm;
  181. DWORD dwResult = ERROR_SUCCESS;
  182. ASSERT(0 == MOTION_TB_MIN);
  183. ASSERT(10 == MOTION_TB_MAX);
  184. //
  185. // Read the speed setting from USER.
  186. //
  187. if (!SystemParametersInfo(SPI_GETMOUSESPEED,
  188. 0,
  189. &nSpiSpeedValue,
  190. FALSE) ||
  191. !SystemParametersInfo(SPI_GETMOUSE,
  192. 0,
  193. &gm,
  194. FALSE))
  195. {
  196. dwResult = GetLastError();
  197. ASSERTMSG(0,
  198. "SystemParametersInfo failed with error %d",
  199. dwResult);
  200. }
  201. else
  202. {
  203. //
  204. // USER is no longer exposing the old acceleration algorithm. Thus,
  205. // if acceleration is on, then "Enhanced Motion" is (since it's the
  206. // only acceleration algorithm supported).
  207. //
  208. if (gm.Accel)
  209. {
  210. //
  211. // Enhanced.
  212. //
  213. fEnhancedMotion = TRUE;
  214. }
  215. if (1 <= nSpiSpeedValue && 20 >= nSpiSpeedValue)
  216. {
  217. //
  218. // Classic.
  219. //
  220. nMotionTrackbar = nSpiSpeedValue / 2;
  221. }
  222. else
  223. {
  224. //
  225. // Invalid value. Default to classic mid-point.
  226. //
  227. nMotionTrackbar = 5;
  228. }
  229. }
  230. ASSERT(_IsValidTrackbarMotionValue(nMotionTrackbar));
  231. if (NULL != pfEnhancedMotion)
  232. {
  233. *pfEnhancedMotion = fEnhancedMotion;
  234. }
  235. if (NULL != pnMotionTrackbar)
  236. {
  237. *pnMotionTrackbar = nMotionTrackbar;
  238. }
  239. return dwResult;
  240. }
  241. ////////////////////////////////////////////////////////////////////////////
  242. //
  243. // DestroyMousePtrDlg
  244. //
  245. ////////////////////////////////////////////////////////////////////////////
  246. void DestroyMousePtrDlg(
  247. PMOUSEPTRSTR pMstr)
  248. {
  249. HWND hDlg;
  250. ASSERT( pMstr )
  251. if( pMstr )
  252. {
  253. hDlg = pMstr->hDlg;
  254. LocalFree( (HGLOBAL)pMstr );
  255. SetWindowLongPtr( hDlg, DWLP_USER, 0 );
  256. }
  257. }
  258. ////////////////////////////////////////////////////////////////////////////
  259. //
  260. // EnableTrailScroll
  261. //
  262. ////////////////////////////////////////////////////////////////////////////
  263. void EnableTrailScroll(
  264. HWND hDlg,
  265. BOOL val)
  266. {
  267. EnableWindow(GetDlgItem(hDlg, MOUSE_TRAILSCROLL), val);
  268. EnableWindow(GetDlgItem(hDlg, MOUSE_TRAILSCROLLTXT1), val);
  269. EnableWindow(GetDlgItem(hDlg, MOUSE_TRAILSCROLLTXT2), val);
  270. }
  271. ////////////////////////////////////////////////////////////////////////////
  272. //
  273. // InitMousePtrDlg
  274. //
  275. ////////////////////////////////////////////////////////////////////////////
  276. BOOL InitMousePtrDlg(
  277. HWND hDlg)
  278. {
  279. PMOUSEPTRSTR pMstr = NULL;
  280. BOOL fSnapTo = FALSE; //default
  281. BOOL fVanish = FALSE; //default
  282. BOOL fSonar = FALSE; //default
  283. BOOL fEnhancedMotion = FALSE;
  284. short nTrails = 0; //default
  285. pMstr = (PMOUSEPTRSTR)LocalAlloc(LPTR, sizeof(MOUSEPTRSTR));
  286. if (pMstr == NULL)
  287. {
  288. return (TRUE);
  289. }
  290. SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pMstr);
  291. pMstr->hDlg = hDlg;
  292. //
  293. // Mouse Trails
  294. //
  295. SystemParametersInfo(SPI_GETMOUSETRAILS, 0, &nTrails, 0);
  296. pMstr->nOrigTrailSize = pMstr->nTrailSize = nTrails;
  297. SendDlgItemMessage( hDlg,
  298. MOUSE_TRAILSCROLL,
  299. TBM_SETRANGE,
  300. 0,
  301. MAKELONG(TRAILMIN, TRAILMAX) );
  302. CheckDlgButton(hDlg, MOUSE_TRAILS, (pMstr->nTrailSize > 1));
  303. if (pMstr->nTrailSize > 1)
  304. {
  305. SendDlgItemMessage( hDlg,
  306. MOUSE_TRAILSCROLL,
  307. TBM_SETPOS,
  308. TRUE,
  309. (LONG)pMstr->nTrailSize );
  310. }
  311. else
  312. {
  313. pMstr->nTrailSize = TRAILMAX;
  314. EnableTrailScroll(hDlg, FALSE);
  315. SendDlgItemMessage( hDlg,
  316. MOUSE_TRAILSCROLL,
  317. TBM_SETPOS,
  318. TRUE,
  319. (LONG)pMstr->nTrailSize );
  320. }
  321. //
  322. // Enable or disable the Snap To Default Checkbutton
  323. //
  324. SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, (PVOID)&fSnapTo, FALSE);
  325. pMstr->fOrigSnapTo = fSnapTo;
  326. CheckDlgButton(hDlg, MOUSE_SNAPDEF, fSnapTo);
  327. //
  328. //Enable or disable the Sonar Checkbutton
  329. //
  330. SystemParametersInfo(SPI_GETMOUSESONAR, 0, (PVOID)&fSonar, FALSE);
  331. pMstr->fOrigSonar = fSonar;
  332. CheckDlgButton(hDlg, MOUSE_SONAR, fSonar);
  333. //
  334. //Enable or disable the Vanish Checkbutton
  335. //
  336. SystemParametersInfo(SPI_GETMOUSEVANISH, 0, (PVOID)&fVanish, FALSE);
  337. pMstr->fOrigVanish = fVanish;
  338. CheckDlgButton(hDlg, MOUSE_VANISH, fVanish);
  339. //
  340. // Mouse Speed
  341. //
  342. _GetPointerMotion(hDlg, &pMstr->nOrigMotion, &fEnhancedMotion);
  343. CheckDlgButton(hDlg, MOUSE_ENHANCED_MOTION, fEnhancedMotion);
  344. pMstr->nMotion = pMstr->nOrigMotion;
  345. pMstr->fOrigEnhancedMotion = fEnhancedMotion;
  346. pMstr->hWndTrailScroll = GetDlgItem(hDlg, MOUSE_TRAILSCROLL);
  347. pMstr->hWndSpeedScroll = GetDlgItem(hDlg, MOUSE_SPEEDSCROLL);
  348. SendDlgItemMessage( hDlg,
  349. MOUSE_SPEEDSCROLL,
  350. TBM_SETRANGE,
  351. 0,
  352. MAKELONG(MOTION_TB_MIN, MOTION_TB_MAX) );
  353. SendDlgItemMessage( hDlg,
  354. MOUSE_SPEEDSCROLL,
  355. TBM_SETTICFREQ,
  356. MOTION_TB_STEP,
  357. 0);
  358. SendDlgItemMessage( hDlg,
  359. MOUSE_SPEEDSCROLL,
  360. TBM_SETLINESIZE,
  361. 0,
  362. MOTION_TB_STEP);
  363. SendDlgItemMessage( hDlg,
  364. MOUSE_SPEEDSCROLL,
  365. TBM_SETPOS,
  366. TRUE,
  367. (LONG)pMstr->nOrigMotion);
  368. return (TRUE);
  369. }
  370. ////////////////////////////////////////////////////////////////////////////
  371. //
  372. // TrailScroll
  373. //
  374. ////////////////////////////////////////////////////////////////////////////
  375. void TrailScroll(
  376. WPARAM wParam,
  377. LPARAM lParam,
  378. PMOUSEPTRSTR pMstr)
  379. {
  380. pMstr->nTrailSize = (short)SendMessage((HWND)lParam, TBM_GETPOS, 0, 0L);
  381. SystemParametersInfo(SPI_SETMOUSETRAILS, pMstr->nTrailSize, 0,0);
  382. }
  383. ////////////////////////////////////////////////////////////////////////////
  384. //
  385. // SpeedScroll
  386. //
  387. ////////////////////////////////////////////////////////////////////////////
  388. void SpeedScroll(
  389. WPARAM wParam,
  390. LPARAM lParam,
  391. PMOUSEPTRSTR pMstr)
  392. {
  393. const HWND hwndTrackbar = (HWND)lParam;
  394. pMstr->nMotion = (int)SendMessage(hwndTrackbar, TBM_GETPOS, 0, 0L);
  395. //
  396. // Update speed when they let go of the thumb.
  397. //
  398. if (LOWORD(wParam) == SB_ENDSCROLL)
  399. {
  400. const HWND hwndDlg = GetParent(hwndTrackbar);
  401. _SetPointerMotion(hwndDlg, pMstr->nMotion, SPIF_SENDCHANGE);
  402. }
  403. }
  404. //
  405. // User checked or unchecked the "Enhanced pointer motion" checkbox.
  406. //
  407. void
  408. _OnEnhancedMotionChecked(
  409. PMOUSEPTRSTR pMstr
  410. )
  411. {
  412. const HWND hwndTrackbar = (HWND)pMstr->hWndSpeedScroll;
  413. const HWND hwndDlg = GetParent(hwndTrackbar);
  414. pMstr->nMotion = (int)SendMessage(hwndTrackbar, TBM_GETPOS, 0, 0L);
  415. _SetPointerMotion(hwndDlg, pMstr->nMotion, SPIF_SENDCHANGE);
  416. }
  417. ////////////////////////////////////////////////////////////////////////////
  418. //
  419. // MouseMovDlg
  420. //
  421. ////////////////////////////////////////////////////////////////////////////
  422. INT_PTR CALLBACK MouseMovDlg(
  423. HWND hDlg,
  424. UINT message,
  425. WPARAM wParam,
  426. LPARAM lParam)
  427. {
  428. PMOUSEPTRSTR pMstr = NULL;
  429. BOOL bRet = FALSE;
  430. pMstr = (PMOUSEPTRSTR)GetWindowLongPtr(hDlg, DWLP_USER);
  431. switch (message)
  432. {
  433. case ( WM_INITDIALOG ) :
  434. {
  435. bRet = InitMousePtrDlg(hDlg);
  436. break;
  437. }
  438. case ( WM_DESTROY ) :
  439. {
  440. DestroyMousePtrDlg(pMstr);
  441. break;
  442. }
  443. case ( WM_HSCROLL ) :
  444. {
  445. SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L);
  446. if ((HWND)lParam == pMstr->hWndSpeedScroll)
  447. {
  448. SpeedScroll(wParam, lParam, pMstr);
  449. }
  450. else if ((HWND)lParam == pMstr->hWndTrailScroll)
  451. {
  452. TrailScroll(wParam, lParam, pMstr);
  453. }
  454. break;
  455. }
  456. case ( WM_COMMAND ) :
  457. {
  458. switch (LOWORD(wParam))
  459. {
  460. case ( MOUSE_TRAILS ) :
  461. {
  462. if (IsDlgButtonChecked(hDlg, MOUSE_TRAILS))
  463. {
  464. EnableTrailScroll(hDlg, TRUE);
  465. pMstr->nTrailSize =
  466. (int)SendMessage( pMstr->hWndTrailScroll,
  467. TBM_GETPOS,
  468. 0,
  469. 0 );
  470. SystemParametersInfo( SPI_SETMOUSETRAILS,
  471. pMstr->nTrailSize,
  472. 0,
  473. 0 );
  474. }
  475. else
  476. {
  477. EnableTrailScroll(hDlg, FALSE);
  478. SystemParametersInfo(SPI_SETMOUSETRAILS, 0, 0, 0);
  479. }
  480. SendMessage( GetParent(hDlg),
  481. PSM_CHANGED,
  482. (WPARAM)hDlg,
  483. 0L );
  484. break;
  485. }
  486. case ( MOUSE_SNAPDEF ) :
  487. {
  488. SystemParametersInfo( SPI_SETSNAPTODEFBUTTON,
  489. IsDlgButtonChecked(hDlg, MOUSE_SNAPDEF),
  490. 0,
  491. FALSE );
  492. SendMessage( GetParent(hDlg),
  493. PSM_CHANGED,
  494. (WPARAM)hDlg,
  495. 0L );
  496. break;
  497. }
  498. case ( MOUSE_SONAR ) :
  499. {
  500. SystemParametersInfo( SPI_SETMOUSESONAR,
  501. 0,
  502. IntToPtr( IsDlgButtonChecked(hDlg, MOUSE_SONAR) ),
  503. FALSE );
  504. SendMessage( GetParent(hDlg),
  505. PSM_CHANGED,
  506. (WPARAM)hDlg,
  507. 0L );
  508. break;
  509. }
  510. case ( MOUSE_VANISH ) :
  511. {
  512. SystemParametersInfo( SPI_SETMOUSEVANISH,
  513. 0,
  514. IntToPtr( IsDlgButtonChecked(hDlg, MOUSE_VANISH) ),
  515. FALSE );
  516. SendMessage( GetParent(hDlg),
  517. PSM_CHANGED,
  518. (WPARAM)hDlg,
  519. 0L );
  520. break;
  521. }
  522. case ( MOUSE_ENHANCED_MOTION ) :
  523. _OnEnhancedMotionChecked(pMstr);
  524. SendMessage( GetParent(hDlg),
  525. PSM_CHANGED,
  526. (WPARAM)hDlg,
  527. 0L );
  528. break;
  529. }
  530. break;
  531. }
  532. case ( WM_NOTIFY ) :
  533. {
  534. switch (((NMHDR *)lParam)->code)
  535. {
  536. case ( PSN_APPLY ) :
  537. {
  538. short nTrails = 0;
  539. BOOL fSnapTo = FALSE;
  540. BOOL fSonar = FALSE;
  541. BOOL fVanish = FALSE;
  542. //
  543. // Change cursor to hour glass.
  544. //
  545. HourGlass(TRUE);
  546. //
  547. // Apply Mouse trails setting.
  548. //
  549. nTrails = (IsDlgButtonChecked(hDlg, MOUSE_TRAILS)) ? pMstr->nTrailSize : 0;
  550. SystemParametersInfo( SPI_SETMOUSETRAILS,
  551. nTrails,
  552. 0,
  553. SPIF_UPDATEINIFILE |
  554. SPIF_SENDCHANGE );
  555. pMstr->nOrigTrailSize = pMstr->nTrailSize = nTrails;
  556. //
  557. // Apply Snap-To-Default setting.
  558. //
  559. fSnapTo = IsDlgButtonChecked(hDlg, MOUSE_SNAPDEF);
  560. if (fSnapTo != pMstr->fOrigSnapTo)
  561. {
  562. SystemParametersInfo( SPI_SETSNAPTODEFBUTTON,
  563. fSnapTo,
  564. 0,
  565. SPIF_UPDATEINIFILE |
  566. SPIF_SENDCHANGE );
  567. pMstr->fOrigSnapTo = fSnapTo;
  568. }
  569. //
  570. // Apply Sonar setting.
  571. //
  572. fSonar = IsDlgButtonChecked(hDlg, MOUSE_SONAR);
  573. if (fSonar != pMstr->fOrigSonar)
  574. {
  575. SystemParametersInfo( SPI_SETMOUSESONAR,
  576. 0,
  577. IntToPtr(fSonar),
  578. SPIF_UPDATEINIFILE |
  579. SPIF_SENDCHANGE );
  580. pMstr->fOrigSonar = fSonar;
  581. }
  582. //
  583. // Apply Vanish setting.
  584. //
  585. fVanish = IsDlgButtonChecked(hDlg, MOUSE_VANISH);
  586. if (fVanish != pMstr->fOrigVanish)
  587. {
  588. SystemParametersInfo( SPI_SETMOUSEVANISH,
  589. 0,
  590. IntToPtr(fVanish),
  591. SPIF_UPDATEINIFILE |
  592. SPIF_SENDCHANGE );
  593. pMstr->fOrigVanish = fVanish;
  594. }
  595. //
  596. // Apply Mouse Speed setting.
  597. //
  598. _SetPointerMotion(hDlg, pMstr->nMotion, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
  599. pMstr->fOrigEnhancedMotion = IsDlgButtonChecked(hDlg, MOUSE_ENHANCED_MOTION);
  600. pMstr->nOrigMotion = pMstr->nMotion;
  601. HourGlass(FALSE);
  602. break;
  603. }
  604. case ( PSN_RESET ) :
  605. {
  606. //
  607. // Restore the original Mouse Trails setting.
  608. //
  609. SystemParametersInfo( SPI_SETMOUSETRAILS,
  610. pMstr->nOrigTrailSize,
  611. 0,
  612. 0 );
  613. //
  614. // Restore the original Snap-To-Default setting .
  615. //
  616. SystemParametersInfo( SPI_SETSNAPTODEFBUTTON,
  617. pMstr->fOrigSnapTo,
  618. 0,
  619. 0 );
  620. //
  621. // Restore the original Sonar setting.
  622. //
  623. SystemParametersInfo( SPI_SETMOUSESONAR,
  624. 0,
  625. IntToPtr(pMstr->fOrigSonar),
  626. 0);
  627. //
  628. // Restore the original Vanish setting.
  629. //
  630. SystemParametersInfo( SPI_SETMOUSEVANISH,
  631. 0,
  632. IntToPtr(pMstr->fOrigVanish),
  633. 0);
  634. //
  635. // Restore the original Mouse Motion value.
  636. //
  637. CheckDlgButton(hDlg, MOUSE_ENHANCED_MOTION, pMstr->fOrigEnhancedMotion);
  638. _SetPointerMotion(hDlg, pMstr->nOrigMotion, FALSE);
  639. break;
  640. }
  641. default :
  642. {
  643. return (FALSE);
  644. }
  645. }
  646. break;
  647. }
  648. case ( WM_HELP ) : // F1
  649. {
  650. WinHelp( (HWND)((LPHELPINFO)lParam)->hItemHandle,
  651. HELP_FILE,
  652. HELP_WM_HELP,
  653. (DWORD_PTR)(LPTSTR)aMouseMoveHelpIds );
  654. break;
  655. }
  656. case ( WM_CONTEXTMENU ) : // right mouse click
  657. {
  658. WinHelp( (HWND)wParam,
  659. HELP_FILE,
  660. HELP_CONTEXTMENU,
  661. (DWORD_PTR)(LPTSTR)aMouseMoveHelpIds );
  662. break;
  663. }
  664. case ( WM_DISPLAYCHANGE ) :
  665. case ( WM_WININICHANGE ) :
  666. case ( WM_SYSCOLORCHANGE ) :
  667. {
  668. SHPropagateMessage(hDlg, message, wParam, lParam, TRUE);
  669. return TRUE;
  670. }
  671. default :
  672. {
  673. return (FALSE);
  674. }
  675. }
  676. return (TRUE);
  677. }