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.

82 lines
1.9 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. #include "precomp.h"
  3. #include "NSPicker.h"
  4. // Help IDs
  5. /*DWORD aAdvancedHelpIds[] = {
  6. IDC_ADV_PERF_ICON, (IDH_ADVANCED + 0),
  7. 0, 0
  8. };
  9. */
  10. //------------------------------------------------------
  11. CNSPicker::CNSPicker(CWbemServices &root) :
  12. m_WbemService(root)
  13. {
  14. }
  15. //------------------------------------------------------
  16. CNSPicker::~CNSPicker(void)
  17. {
  18. }
  19. //----------------------------------------------
  20. LRESULT CNSPicker::OnInit(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  21. {
  22. // PopulateTree(m_hWnd, IDC_NSTREE, m_WbemService);
  23. return TRUE;
  24. }
  25. //----------------------------------------------
  26. LRESULT CNSPicker::OnContextHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  27. {
  28. /* ::WinHelp((HWND)((LPHELPINFO)lParam)->hItemHandle,
  29. _T("sysdm.hlp"),
  30. HELP_WM_HELP,
  31. (DWORD)(LPSTR)aAdvancedHelpIds);
  32. */
  33. return TRUE;
  34. }
  35. //----------------------------------------------
  36. LRESULT CNSPicker::OnCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  37. {
  38. switch(wID)
  39. {
  40. case IDOK:
  41. {
  42. // save the currently selected fullpath name.
  43. HWND hTree = ::GetDlgItem(m_hWnd, IDC_NSTREE);
  44. TV_ITEM item;
  45. item.mask = TVIF_PARAM;
  46. item.hItem = m_hSelectedItem;
  47. BOOL x = TreeView_GetItem(hTree, &item);
  48. _tcsncpy(m_path, ((ITEMEXTRA *)item.lParam)->fullPath, MAX_PATH);
  49. }
  50. EndDialog(IDOK);
  51. break;
  52. case IDCANCEL:
  53. EndDialog(IDCANCEL);
  54. break;
  55. }
  56. return TRUE;
  57. }
  58. //----------------------------------------------
  59. LRESULT CNSPicker::OnSelChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
  60. {
  61. switch(pnmh->code)
  62. {
  63. case TVN_SELCHANGED:
  64. if(pnmh->idFrom == IDC_NSTREE)
  65. {
  66. LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)pnmh;
  67. m_hSelectedItem = pnmtv->itemNew.hItem;
  68. }
  69. break;
  70. }
  71. return TRUE;
  72. }