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.

79 lines
2.1 KiB

  1. //////////////////////////////////////////////////////////////
  2. //
  3. // ConnServerDlg.cpp
  4. //
  5. // Implementation of the "Connect..." dialog
  6. //
  7. //////////////////////////////////////////////////////////////
  8. #include "stdafx.h"
  9. #include "ConnServerDlg.h"
  10. #include <dsrole.h>
  11. #include <shlobj.h>
  12. LRESULT CConnectServerDlg::OnEditChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled )
  13. {
  14. // Check for Domain Name length
  15. int nLen = SendDlgItemMessage( IDC_SERVERNAME, WM_GETTEXTLENGTH );
  16. Prefix_EnableWindow( m_hWnd, IDOK, (nLen > 0));
  17. return 0;
  18. }
  19. LRESULT CConnectServerDlg::OnClose( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled )
  20. {
  21. StrGetEditText( m_hWnd, IDC_SERVERNAME, m_strName );
  22. EndDialog(wID);
  23. return 0;
  24. }
  25. LRESULT CConnectServerDlg::OnBrowse(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  26. {
  27. TCHAR szPath[MAX_PATH];
  28. int nImage = 0;
  29. tstring strTitle = StrLoadString( IDS_MENU_POP3_CONNECT );
  30. HRESULT hr = S_OK;
  31. ITEMIDLIST* pidlRoot = NULL;
  32. LPITEMIDLIST pList = NULL;
  33. CComPtr<IMalloc> spMalloc = NULL;
  34. hr = SHGetMalloc(&spMalloc);
  35. if( SUCCEEDED(hr) )
  36. {
  37. hr = SHGetFolderLocation( m_hWnd, CSIDL_NETWORK, NULL, NULL, &pidlRoot );
  38. }
  39. if( SUCCEEDED(hr) )
  40. {
  41. BROWSEINFO BrowseInfo;
  42. BrowseInfo.hwndOwner = m_hWnd;
  43. BrowseInfo.pidlRoot = pidlRoot;
  44. BrowseInfo.pszDisplayName = szPath;
  45. BrowseInfo.lpszTitle = strTitle.c_str();
  46. BrowseInfo.ulFlags = BIF_BROWSEFORCOMPUTER;
  47. BrowseInfo.lpfn = NULL;
  48. BrowseInfo.lParam = NULL;
  49. BrowseInfo.iImage = nImage;
  50. pList = SHBrowseForFolder(&BrowseInfo);
  51. }
  52. if( pList )
  53. {
  54. SetDlgItemText( IDC_SERVERNAME, szPath );
  55. spMalloc->Free( pList );
  56. pList = NULL;
  57. }
  58. if( pidlRoot )
  59. {
  60. spMalloc->Free( pidlRoot );
  61. pidlRoot = NULL;
  62. }
  63. return 0;
  64. }