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.

178 lines
4.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: T R A C E U I . C P P
  7. //
  8. // Contents: Trace configuration UI property sheet code
  9. //
  10. // Notes:
  11. //
  12. // Author: jeffspr 1 Sept 1998
  13. //
  14. //----------------------------------------------------------------------------
  15. #include <pch.h>
  16. #pragma hdrstop
  17. #ifdef ENABLETRACE
  18. #include "ncdebug.h"
  19. #include "ncui.h"
  20. #include "traceui.h"
  21. //---[ Constants ]------------------------------------------------------------
  22. const WCHAR c_szTraceUICaption[] = L"Tracing Configuration"; // Propsheet caption
  23. HRESULT HrOpenTracingUI(HWND hwndOwner)
  24. {
  25. HRESULT hr = S_OK;
  26. int nRet = 0;
  27. CPropSheetPage * ppspTrace = new CTraceTagPage;
  28. CPropSheetPage * ppspFlags = new CDbgFlagPage;
  29. HPROPSHEETPAGE hpsp[2] = {0};
  30. PROPSHEETHEADER psh;
  31. if (!ppspTrace || !ppspFlags)
  32. {
  33. hr = E_FAIL;
  34. goto Exit;
  35. }
  36. hpsp[0] = ppspTrace->CreatePage(IDD_TRACETAGS, 0);
  37. hpsp[1] = ppspTrace->CreatePage(IDD_DBGFLAGS, 0);
  38. ZeroMemory (&psh, sizeof(psh));
  39. psh.dwSize = sizeof( PROPSHEETHEADER );
  40. psh.dwFlags = PSH_NOAPPLYNOW;
  41. psh.hwndParent = hwndOwner;
  42. psh.hInstance = _Module.GetResourceInstance();
  43. psh.pszCaption = c_szTraceUICaption;
  44. psh.nPages = 2;
  45. psh.phpage = hpsp;
  46. nRet = PropertySheet(&psh);
  47. Exit:
  48. return hr;
  49. }
  50. //+---------------------------------------------------------------------------
  51. //
  52. // Function: OnTraceHelpGeneric
  53. //
  54. // Purpose: Generic help handler function.
  55. //
  56. // Arguments:
  57. // hwnd [in] Parent window
  58. // lParam [in] lParam passed to WM_HELP handler
  59. //
  60. // Returns: Nothing
  61. //
  62. // Author: danielwe 25 Feb 1998
  63. //
  64. // Notes:
  65. //
  66. VOID OnTraceHelpGeneric(HWND hwnd, LPARAM lParam)
  67. {
  68. LPHELPINFO lphi;
  69. lphi = reinterpret_cast<LPHELPINFO>(lParam);
  70. Assert(lphi);
  71. if (lphi->iContextType == HELPINFO_WINDOW)
  72. {
  73. #if 0 // NYI
  74. WinHelp(hwnd, c_szNetCfgHelpFile, HELP_CONTEXTPOPUP,
  75. lphi->iCtrlId);
  76. #endif
  77. }
  78. }
  79. //+---------------------------------------------------------------------------
  80. //
  81. // Function Name: HrInitTraceListView
  82. //
  83. // Purpose: Initialize the list view.
  84. // Iterate through all installed clients, services and protocols,
  85. // insert into the list view with the correct binding state with
  86. // the adapter used in this connection.
  87. //
  88. // Arguments:
  89. // hwndList[in]: Handle of the list view
  90. // pnc[in]: The writable INetcfg pointer
  91. // pnccAdapter[in]: The INetcfgComponent pointer to the adapter used in this connection
  92. //
  93. // Returns: HRESULT, Error code.
  94. //
  95. // Notes:
  96. //
  97. HRESULT HrInitTraceListView(HWND hwndList, HIMAGELIST *philStateIcons)
  98. {
  99. HRESULT hr = S_OK;
  100. RECT rc;
  101. LV_COLUMN lvc = {0};
  102. Assert(hwndList);
  103. // Set the shared image lists bit so the caller can destroy the class
  104. // image lists itself
  105. //
  106. DWORD dwStyle = GetWindowLong(hwndList, GWL_STYLE);
  107. SetWindowLong(hwndList, GWL_STYLE, (dwStyle | LVS_SHAREIMAGELISTS));
  108. // Create state image lists
  109. *philStateIcons = ImageList_LoadBitmap(
  110. _Module.GetResourceInstance(),
  111. MAKEINTRESOURCE(IDB_TRACE_CHECKSTATE),
  112. 16,
  113. 0,
  114. PALETTEINDEX(6));
  115. ListView_SetImageList(hwndList, *philStateIcons, LVSIL_STATE);
  116. GetClientRect(hwndList, &rc);
  117. lvc.mask = LVCF_FMT; // | LVCF_WIDTH
  118. lvc.fmt = LVCFMT_LEFT;
  119. // lvc.cx = rc.right;
  120. ListView_InsertColumn(hwndList, 0, &lvc);
  121. if (SUCCEEDED(hr))
  122. {
  123. // Selete the first item
  124. ListView_SetItemState(hwndList, 0, LVIS_SELECTED, LVIS_SELECTED);
  125. }
  126. TraceError("HrInitTraceListView", hr);
  127. return hr;
  128. }
  129. //+---------------------------------------------------------------------------
  130. //
  131. // Function: UninitTraceListView
  132. //
  133. // Purpose: Uninitializes the common component list view
  134. //
  135. // Arguments:
  136. // hwndList [in] HWND of listview
  137. //
  138. // Returns: Nothing
  139. //
  140. // Author: danielwe 2 Feb 1998
  141. //
  142. // Notes:
  143. //
  144. VOID UninitTraceListView(HWND hwndList)
  145. {
  146. Assert(hwndList);
  147. // delete existing items in the list view
  148. ListView_DeleteAllItems( hwndList );
  149. }
  150. #endif // ENABLE_TRACE