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.

97 lines
2.6 KiB

  1. // NmAgendaItemPropPage.cpp : Implementation of CNmAgendaItemPropPage
  2. #include "precomp.h"
  3. #include "resource.h"
  4. #include "NmCtl1.h"
  5. #include "NmAgendaHelper.h"
  6. #include "NmAgendaItemPropPage.h"
  7. /////////////////////////////////////////////////////////////////////////////
  8. // CNmAgendaItemPropPage
  9. STDMETHODIMP CNmAgendaItemPropPage::Apply(void)
  10. {
  11. DBGENTRY(CNmAgendaItemPropPage::Apply);
  12. HRESULT hr = S_OK;
  13. for (UINT i = 0; i < m_nObjects; i++)
  14. {
  15. CComQIPtr<INmAgendaItem,&IID_INmAgendaItem> pNmAgendaItem( m_ppUnk[i] );
  16. if( pNmAgendaItem )
  17. {
  18. HWND hEditName = GetDlgItem( IDC_EDITAGENDAITEMNAME );
  19. if( hEditName )
  20. {
  21. int cbLen = 1 + ::GetWindowTextLength( hEditName );
  22. if( cbLen > 1 )
  23. {
  24. TCHAR* sz = new TCHAR[ cbLen ];
  25. if( ::GetWindowText( hEditName, sz, cbLen ) )
  26. {
  27. hr = pNmAgendaItem->put_Name( CComBSTR( sz ) );
  28. if( FAILED( hr ) )
  29. {
  30. WARNING_OUT(("put_Name Failed"));
  31. }
  32. }
  33. delete [] sz;
  34. }
  35. }
  36. }
  37. }
  38. m_bDirty = FALSE;
  39. DBGEXIT_HR(CNmAgendaItemPropPage::Apply, hr);
  40. return hr;
  41. }
  42. LRESULT CNmAgendaItemPropPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  43. {
  44. LRESULT lr = TRUE;
  45. USES_CONVERSION;
  46. DBGENTRY(CNmAgendaItemPropPage::OnInitDialog);
  47. if( m_nObjects > 0 )
  48. {
  49. CComQIPtr<INmAgendaItem,&IID_INmAgendaItem> pNmAgendaItem( m_ppUnk[0] );
  50. if( pNmAgendaItem )
  51. {
  52. BSTR bstrName;
  53. if( SUCCEEDED( pNmAgendaItem->get_Name( &bstrName ) ) )
  54. {
  55. SetDlgItemText( IDC_EDITAGENDAITEMNAME, W2T( bstrName ) );
  56. NmAgendaItemType Type;
  57. if( SUCCEEDED( pNmAgendaItem->get_Type( &Type ) ) )
  58. {
  59. SetDlgItemText( IDC_EDITAGENDAITEMTYPE, NmAgendaItemTypeToa( Type ) );
  60. }
  61. }
  62. }
  63. }
  64. m_bDirty = FALSE;
  65. m_bInitialized = true;
  66. DBGEXIT_ULONG(CNmAgendaItemPropPage::OnInitDialog, lr);
  67. return lr;
  68. }
  69. LRESULT CNmAgendaItemPropPage::OnAgendaItemNameChange(WORD wNotify, WORD wID, HWND hWnd, BOOL& bHandled)
  70. {
  71. DBGENTRY(CNmAgendaItemPropPage::OnAgendaItemNameChange);
  72. if( m_bInitialized )
  73. {
  74. SetDirty( TRUE );
  75. }
  76. DBGEXIT(CNmAgendaItemPropPage::OnAgendaItemNameChange);
  77. return 0L;
  78. }