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.

168 lines
4.3 KiB

  1. #include "pch.h"
  2. #pragma hdrstop
  3. /*-----------------------------------------------------------------------------
  4. / Local functions / data
  5. /----------------------------------------------------------------------------*/
  6. static WCHAR c_szQueryPrefix[] = L"(ou>=\"\")";
  7. static LPWSTR c_szClassList[] =
  8. {
  9. L"organizationalUnit",
  10. };
  11. static PAGECTRL ctrls[] =
  12. {
  13. IDC_OUNAME, c_szName, FILTER_CONTAINS,
  14. };
  15. static COLUMNINFO columns[] =
  16. {
  17. 0, 0, IDS_CN, 0, c_szName,
  18. 0, 0, IDS_OBJECTCLASS, DSCOLUMNPROP_OBJECTCLASS, NULL,
  19. 0, DEFAULT_WIDTH_DESCRIPTION, IDS_DESCRIPTION, 0, c_szDescription,
  20. };
  21. //
  22. // Help ID mappings
  23. //
  24. static DWORD const aFormHelpIDs[] =
  25. {
  26. IDC_OUNAME, IDH_DIR_FOLDER_NAMED,
  27. 0, 0
  28. };
  29. /*-----------------------------------------------------------------------------
  30. / PageProc_Container
  31. / ------------------
  32. / FormProc for handling the messages for this object.
  33. /
  34. / In:
  35. / pForm -> instance data for this form
  36. / hwnd = window handle for the form dialog
  37. / uMsg, wParam, lParam = message parameters
  38. /
  39. / Out:
  40. / HRESULT (E_NOTIMPL) if not handled
  41. /----------------------------------------------------------------------------*/
  42. HRESULT CALLBACK PageProc_Container(LPCQPAGE pForm, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  43. {
  44. HRESULT hr = S_OK;
  45. LPWSTR pQuery = NULL;
  46. TraceEnter(TRACE_FORMS, "PageProc_Container");
  47. switch ( uMsg )
  48. {
  49. case CQPM_INITIALIZE:
  50. case CQPM_RELEASE:
  51. break;
  52. case CQPM_ENABLE:
  53. EnablePageControls(hwnd, ctrls, ARRAYSIZE(ctrls), (BOOL)wParam);
  54. break;
  55. case CQPM_GETPARAMETERS:
  56. {
  57. hr = GetQueryString(&pQuery, c_szQueryPrefix, hwnd, ctrls, ARRAYSIZE(ctrls));
  58. if ( SUCCEEDED(hr) )
  59. {
  60. hr = QueryParamsAlloc((LPDSQUERYPARAMS*)lParam, pQuery, GLOBAL_HINSTANCE, ARRAYSIZE(columns), columns);
  61. LocalFreeStringW(&pQuery);
  62. }
  63. FailGracefully(hr, "Failed to build DS argument block");
  64. break;
  65. }
  66. case CQPM_CLEARFORM:
  67. ResetPageControls(hwnd, ctrls, ARRAYSIZE(ctrls));
  68. break;
  69. case CQPM_PERSIST:
  70. {
  71. BOOL fRead = (BOOL)wParam;
  72. IPersistQuery* pPersistQuery = (IPersistQuery*)lParam;
  73. hr = PersistQuery(pPersistQuery, fRead, c_szMsContainers, hwnd, ctrls, ARRAYSIZE(ctrls));
  74. FailGracefully(hr, "Failed to write controls data");
  75. break;
  76. }
  77. case CQPM_HELP:
  78. {
  79. LPHELPINFO pHelpInfo = (LPHELPINFO)lParam;
  80. WinHelp((HWND)pHelpInfo->hItemHandle,
  81. DSQUERY_HELPFILE,
  82. HELP_WM_HELP,
  83. (DWORD_PTR)aFormHelpIDs);
  84. break;
  85. }
  86. case DSQPM_GETCLASSLIST:
  87. {
  88. hr = ClassListAlloc((LPDSQUERYCLASSLIST*)lParam, c_szClassList, ARRAYSIZE(c_szClassList));
  89. FailGracefully(hr, "Failed to allocate class list");
  90. break;
  91. }
  92. case DSQPM_HELPTOPICS:
  93. {
  94. HWND hwndFrame = (HWND)lParam;
  95. HtmlHelp(hwndFrame, TEXT("omc.chm"), HH_HELP_FINDER, 0);
  96. break;
  97. }
  98. default:
  99. hr = E_NOTIMPL;
  100. break;
  101. }
  102. exit_gracefully:
  103. TraceLeaveResult(hr);
  104. }
  105. /*-----------------------------------------------------------------------------
  106. / DlgProc_Container
  107. / -----------------
  108. / Standard dialog proc for the form, handle any special buttons and other
  109. / such nastyness we must here.
  110. /
  111. / In:
  112. / hwnd, uMsg, wParam, lParam = standard parameters
  113. /
  114. / Out:
  115. / INT_PTR
  116. /----------------------------------------------------------------------------*/
  117. INT_PTR CALLBACK DlgProc_Container(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  118. {
  119. INT_PTR fResult = 0;
  120. LPCQPAGE pQueryPage;
  121. HANDLE hThread;
  122. DWORD dwThreadId;
  123. HWND hwndCtrl;
  124. if ( uMsg == WM_INITDIALOG )
  125. {
  126. pQueryPage = (LPCQPAGE)lParam;
  127. SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)pQueryPage);
  128. Edit_LimitText(GetDlgItem(hwnd, IDC_OUNAME), MAX_PATH);
  129. }
  130. else if ( uMsg == WM_CONTEXTMENU )
  131. {
  132. WinHelp((HWND)wParam, DSQUERY_HELPFILE, HELP_CONTEXTMENU, (DWORD_PTR)aFormHelpIDs);
  133. fResult = TRUE;
  134. }
  135. return fResult;
  136. }