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.

74 lines
2.1 KiB

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