|
#include "stdafx.h"
#include "FtpSite.h"
#include "SiteDlg.h"
void CeSiteDlg::OnOK()
{
CeFtpSite site;
m_site.m_strName = CeString(GetDlgItem(IDC_EDITNAME));
if (m_site.m_strName.IsEmpty() || m_site.m_strName == _T("<...>"))
return;
m_site.m_strAddress = CeString(GetDlgItem(IDC_EDITIP));
if (m_site.m_strAddress == _T("<...>"))
m_site.m_strAddress.Empty();
m_site.m_strUser = CeString(GetDlgItem(IDC_EDITUSER));
if (m_site.m_strUser == _T("<...>"))
m_site.m_strUser.Empty();
m_site.m_strPassword = CeString(GetDlgItem(IDC_EDITPASS));
if (m_site.m_strPassword == _T("<...>"))
m_site.m_strPassword.Empty();
m_site.m_bAnon = (BST_CHECKED == Button_GetCheck(GetDlgItem(IDC_ANON)));
m_site.m_bPassive = (BST_CHECKED == Button_GetCheck(GetDlgItem(IDC_PASSIVE)));
m_site.Update();
CeDialog::OnOK();
}
BOOL CeSiteDlg::OnCommand(WPARAM wParam, LPARAM lParam, bool& bHandled)
{
BOOL bRet = CeDialog::OnCommand(wParam, lParam, bHandled);
WORD wNotify = HIWORD(wParam); // notification code
WORD wId = LOWORD(wParam); // item, control, or accelerator identifier
HWND hwndCtl = (HWND) lParam; // handle of control
bHandled = true;
if (hwndCtl != NULL)
{
if (IDC_ANON == wId && BN_CLICKED == wNotify)
{
if (BST_CHECKED == Button_GetCheck(hwndCtl))
{
m_labelUser.SetWindowText(_T("anonymous"));
m_labelPassword.SetWindowText(_T("anonymous@anon.com"));
}
else
{
m_labelUser.SetWindowText(_T(""));
m_labelPassword.SetWindowText(_T(""));
}
}
}
return TRUE;
}
BOOL CeSiteDlg::OnInitDialog()
{
BOOL bRet = CeDialog::OnInitDialog();
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT;
m_labelName.ReplaceWindow(IDC_EDITNAME, m_hWnd, dwStyle);
m_labelName.SetWindowText(m_site.m_strName);
if (!m_site.m_strName.IsEmpty())
m_labelName.SetReadOnly();
m_labelIP.ReplaceWindow(IDC_EDITIP, m_hWnd, dwStyle);
m_labelUser.ReplaceWindow(IDC_EDITUSER, m_hWnd, dwStyle);
m_labelPassword.ReplaceWindow(IDC_EDITPASS, m_hWnd, dwStyle|ES_PASSWORD);
Button_SetCheck(GetDlgItem(IDC_ANON), BST_CHECKED);
Button_SetCheck(GetDlgItem(IDC_PASSIVE), BST_CHECKED);
return bRet;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.