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.

79 lines
2.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1997
  6. //
  7. // File: dlgaddm.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // dlgaddm.cpp : implementation file
  11. //
  12. #include "stdafx.h"
  13. #include "dlgaddm.h"
  14. #include "shlobj.h" // shell 32 version
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CAddMachineDlg dialog
  22. CAddMachineDlg::CAddMachineDlg(CWnd* pParent /*=NULL*/)
  23. : CDialog(CAddMachineDlg::IDD, pParent)
  24. {
  25. //{{AFX_DATA_INIT(CAddMachineDlg)
  26. m_strMachineName = _T("");
  27. //}}AFX_DATA_INIT
  28. }
  29. void CAddMachineDlg::DoDataExchange(CDataExchange* pDX)
  30. {
  31. CDialog::DoDataExchange(pDX);
  32. //{{AFX_DATA_MAP(CAddMachineDlg)
  33. DDX_Text(pDX, IDC_REMOTENAME, m_strMachineName);
  34. //}}AFX_DATA_MAP
  35. }
  36. BEGIN_MESSAGE_MAP(CAddMachineDlg, CDialog)
  37. //{{AFX_MSG_MAP(CAddMachineDlg)
  38. ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
  39. //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CAddMachineDlg message handlers
  43. void CAddMachineDlg::OnBrowse()
  44. {
  45. BROWSEINFO BrowseInfo;
  46. LPITEMIDLIST pidlComputer;
  47. TCHAR szRemoteName[4096];
  48. IMalloc * pMalloc;
  49. BrowseInfo.hwndOwner = GetSafeHwnd();
  50. BrowseInfo.pidlRoot = (LPITEMIDLIST) MAKEINTRESOURCE(CSIDL_NETWORK);
  51. BrowseInfo.pszDisplayName = szRemoteName;
  52. BrowseInfo.lpszTitle = _T("Click on the computer you want to connect to.");//LoadDynamicString(IDS_COMPUTERBROWSETITLE);
  53. BrowseInfo.ulFlags = BIF_BROWSEFORCOMPUTER;
  54. BrowseInfo.lpfn = NULL;
  55. if ((pidlComputer = SHBrowseForFolder(&BrowseInfo)) != NULL)
  56. {
  57. SHGetMalloc(&pMalloc);
  58. pMalloc->Free(pidlComputer);
  59. pMalloc->Release();
  60. Trace1("User selected %s\n", szRemoteName);
  61. GetDlgItem(IDC_REMOTENAME)->SetWindowText(szRemoteName);
  62. }
  63. }