Source code of Windows XP (NT5)
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.

169 lines
4.1 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. {
  26. WIA_PUSH_FUNCTION_MASK((TRACE_PAGE_START, TEXT("CStartPage::CStartPage()")));
  27. _pWizInfo = pBlob;
  28. _pWizInfo->AddRef();
  29. }
  30. CStartPage::~CStartPage()
  31. {
  32. WIA_PUSH_FUNCTION_MASK((TRACE_PAGE_START, TEXT("CStartPage::~CStartPage()")));
  33. if (_pWizInfo)
  34. {
  35. _pWizInfo->Release();
  36. _pWizInfo = NULL;
  37. }
  38. }
  39. /*****************************************************************************
  40. CStartPage::OnInitDialog
  41. Handle initializing the wizard page...
  42. *****************************************************************************/
  43. LRESULT CStartPage::_OnInitDialog()
  44. {
  45. WIA_PUSH_FUNCTION_MASK((TRACE_PAGE_START, TEXT("CStartPage::_OnInitDialog()")));
  46. if (!_pWizInfo)
  47. {
  48. WIA_ERROR((TEXT("FATAL: _pWizInfo is NULL, exiting early")));
  49. return FALSE;
  50. }
  51. //
  52. // Set font...
  53. //
  54. SendDlgItemMessage(_hDlg, IDC_WELCOME, WM_SETFONT, (WPARAM)_pWizInfo->GetIntroFont(_hDlg), 0);
  55. //
  56. // Set wizard icons...
  57. //
  58. SendMessage( GetParent(_hDlg), WM_SETICON, ICON_SMALL, (LPARAM)_pWizInfo->GetSmallIcon() );
  59. SendMessage( GetParent(_hDlg), WM_SETICON, ICON_BIG, (LPARAM)_pWizInfo->GetLargeIcon() );
  60. return TRUE;
  61. }
  62. /*****************************************************************************
  63. CStartPage::DoHandleMessage
  64. Hanlder for messages sent to this page...
  65. *****************************************************************************/
  66. INT_PTR CStartPage::DoHandleMessage( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
  67. {
  68. WIA_PUSH_FUNCTION_MASK((TRACE_DLGPROC, TEXT("CStartPage::DoHandleMessage( uMsg = 0x%x, wParam = 0x%x, lParam = 0x%x )"),uMsg,wParam,lParam));
  69. switch ( uMsg )
  70. {
  71. case WM_INITDIALOG:
  72. _hDlg = hDlg;
  73. return _OnInitDialog();
  74. case WM_NOTIFY:
  75. {
  76. LPNMHDR pnmh = (LPNMHDR)lParam;
  77. LONG_PTR lpRes = 0;
  78. switch (pnmh->code)
  79. {
  80. case PSN_SETACTIVE:
  81. WIA_TRACE((TEXT("CStartPage: got PSN_SETACTIVE")));
  82. //
  83. // Add all the objects to the list...
  84. //
  85. PropSheet_SetWizButtons( GetParent(_hDlg), PSWIZB_NEXT );
  86. PostMessage( _hDlg, STARTPAGE_MSG_LOAD_ITEMS, 0, 0 );
  87. lpRes = 0;
  88. break;
  89. case PSN_WIZNEXT:
  90. WIA_TRACE((TEXT("CStartPage: got PSN_WIZNEXT")));
  91. if (_pWizInfo && (_pWizInfo->AllPicturesAdded()) && (_pWizInfo->CountOfPhotos(FALSE) == 1))
  92. {
  93. lpRes = IDD_PRINTING_OPTIONS;
  94. }
  95. else
  96. {
  97. lpRes = IDD_PICTURE_SELECTION;
  98. }
  99. break;
  100. case PSN_WIZBACK:
  101. WIA_TRACE((TEXT("CStartPage: got PSN_WIZBACK")));
  102. lpRes = -1;
  103. break;
  104. case PSN_QUERYCANCEL:
  105. WIA_TRACE((TEXT("CStartPage: got PSN_QUERYCANCEL")));
  106. if (_pWizInfo)
  107. {
  108. lpRes = _pWizInfo->UserPressedCancel();
  109. }
  110. break;
  111. }
  112. SetWindowLongPtr( hDlg, DWLP_MSGRESULT, lpRes );
  113. return TRUE;
  114. }
  115. case STARTPAGE_MSG_LOAD_ITEMS:
  116. if (_pWizInfo)
  117. {
  118. _pWizInfo->AddAllPhotosFromDataObject();
  119. }
  120. break;
  121. }
  122. return FALSE;
  123. }