pgmsecur.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 4k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. #include "pch.hxx" // pch
  2. #pragma hdrstop
  3. #include "resource.h"
  4. #include "pgMseCur.h"
  5. CMouseCursorPg::CMouseCursorPg(
  6. LPPROPSHEETPAGE ppsp
  7. ) : WizardPage(ppsp, IDS_MSEWIZMOUSECURSORTITLE, IDS_MSEWIZMOUSECURSORSUBTITLE)
  8. {
  9. m_dwPageId = IDD_MSEWIZMOUSECURSOR;
  10. ppsp->pszTemplate = MAKEINTRESOURCE(m_dwPageId);
  11. }
  12. CMouseCursorPg::~CMouseCursorPg(
  13. VOID
  14. )
  15. {
  16. }
  17. LRESULT
  18. CMouseCursorPg::OnInitDialog(
  19. HWND hwnd,
  20. WPARAM wParam,
  21. LPARAM lParam
  22. )
  23. {
  24. HICON hIconSmallWhite = LoadIcon(g_hInstDll, MAKEINTRESOURCE(IDI_CURSOR_SMALL_WHITE));
  25. HICON hIconMediumWhite = LoadIcon(g_hInstDll, MAKEINTRESOURCE(IDI_CURSOR_MEDIUM_WHITE));
  26. HICON hIconLargeWhite = LoadIcon(g_hInstDll, MAKEINTRESOURCE(IDI_CURSOR_LARGE_WHITE));
  27. HICON hIconSmallBlack = LoadIcon(g_hInstDll, MAKEINTRESOURCE(IDI_CURSOR_SMALL_BLACK));
  28. HICON hIconMediumBlack = LoadIcon(g_hInstDll, MAKEINTRESOURCE(IDI_CURSOR_MEDIUM_BLACK));
  29. HICON hIconLargeBlack = LoadIcon(g_hInstDll, MAKEINTRESOURCE(IDI_CURSOR_LARGE_BLACK));
  30. HICON hIconSmallInverting = LoadIcon(g_hInstDll, MAKEINTRESOURCE(IDI_CURSOR_SMALL_INVERTING));
  31. HICON hIconMediumInverting = LoadIcon(g_hInstDll, MAKEINTRESOURCE(IDI_CURSOR_MEDIUM_INVERTING));
  32. HICON hIconLargeInverting = LoadIcon(g_hInstDll, MAKEINTRESOURCE(IDI_CURSOR_LARGE_INVERTING));
  33. #pragma message ("Need to destroy bitmaps in OnDestroy")
  34. SendMessage(GetDlgItem(m_hwnd, IDC_RADIO2), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconSmallWhite);
  35. SendMessage(GetDlgItem(m_hwnd, IDC_RADIO3), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconMediumWhite);
  36. SendMessage(GetDlgItem(m_hwnd, IDC_RADIO4), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconLargeWhite);
  37. SendMessage(GetDlgItem(m_hwnd, IDC_RADIO5), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconSmallBlack);
  38. SendMessage(GetDlgItem(m_hwnd, IDC_RADIO6), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconMediumBlack);
  39. SendMessage(GetDlgItem(m_hwnd, IDC_RADIO7), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconLargeBlack);
  40. SendMessage(GetDlgItem(m_hwnd, IDC_RADIO8), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconSmallInverting);
  41. SendMessage(GetDlgItem(m_hwnd, IDC_RADIO9), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconMediumInverting);
  42. SendMessage(GetDlgItem(m_hwnd, IDC_RADIO10), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconLargeInverting);
  43. Button_SetCheck(GetDlgItem(m_hwnd, IDC_RADIO1), TRUE);
  44. UpdateControls();
  45. return 1;
  46. }
  47. void CMouseCursorPg::UpdateControls()
  48. {
  49. // Nothing to do
  50. }
  51. LRESULT
  52. CMouseCursorPg::OnCommand(
  53. HWND hwnd,
  54. WPARAM wParam,
  55. LPARAM lParam
  56. )
  57. {
  58. LRESULT lResult = 1;
  59. WORD wNotifyCode = HIWORD(wParam);
  60. WORD wCtlID      = LOWORD(wParam);
  61. HWND hwndCtl     = (HWND)lParam;
  62. TCHAR szPath[_MAX_PATH];
  63. GetWindowsDirectory(szPath, _MAX_PATH);
  64. lstrcat(szPath, __TEXT("\cursors\"));
  65. HCURSOR hCursor = NULL;
  66. switch(wCtlID)
  67. {
  68. case IDC_RADIO3:
  69. lstrcat(szPath, __TEXT("arrow_m.cur"));
  70. hCursor = LoadCursorFromFile(szPath);
  71. lResult = 0;
  72. break;
  73. case IDC_RADIO4:
  74. lstrcat(szPath, __TEXT("arrow_l.cur"));
  75. hCursor = LoadCursorFromFile(szPath);
  76. lResult = 0;
  77. break;
  78. case IDC_RADIO5:
  79. lstrcat(szPath, __TEXT("arrow_r.cur"));
  80. hCursor = LoadCursorFromFile(szPath);
  81. lResult = 0;
  82. break;
  83. case IDC_RADIO6:
  84. lstrcat(szPath, __TEXT("arrow_rm.cur"));
  85. hCursor = LoadCursorFromFile(szPath);
  86. lResult = 0;
  87. break;
  88. case IDC_RADIO7:
  89. lstrcat(szPath, __TEXT("arrow_rl.cur"));
  90. hCursor = LoadCursorFromFile(szPath);
  91. lResult = 0;
  92. break;
  93. case IDC_RADIO8:
  94. lstrcat(szPath, __TEXT("arrow_i.cur"));
  95. hCursor = LoadCursorFromFile(szPath);
  96. lResult = 0;
  97. break;
  98. case IDC_RADIO9:
  99. lstrcat(szPath, __TEXT("arrow_im.cur"));
  100. hCursor = LoadCursorFromFile(szPath);
  101. lResult = 0;
  102. break;
  103. case IDC_RADIO10:
  104. lstrcat(szPath, __TEXT("arrow_il.cur"));
  105. hCursor = LoadCursorFromFile(szPath);
  106. lResult = 0;
  107. break;
  108. default:
  109. break;
  110. }
  111. #define OCR_NORMAL          32512
  112. #define OCR_IBEAM           32513
  113. if(hCursor)
  114. SetSystemCursor(hCursor, OCR_NORMAL);
  115. return lResult;
  116. }