Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
Proc.cpp
Package: anywhere.zip [view]
Upload User: zhenhuadz
Upload Date: 2007-01-07
Package Size: 1511k
Code Size: 3k
Category:
Remote Control
Development Platform:
Visual C++
- // Proc.cpp : implementation file
- //
- #include "stdafx.h"
- #include "anywhere.h"
- #include "Proc.h"
- #include "thread1.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CProc dialog
- CProc::CProc(CWnd* pParent /*=NULL*/)
- : CDialog(CProc::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CProc)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CProc::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CProc)
- DDX_Control(pDX, IDC_LISTPROC, m_btlist);
- DDX_Control(pDX, IDCANCEL, m_btquit);
- DDX_Control(pDX, IDOK, m_btkill);
- DDX_Control(pDX, IDC_PROCLIST, m_proclist);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CProc, CDialog)
- //{{AFX_MSG_MAP(CProc)
- ON_BN_CLICKED(IDC_LISTPROC, OnListproc)
- ON_MESSAGE(WM_SETACTIVE,OnSetActive)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CProc message handlers
- void CProc::OnListproc()
- {
- CString ask,caption;
- ask.LoadString(IDS_ACTION_ASK);
- caption.LoadString(IDS_CAPTION);
- if (IDYES==MessageBox(ask,caption,MB_YESNO))
- {
- CWaitCursor wc;
- DWORD ThreadId;
- CString order="LISTPROC";
- strcpy(linkrc.sbuf,order);
- linkrc.m_hWnd=GetSafeHwnd();//将listproc对话框句柄付给线程
- hSend=CreateThread(NULL,0,SendThread,&linkrc,0,&ThreadId);
- SetWindowText("请稍候,正在向远程机器发出列举进程命令");
- m_btquit.EnableWindow(FALSE);
- m_btlist.EnableWindow(FALSE);
- m_btkill.EnableWindow(FALSE);
- }
- }
- LRESULT CProc::OnSetActive(WPARAM wParam,LPARAM lParam)
- {
- m_btquit.EnableWindow(TRUE);
- m_btlist.EnableWindow(TRUE);
- m_btkill.EnableWindow(TRUE);
- if ((BOOL)wParam) {
- CString text=*(CString*)lParam;
- CString order;
- order=text.Left(8);
- text=text.Right(text.GetLength()-8);
- if (order=="KILLPROC") {
- CString sSucmsg,caption;
- sSucmsg.LoadString(IDS_KILLPROC_OK);
- sSucmsg+=parameter;
- caption.LoadString(IDS_CAPTION);
- MessageBox(sSucmsg,caption,MB_OK);
- return 1;
- }//杀掉进程
- else if (order=="LISTPROC") {
- m_proclist.ResetContent();
- ListProc(text);
- return 1;
- }
- }
- return 0;
- }
- void CProc::ListProc(CString text)
- {
- BOOL bFinished=FALSE;
- int pos;
- while (!bFinished) {
- if ((pos=text.Find("/"))!=-1)
- {
- //text1=text.Left(pos);//为名字+长度(目录无长度)
- m_proclist.AddString(text.Left(pos));//文件名字
- text=text.Right(text.GetLength()-pos-1);
- //m_remote.SetItemData(num,1);//为目录
- }
- else bFinished=true;
- }//end while
- SetWindowText("进程管理");
- }
- void CProc::OnOK()
- {
- int i=m_proclist.GetCurSel();
- if (i==-1) return;
- CString ask,caption;
- ask.LoadString(IDS_ACTION_ASK);
- caption.LoadString(IDS_CAPTION);
- if (IDYES==MessageBox(ask,caption,MB_YESNO))
- {
- //CWaitCursor wc;
- DWORD ThreadId;
- m_proclist.GetText(i,parameter);
- CString order="KILLPROC"+parameter;
- strcpy(linkrc.sbuf,order);
- linkrc.m_hWnd=GetSafeHwnd();//将listproc对话框句柄付给线程
- hSend=CreateThread(NULL,0,SendThread,&linkrc,0,&ThreadId);
- SetWindowText("请稍候,正在向远程机器发出杀掉进程命令");
- }
- //CDialog::OnOK();
- }