1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- /****************************************************************/
- /* */
- /* AddIPDlg.cpp */
- /* */
- /* Implementation of the CAddIPDlg class. */
- /* This class is a part of the FTP Server Application */
- /* */
- /* Programmed by LYFZ van der Meer */
- /* Copyright LYFZ Software Solutions 2002 */
- /* http://www.LYFZvandermeer.nl */
- /* */
- /* Last updated: 10 july 2002 */
- /* */
- /****************************************************************/
- #include "stdafx.h"
- #include "DBServer.h"
- #include "theDBServer.h"
- #include "AddIPDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- CAddIPDlg::CAddIPDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CAddIPDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CAddIPDlg)
- m_strIPaddress = _T("");
- //}}AFX_DATA_INIT
- }
- void CAddIPDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CAddIPDlg)
- DDX_Text(pDX, IDC_IPADDRESS, m_strIPaddress);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CAddIPDlg, CDialog)
- //{{AFX_MSG_MAP(CAddIPDlg)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /********************************************************************/
- /* */
- /* Function name : OnInitDialog */
- /* Description : Initialize dialog */
- /* */
- /********************************************************************/
- BOOL CAddIPDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- if (!m_strTitle.IsEmpty())
- SetWindowText(m_strTitle);
- // ip address can be 255.255.255.255 = 15 chars max.
- ((CEdit *)GetDlgItem(IDC_IPADDRESS))->SetLimitText(15);
- CenterWindow();
- return TRUE;
- }
- /********************************************************************/
- /* */
- /* Function name : PreTranslateMessage */
- /* Description : Only accept numeric characters, decimal point */
- /* separators, backspace and tabs. */
- /* */
- /********************************************************************/
- BOOL CAddIPDlg::PreTranslateMessage(MSG* pMsg)
- {
- if (pMsg->message == WM_CHAR && pMsg->hwnd == ::GetDlgItem(m_hWnd, IDC_IPADDRESS))
- {
- TCHAR nChar = (TCHAR)pMsg->wParam;
- if ((IsCharAlphaNumeric(nChar) && !IsCharAlpha(nChar)) ||
- nChar == '.' || nChar == '\b' || nChar == '\t' || nChar == '*')
- {
- return CDialog::PreTranslateMessage(pMsg);
- }
- else
- {
- // eat character
- return TRUE;
- }
- }
- return CDialog::PreTranslateMessage(pMsg);
- }
|