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.

124 lines
3.4 KiB

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1995 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. #include "stdafx.h"
  11. #include "stdafx2.h"
  12. #include <dlgs.h>
  13. #ifdef AFX_AUX_SEG
  14. #pragma code_seg(AFX_AUX_SEG)
  15. #endif
  16. #ifdef _DEBUG
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. #define new DEBUG_NEW
  21. static const UINT nMsgLBSELCHANGE = ::RegisterWindowMessage(LBSELCHSTRING);
  22. static const UINT nMsgSHAREVI = ::RegisterWindowMessage(SHAREVISTRING);
  23. static const UINT nMsgFILEOK = ::RegisterWindowMessage(FILEOKSTRING);
  24. static const UINT nMsgCOLOROK = ::RegisterWindowMessage(COLOROKSTRING);
  25. static const UINT nMsgHELP = ::RegisterWindowMessage(HELPMSGSTRING);
  26. UINT_PTR CALLBACK
  27. _AfxCommDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  28. {
  29. if (hWnd == NULL)
  30. return 0;
  31. /*
  32. _AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
  33. if (pThreadState->m_pAlternateWndInit != NULL)
  34. {
  35. ASSERT_KINDOF(CFileDialog,pThreadState->m_pAlternateWndInit);
  36. pThreadState->m_pAlternateWndInit->SubclassWindow(hWnd);
  37. pThreadState->m_pAlternateWndInit = NULL;
  38. }
  39. ASSERT(pThreadState->m_pAlternateWndInit == NULL);
  40. */
  41. if (message == WM_INITDIALOG)
  42. return (UINT)AfxDlgProc(hWnd, message, wParam, lParam);
  43. if (message == nMsgHELP ||
  44. (message == WM_COMMAND && LOWORD(wParam) == pshHelp))
  45. {
  46. // just translate the message into the AFX standard help command.
  47. SendMessage(hWnd, WM_COMMAND, ID_HELP, 0);
  48. return 1;
  49. }
  50. if (message < 0xC000)
  51. {
  52. // not a ::RegisterWindowMessage message
  53. return 0;
  54. }
  55. // assume it is already wired up to a permanent one
  56. CDialog* pDlg = (CDialog*)CWnd::FromHandlePermanent(hWnd);
  57. ASSERT(pDlg != NULL);
  58. ASSERT_KINDOF(CDialog, pDlg);
  59. if (pDlg->IsKindOf(RUNTIME_CLASS(CFileDialog)))
  60. {
  61. // If we're exploring then we are not interested in the Registered messages
  62. if (((CFileDialog*)pDlg)->m_ofn.Flags & OFN_EXPLORER)
  63. return 0;
  64. }
  65. // RegisterWindowMessage - does not copy to lastState buffer, so
  66. // CWnd::GetCurrentMessage and CWnd::Default will NOT work
  67. // while in these handlers
  68. // Dispatch special commdlg messages through our virtual callbacks
  69. if (message == nMsgSHAREVI)
  70. {
  71. ASSERT_KINDOF(CFileDialog, pDlg);
  72. return ((CFileDialog*)pDlg)->OnShareViolation((LPCTSTR)lParam);
  73. }
  74. else if (message == nMsgFILEOK)
  75. {
  76. ASSERT_KINDOF(CFileDialog, pDlg);
  77. if (afxData.bWin4)
  78. ((CFileDialog*)pDlg)->m_pofnTemp = (OPENFILENAME*)lParam;
  79. BOOL bResult = ((CFileDialog*)pDlg)->OnFileNameOK();
  80. ((CFileDialog*)pDlg)->m_pofnTemp = NULL;
  81. return bResult;
  82. }
  83. else if (message == nMsgLBSELCHANGE)
  84. {
  85. ASSERT_KINDOF(CFileDialog, pDlg);
  86. ((CFileDialog*)pDlg)->OnLBSelChangedNotify((UINT)wParam, LOWORD(lParam),
  87. HIWORD(lParam));
  88. return 0;
  89. }
  90. else if (message == nMsgCOLOROK)
  91. {
  92. ASSERT_KINDOF(CColorDialog, pDlg);
  93. return ((CColorDialog*)pDlg)->OnColorOK();
  94. }
  95. /*
  96. //
  97. // _afxNMsgSETRGB causes problems with the build. Since it's not used
  98. // for anything anyway, don't use it.
  99. //
  100. else if (message == _afxNMsgSETRGB)
  101. {
  102. // nothing to do here, since this is a SendMessage
  103. return 0;
  104. }
  105. */
  106. return 0;
  107. }