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.

61 lines
1.3 KiB

  1. #include "precomp.h"
  2. extern BOOL g_fBatch;
  3. extern BOOL g_fBatch2;
  4. extern RECT g_dtRect;
  5. HWND g_hProgress;
  6. HWND g_hStatusDlg;
  7. static void setBoldFace(HWND hDlg, int idControl, BOOL fBold);
  8. void UpdateProgress(int iProgress)
  9. {
  10. static s_iProgress = 0;
  11. if (iProgress == -1)
  12. s_iProgress = 100;
  13. else
  14. s_iProgress += iProgress;
  15. if (s_iProgress > 100)
  16. {
  17. s_iProgress = 100;
  18. ASSERT(FALSE);
  19. }
  20. SendMessage(g_hProgress, PBM_SETPOS, s_iProgress, 0L);
  21. }
  22. void StatusDialog (UINT nStep)
  23. {
  24. if (g_fBatch || g_fBatch2)
  25. return;
  26. switch (nStep)
  27. {
  28. case SD_STEP1:
  29. setBoldFace(g_hStatusDlg, IDC_STEP1, TRUE);
  30. break;
  31. case SD_STEP2:
  32. setBoldFace(g_hStatusDlg, IDC_STEP1, FALSE);
  33. setBoldFace(g_hStatusDlg, IDC_STEP3, TRUE);
  34. break;
  35. }
  36. }
  37. static void setBoldFace(HWND hDlg, int idControl, BOOL fBold)
  38. {
  39. HFONT hFont;
  40. LOGFONT lfFont;
  41. hFont = (HFONT) SendDlgItemMessage(hDlg, idControl, WM_GETFONT, 0, 0);
  42. GetObject(hFont, sizeof(lfFont), &lfFont);
  43. lfFont.lfWeight = fBold ? FW_BOLD : FW_NORMAL;
  44. hFont = CreateFontIndirect(&lfFont);
  45. SendDlgItemMessage(hDlg, idControl, WM_SETFONT, (WPARAM) hFont, MAKELPARAM(TRUE, 0));
  46. }