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.

178 lines
4.7 KiB

  1. //Copyright (c) 1998 - 2001 Microsoft Corporation
  2. #include "precomp.h"
  3. #include "commdlg.h"
  4. #include "fonts.h"
  5. void InitializeFailedCodeList(HWND hDialog)
  6. {
  7. HWND hWndListView = GetDlgItem(hDialog, IDC_FAILED_CODES );
  8. //Setup columns in list view
  9. LV_COLUMN lvColumn;
  10. TCHAR lpszHeader[128];
  11. lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
  12. lvColumn.fmt = LVCFMT_LEFT;
  13. lvColumn.cx = 225;
  14. LoadString(GetInstanceHandle(), IDS_RETAIL_HEADERSPK, lpszHeader, sizeof(lpszHeader)/sizeof(TCHAR));
  15. lvColumn.pszText = lpszHeader;
  16. ListView_InsertColumn(hWndListView, 0, &lvColumn);
  17. lvColumn.cx = 80;
  18. LoadString(GetInstanceHandle(), IDS_RETAIL_HEADERSTATUS, lpszHeader, sizeof(lpszHeader)/sizeof(TCHAR));
  19. lvColumn.pszText = lpszHeader;
  20. ListView_InsertColumn(hWndListView, 1, &lvColumn);
  21. lvColumn.cx = 160;
  22. LoadString(GetInstanceHandle(), IDS_PRODUCT_TYPE, lpszHeader, sizeof(lpszHeader)/sizeof(TCHAR));
  23. lvColumn.pszText = lpszHeader;
  24. ListView_InsertColumn(hWndListView, 2, &lvColumn);
  25. // Now that this is done, pre-populate the List Control from the Internal
  26. // List, if any
  27. ListView_SetItemCount(hWndListView, MAX_RETAILSPKS_IN_BATCH);
  28. }
  29. void ShowErrorWindow(HWND hDialog, BOOL bShow)
  30. {
  31. HWND hWndList = GetDlgItem(hDialog, IDC_FAILED_CODES);
  32. HWND hWndListLabel = GetDlgItem(hDialog, IDC_FAILED_CODES_LABEL);
  33. ShowWindow(hWndList, bShow);
  34. ShowWindow(hWndListLabel, bShow);
  35. ShowWindow(GetDlgItem(hDialog, IDC_CODE_ERROR_SUGGESTION), bShow ? SW_SHOW : SW_HIDE);
  36. ShowWindow(GetDlgItem(hDialog, IDC_KEY_PACK_SUCCESS), bShow ? SW_HIDE : SW_SHOW);
  37. PropSheet_SetWizButtons(GetParent(hDialog), PSWIZB_FINISH);
  38. }
  39. void PopulateSuccessCodeList(HWND hDialog)
  40. {
  41. HWND hWndList = GetDlgItem(hDialog, IDC_SUCCEEDED_CODES);
  42. SendMessage(hWndList, LB_RESETCONTENT, 0, 0);
  43. LoadFinishedFromList(hWndList);
  44. }
  45. void PopulateErrorCodeList(HWND hDialog)
  46. {
  47. HWND hWndList = GetDlgItem(hDialog, IDC_FAILED_CODES);
  48. ListView_DeleteAllItems(hWndList);
  49. LoadUnfinishedFromList(hWndList);
  50. }
  51. void ModifyErrorSpecificAppearance(HWND hDialog, DWORD dwRetCode)
  52. {
  53. TCHAR szBuf[LR_MAX_MSG_TEXT];
  54. UINT nMessageID = ((dwRetCode == ERROR_SUCCESS) ? IDS_FINALSUCCESSMESSAGE2 : IDS_FINALFAILMESSAGE);
  55. LoadString(GetInstanceHandle(), nMessageID, szBuf, LR_MAX_MSG_TEXT);
  56. SetDlgItemText(hDialog, IDC_MESSAGE, szBuf);
  57. //We'll always do this because even if the return code
  58. //indicated a failure, some codes may have succeeded
  59. PopulateSuccessCodeList(hDialog);
  60. ShowErrorWindow(hDialog, (dwRetCode != ERROR_SUCCESS));
  61. if (dwRetCode != ERROR_SUCCESS)
  62. {
  63. ShowErrorWindow(hDialog, TRUE);
  64. PopulateErrorCodeList(hDialog);
  65. PropSheet_SetWizButtons(GetParent(hDialog), PSWIZB_BACK | PSWIZB_FINISH);
  66. }
  67. else
  68. {
  69. ShowErrorWindow(hDialog, FALSE);
  70. dwRetCode = IDS_MSG_LKP_PROCESSED;
  71. SetReFresh(1);
  72. SetLRState(LRSTATE_NEUTRAL);
  73. }
  74. }
  75. BOOL HandleNotify(HWND hDialog, LPARAM lParam)
  76. {
  77. DWORD dwNextPage = 0;
  78. LPNMHDR pnmh = (LPNMHDR)lParam;
  79. switch(pnmh->code)
  80. {
  81. case PSN_SETACTIVE:
  82. {
  83. DWORD dwRetCode = 0;
  84. TCHAR szMsg[LR_MAX_MSG_TEXT];
  85. dwRetCode = LRGetLastRetCode();
  86. // If everything successful, display the message depending on the Mode
  87. ModifyErrorSpecificAppearance(hDialog, dwRetCode);
  88. break;
  89. }
  90. case PSN_WIZBACK:
  91. {
  92. dwNextPage = LRPop();
  93. LRW_SETWINDOWLONG(hDialog, LRW_DWL_MSGRESULT, dwNextPage);
  94. return TRUE;
  95. break;
  96. }
  97. default:
  98. {
  99. return FALSE;
  100. break;
  101. }
  102. }
  103. return TRUE;
  104. }
  105. LRW_DLG_INT CALLBACK
  106. Progress2DlgProc(
  107. IN HWND hwnd,
  108. IN UINT uMsg,
  109. IN WPARAM wParam,
  110. IN LPARAM lParam
  111. )
  112. {
  113. BOOL bStatus = TRUE;
  114. PageInfo *pi = (PageInfo *)LRW_GETWINDOWLONG( hwnd, LRW_GWL_USERDATA );
  115. switch (uMsg)
  116. {
  117. case WM_INITDIALOG:
  118. {
  119. pi = (PageInfo *)((LPPROPSHEETPAGE)lParam)->lParam;
  120. LRW_SETWINDOWLONG(hwnd, LRW_GWL_USERDATA, (LRW_LONG_PTR)pi);
  121. //Set the Font for the Title Fields
  122. SetControlFont(pi->hBigBoldFont, hwnd, IDC_BIGBOLDTITLE);
  123. InitializeFailedCodeList(hwnd);
  124. break;
  125. }
  126. case WM_DESTROY:
  127. {
  128. LRW_SETWINDOWLONG( hwnd, LRW_GWL_USERDATA, NULL );
  129. break;
  130. }
  131. case WM_NOTIFY:
  132. {
  133. bStatus = HandleNotify(hwnd, lParam);
  134. break;
  135. }
  136. default:
  137. {
  138. bStatus = FALSE;
  139. break;
  140. }
  141. }
  142. return bStatus;
  143. }