Option.cpp
资源名称:(vc).rar [点击查看]
上传用户:wpp2016
上传日期:2010-02-01
资源大小:1250k
文件大小:3k
源码类别:
Telnet服务器
开发平台:
Visual C++
- // Option.cpp : implementation file
- //
- #include "stdafx.h"
- #include "anywhere.h"
- #include "Option.h"
- #include "thread1.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // COption dialog
- COption::COption(CWnd* pParent /*=NULL*/)
- : CDialog(COption::IDD, pParent)
- {
- //{{AFX_DATA_INIT(COption)
- m_password = _T("");
- m_username = _T("");
- m_timeout = 0;
- m_request = 0;
- //}}AFX_DATA_INIT
- }
- void COption::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(COption)
- DDX_Control(pDX, IDC_RADIO1, m_radio);
- DDX_Control(pDX, IDC_CANCEL, m_quit);
- DDX_Control(pDX, IDC_OK, m_config);
- DDX_Text(pDX, IDC_PASSWORD, m_password);
- DDX_Text(pDX, IDC_USERNAME, m_username);
- DDX_Text(pDX, IDC_TIMEOUT, m_timeout);
- DDX_Text(pDX, IDC_REQUEST, m_request);
- //}}AFX_DATA_MAP
- DDX_Control(pDX,IDC_RADIO2,m_radio2);
- DDX_Control(pDX,IDC_RADIO3,m_radio3);
- }
- BEGIN_MESSAGE_MAP(COption, CDialog)
- //{{AFX_MSG_MAP(COption)
- ON_BN_CLICKED(IDC_OK, OnOk)
- ON_BN_CLICKED(IDC_CANCEL, OnCancel)
- ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
- ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
- ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
- ON_MESSAGE(WM_SETACTIVE,OnSetActive)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // COption message handlers
- void COption::OnOk()
- {
- UpdateData(TRUE);
- CString ask,caption;
- ask.LoadString(IDS_ACTION_ASK);
- caption.LoadString(IDS_CAPTION);
- if (IDYES==MessageBox(ask,caption,MB_YESNO))
- {
- //CWaitCursor wc;
- timeout=m_timeout;
- request=m_request;
- DWORD ThreadId;
- CString order="CONFIG**";
- //DWORD pix=MAKELONG(m_pixlow,m_pixhigh);
- order=order+m_username+m_password+pix;
- strcpy(linkrc.sbuf,order);
- linkrc.m_hWnd=GetSafeHwnd();//将listproc对话框句柄付给线程
- hSend=CreateThread(NULL,0,SendThread,&linkrc,0,&ThreadId);
- m_quit.EnableWindow(FALSE);
- m_config.EnableWindow(FALSE);
- }
- }
- void COption::OnCancel()
- {
- CDialog::OnCancel();
- }
- BOOL COption::OnInitDialog()
- {
- CDialog::OnInitDialog();
- m_timeout=timeout;
- m_request=request;
- m_username=linkrc.username;
- m_password=linkrc.password;
- m_radio2.SetCheck(1);
- //pix="800*600";
- UpdateData(FALSE);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void COption::OnRadio1()
- {
- pix="1024*768";
- }
- void COption::OnRadio2()
- {
- pix="800*600";
- }
- void COption::OnRadio3()
- {
- pix="640*480";
- }
- LRESULT COption::OnSetActive(WPARAM wParam,LPARAM lParam)
- {
- m_quit.EnableWindow(TRUE);
- m_config.EnableWindow(TRUE);
- if ((BOOL)wParam) {
- CString text=*(CString*)lParam;
- CString order;
- order=text.Left(8);
- text=text.Right(text.GetLength()-8);
- CString sSucmsg,caption;
- sSucmsg.LoadString(IDS_ACTION_OK);
- caption.LoadString(IDS_CAPTION);
- sSucmsg=sSucmsg+"远端分辨率:"+text;
- MessageBox(sSucmsg,caption,MB_OK);
- return 1;
- }
- return 0;
- }