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.

175 lines
4.5 KiB

  1. /*****************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 2000
  4. *
  5. * TITLE: start.cpp
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: RickTu
  10. *
  11. * DATE: 11/7/00
  12. *
  13. * DESCRIPTION: Implements code for the start page of the
  14. * print photos wizard...
  15. *
  16. *****************************************************************************/
  17. #include <precomp.h>
  18. #pragma hdrstop
  19. /*****************************************************************************
  20. CStartPage -- constructor/desctructor
  21. <Notes>
  22. *****************************************************************************/
  23. CStartPage::CStartPage( CWizardInfoBlob * pBlob )
  24. : _hDlg(NULL),
  25. _pWizInfo(pBlob)
  26. {
  27. WIA_PUSH_FUNCTION_MASK((TRACE_PAGE_START, TEXT("CStartPage::CStartPage()")));
  28. if (_pWizInfo)
  29. {
  30. _pWizInfo->AddRef();
  31. }
  32. }
  33. CStartPage::~CStartPage()
  34. {
  35. WIA_PUSH_FUNCTION_MASK((TRACE_PAGE_START, TEXT("CStartPage::~CStartPage()")));
  36. if (_pWizInfo)
  37. {
  38. _pWizInfo->Release();
  39. _pWizInfo = NULL;
  40. }
  41. }
  42. /*****************************************************************************
  43. CStartPage::OnInitDialog
  44. Handle initializing the wizard page...
  45. *****************************************************************************/
  46. LRESULT CStartPage::_OnInitDialog()
  47. {
  48. WIA_PUSH_FUNCTION_MASK((TRACE_PAGE_START, TEXT("CStartPage::_OnInitDialog()")));
  49. if (!_pWizInfo)
  50. {
  51. WIA_ERROR((TEXT("FATAL: _pWizInfo is NULL, exiting early")));
  52. return FALSE;
  53. }
  54. //
  55. // Set font...
  56. //
  57. SendDlgItemMessage(_hDlg, IDC_WELCOME, WM_SETFONT, (WPARAM)_pWizInfo->GetIntroFont(_hDlg), 0);
  58. //
  59. // Set wizard icons...
  60. //
  61. SendMessage( GetParent(_hDlg), WM_SETICON, ICON_SMALL, (LPARAM)_pWizInfo->GetSmallIcon() );
  62. SendMessage( GetParent(_hDlg), WM_SETICON, ICON_BIG, (LPARAM)_pWizInfo->GetLargeIcon() );
  63. return TRUE;
  64. }
  65. /*****************************************************************************
  66. CStartPage::DoHandleMessage
  67. Hanlder for messages sent to this page...
  68. *****************************************************************************/
  69. INT_PTR CStartPage::DoHandleMessage( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
  70. {
  71. WIA_PUSH_FUNCTION_MASK((TRACE_DLGPROC, TEXT("CStartPage::DoHandleMessage( uMsg = 0x%x, wParam = 0x%x, lParam = 0x%x )"),uMsg,wParam,lParam));
  72. switch ( uMsg )
  73. {
  74. case WM_INITDIALOG:
  75. _hDlg = hDlg;
  76. return _OnInitDialog();
  77. case WM_NOTIFY:
  78. {
  79. LPNMHDR pnmh = (LPNMHDR)lParam;
  80. LONG_PTR lpRes = 0;
  81. if (pnmh)
  82. {
  83. switch (pnmh->code)
  84. {
  85. case PSN_SETACTIVE:
  86. WIA_TRACE((TEXT("CStartPage: got PSN_SETACTIVE")));
  87. //
  88. // Add all the objects to the list...
  89. //
  90. PropSheet_SetWizButtons( GetParent(_hDlg), PSWIZB_NEXT );
  91. PostMessage( _hDlg, STARTPAGE_MSG_LOAD_ITEMS, 0, 0 );
  92. lpRes = 0;
  93. break;
  94. case PSN_WIZNEXT:
  95. WIA_TRACE((TEXT("CStartPage: got PSN_WIZNEXT")));
  96. if (_pWizInfo && (_pWizInfo->AllPicturesAdded()) && (_pWizInfo->CountOfPhotos(FALSE) == 1))
  97. {
  98. lpRes = IDD_PRINTING_OPTIONS;
  99. }
  100. else
  101. {
  102. lpRes = IDD_PICTURE_SELECTION;
  103. }
  104. break;
  105. case PSN_WIZBACK:
  106. WIA_TRACE((TEXT("CStartPage: got PSN_WIZBACK")));
  107. lpRes = -1;
  108. break;
  109. case PSN_QUERYCANCEL:
  110. WIA_TRACE((TEXT("CStartPage: got PSN_QUERYCANCEL")));
  111. if (_pWizInfo)
  112. {
  113. lpRes = _pWizInfo->UserPressedCancel();
  114. }
  115. break;
  116. }
  117. }
  118. SetWindowLongPtr( hDlg, DWLP_MSGRESULT, lpRes );
  119. return TRUE;
  120. }
  121. case STARTPAGE_MSG_LOAD_ITEMS:
  122. if (_pWizInfo)
  123. {
  124. _pWizInfo->AddAllPhotosFromDataObject();
  125. }
  126. break;
  127. }
  128. return FALSE;
  129. }