MFC 基于对话框list control 和table control 的使用

aftersweet 2016-11-19 10:02:14
做一个基于对话框的应用程序,如下图所示,左边是个list 右边是个table然后table的表1和表2分别是两个对话框,两个对话框里面又各自包含一个list 。我想点击表1和表2对话框中的list的iSubItem,获取iSubItem的内容,添加到左边的list中。这个怎么实现数据传输。


现在右边的表中对话框中的list的单击选择iSunItem实现了单击选中,自己找的别人写的list control的然后customdraw,但是不知道怎么添加数据
...全文
670 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuanningcz 2016-12-14
  • 打赏
  • 举报
回复
你这个我上一个项目还在做,当时我是这么处理的: 建立一个全局变量的容器vector,该容器可以在所有类中被访问和修改。 然后所有类都来操作这个容器,这样就ok了。 我当时的情况比你这个复杂的多,我有四个主界面,二十多个副界面,都要在这里面交换数据。 另外建议你: 单独建立两个文件,比如common.h和common.cpp,头文件里面不要定义class,所有变量都用extern定义为全局变量。然后所有需要调用这个全局变量的类都来包含这个common.h就行了。 common.h里面注意不要#include "stdafx.h",这玩意只能包含在cpp文件的第一行,否则会引发一系列你无法想象的错误。
aftersweet 2016-12-14
  • 打赏
  • 举报
回复
引用 9 楼 VisualEleven 的回复:
右边的listctrl通知Tab控件,Tab控件通知对话框,对话框通知右边的ListCtrl列表。
思路我明白,或者用成员变量,把左边listctrl的指针一级一级传到右边listctrl所在对话框,但是我这个人比较懒,觉得这样都不如直接用findwindow获取的主窗口句柄,然后m_list.insertIterm方便。但是我不是很明白我这么做有什么不好的,你说的或者传指针的办法好在哪儿,总有种图方便会给自己留坑的感觉。
Eleven 2016-11-29
  • 打赏
  • 举报
回复
右边的listctrl通知Tab控件,Tab控件通知对话框,对话框通知右边的ListCtrl列表。
赵4老师 2016-11-28
  • 打赏
  • 举报
回复
自绘是早晚的事。
aftersweet 2016-11-27
  • 打赏
  • 举报
回复
引用 6 楼 shiyanzi 的回复:
tab里面的两个子对话框先发消息通知tab主对话框,从tab对话框里面发消息给list control,更新数据即可,
直接用findwindow获取的主窗口句柄,然后m_list.insertIterm
  • 打赏
  • 举报
回复
tab里面的两个子对话框先发消息通知tab主对话框,从tab对话框里面发消息给list control,更新数据即可,
洗洗睡去 2016-11-19
  • 打赏
  • 举报
回复
listctrl的customdraw都会了 不会填充数据? setitemtext
aftersweet 2016-11-19
  • 打赏
  • 举报
回复
或者不用list control和tabel control有更好的办法吗,总觉得这样搞就算实现了也有点别扭
gz_qmc 2016-11-19
  • 打赏
  • 举报
回复
这方法很2 但既然做到这样了 你可以将左边List的指针传进右边两个表的对话框里去 然后用指针直接插入 也可在向主对话框发送消息 主对话框相应消息后直接插入 科学的方法是自绘
zgl7903 2016-11-19
  • 打赏
  • 举报
回复
CListCtrl 添加数据 用 CListCtrl::InsertItem
aftersweet 2016-11-19
  • 打赏
  • 举报
回复
引用 2 楼 sunnyloves 的回复:
listctrl的customdraw都会了 不会填充数据? setitemtext
准确的说customdraw不会,找的别人的代码看,但是并不是很懂,囧~如果是直接插入数据我会,怎么通过点击右边table2对话框中的list的iSubItem插入数据我就搞不清楚了,能不能说的具体点。要在iSubItem的点击时间里面回调插入数据么。对MFC的基础还是上学时候学的一点。。。。从头开始学又不现实
1,01.zip
Dialogs in DLL
在DLL中实现对话框(5KB)
2,02.zip
Export dialogs in MFC Extension DLLs
MFC扩充DLL中输出对话框(12KB)
3,03.zip
Remapping resource script ID's
重影象资源的标识符(4KB)
4,04.zip
Determine DLL version number
检测DLL的版本号(7KB)
5,05.zip
Getting the complete information about DLL/Exe module
得到DLL/EXE模块的编译信息(5KB)
6,06.zip
Using one extension DLL in another
在DLL中使用扩充的DLL(4KB)
7,07.zip
Handling VB strings (as part of an array of UDT)
VB的串句柄(5KB)
8,08.zip
Class for Dynamic DLL Loading
动态装入DLL的一个类(6KB)
9,pop3.zip
CPop3Connection - an MFC Class to encapsulate the POP3 protocol(20KB)
10,ipenum.zip
IPEnum - an MFC class and console app to allow IP address enumeration
(11KB)
11,smtp.zip
CSMTPConnection - an MFC Class to encapsulate the SMTP protocol(69KB)
12,ping.zip
CPing - an MFC class to encapsulate the PING protocol(13KB)
13,mailslot.zip
CServerMailslot & CClientMailslot - 2 MFC classes to support Win32 mailslots(29KB)
14,rasman.zip
A shareware application to monitor your Dial-Up Networking Connections.
(49KB)
15,rasmonitor.zip
The MFC class to monitor connections as used by RasMan.(17KB)
16,npipe.zip
A Freeware MFC class to encapsulate Named Pipes(24KB)
17,apipe.zip
A Freeware MFC class to encapsulate(8KB)
18,csntp.zip
A Freeware MFC class to encapsulate the SNTP protocol(18KB)
19,tracer.zip
an MFC class to encapsulate trace route functionality(13KB)
20,popwatch.zip
A freeware application to monitor your POP3 mailbox(72KB)
21,w3mfc.zip
A collection of freeware MFC classes to implement a Web Server(34KB)
22,mfccddb.zip
A freeware MFC class to support access to CDDB servers(39KB)
23,cmapi.zip
an MFC class to encapsulate sending mail using Simple MAPI(21KB)
24,finger.zip
An MFC class to encapsulate the "Finger" protocol(26KB)
25,eqd.zip
A Freeware MFC class to support retrieval of recent Earthquake data from the USGS(10KB)
26,httpdownloaddlg.zip
The class implements an MFC CDialog derived class which performs HTTP downloads similar to the Internet Explorer(43KB)
27,ccmc.zip
an MFC class to encapsulate sending mail using CMC(19KB)
28,ftptransferdlg.zip
CFTPTransferDlg provides an MFC dialog which performs FTP uploads and downloads similar to the Internet Explorer(43KB)
29,memmap.zip
A freeware MFC class to encapsulate Memory Mapped Files(18KB)
30,pstat.zip
A Freeware generalized framework for executing a lengthy operation in a thread. (20KB)
31,cfile64.zip
A freeware MFC class to encapsulate the Win32 64 bit file system API(16KB)
32,serv.zip
A class framework for developing NT services in MFC(53KB)
33,shelllink.zip
2 Freeware MFC classes to encapsulate shell shortcuts(12KB)
34,dyndata.zip
A collection of freeware MFC classes to encapsulate the Windows 95/98 performance counters.(10KB)
35,cpdh.zip
A collection of freeware MFC classes to encapsulate the NT Performance Counters.(25KB)
36,serialport.zip
A freeware MFC class for Win32 serial ports(19KB)
37,cpl_pp.zip
A freeware MFC class framework for developing Control Panel Applets(14KB)
38,parallelport.zip
An MFC class to control parallel ports on 95, 98, ME, NT and 2000(16KB)
39,versioninfo.zip
An MFC class to encapsulate the Windows Version API(14KB)
40,waitabletimer.zip
A freeware MFC class for Win32 waitable timers(13KB)
41,vfwwnd.zip
CAVICapWnd - AN MFC wrapper class for Video For WIndows(47KB)
42,fraction.zip
a double / fraction / string conversion class(5KB)
43,cmd5.zip
A C++ Message Digest 5 Class(13KB)
44,cryptit.zip
Keep sensitive data safe via encryption (130KB)
45,gener1.zip
Template functions for serializing arbitrary linked nodes.(25KB)
46,gener2.zip
Template functions for serializing arbitrary linked nodes. (3KB)
47,zip1.zip
The library to create, modify and extract zip archives(92KB)
48,zip2.zip
The library to create, modify and extract zip archives (31KB)
49,pointers.zip
A Beginner's Guide to Pointers
An article showing the use of pointers in C and C++ (4KB)
50,linkedlist_demo.zip
An article showing the basics of the linked list, and how the CList class operates (7KB)
51,ocarray_demo.zip
A simple derived template class that can boost the efficiency of your programs. (18KB)
52,clist_iter_src.zip
A simple iteration class for MFC's CList linked list (2KB)
53,dynopenhashtable_src.zip
Making assorted hash table of strings and/or other data types. (4KB)
54,extcol_demo.zip
Extended Collection classes to provide copy, compare and find operations with 2 dimensional arrays and maps (24KB)
55,extcol_src.zip
Extended Collection classes to provide copy, compare and find operations with 2 dimensional arrays and maps (11KB)
56,lookaside_src.zip
A simple way to keep items such as COM instances 'warm' and available for reuse (3KB)
57,isarray_src.zip
A simple templated array class. (2KB)
58,collectionnotes.zip
An article describing MFC Collection Classes (9KB)
59,qarray_demo.zip
A CArray derived class that provides quick and convenient sorting (13kb)
60,qarray_src.zip
A CArray derived class that provides quick and convenient sorting (2KB)
61,smartlist.zip
Wrapper classes for MFC list classes the extend their functionality (4KB)
62,ufstmaps.zip
A fully featured map class that uses balanced trees to store and retrieve data quickly by key (558KB)
63,qsort_demo.zip
An introduction to a useful function (15KB)
64,seexception_demo.zip
This article describes how to handle SE and C++ exception together(16KB)
65,seexception_src.zip
This article describes how to handle SE and C++ exception together(2KB)
66,circular_buffer_demo.zip
A circular, thread-safe read/write character buffer (12KB)
67,avltree_demo.zip
Describes an implementation of AVL Trees. (54KB)
68,metaclass_demo.zip
A class that can be modified at run-time (6KB)
69,metaclass_src.zip
A class that can be modified at run-time (4KB)
70,arrayex_src.zip
This article presents a callback based, QuickSort enabled CArray template class (2KB)
71,arrayex_demo.zip
This article presents a callback based, QuickSort enabled CArray template class (28KB)
72,chookwnd_src.zip
A freeware MFC class to support MFC subclassing (19KB)
73,cinifile_demo.zip
A class that makes it easy to implement an INI settings file in your applications(14KB)
74,cinifile_src.zip
A class that makes it easy to implement an INI settings file in your applications(4KB)
75,cint96_src.zip
A Freeware MFC class which provides 96 bit integers. (10KB)
76,csingleinst_src.zip
An MFC class to implement single instance apps. (9KB)
77,enitl.zip
A cross platform scripting engine for server applications providing HTML, XML, SGML or other text based formats (38KB)
78,floatutils_src.zip
A set of floating point utilities (3KB)
79,switch_languages.zip
Multilingual Application - Change Application Language(33KB)
80,duration_demo.zip
A simple class that provides high precision timing. (3KB)
81,duration_src.zip
A simple class that provides high precision timing. (1KB)
82,save_temp_var.zip
A safe, and convenient way to store variables temporarily (1KB)
83,tcxunitconverter_demo.zip
TCX Unit Conversion Library(18KB)
84,tcxunitconverter_src.zip
TCX Unit Conversion Library(7KB)
85,templates_demo.zip
Templates are a great way of reusing code, unfortunately MFC
makes it hard to write MFC friendly template classes... (124KB)
86,templates_src.zip
Templates are a great way of reusing code, unfortunately MFC
makes it hard to write MFC friendly template classes... (2KB)
87,functionparser.zip
A simple yet powerful function parser that parses and evaluates standard mathematical functions (82KB)
88,stlxmlparser.zip
This is a small non-validating XML parser based purely on STL (10KB)
89,xmimabparser_src.zip
A class to read and write non validated XML files (178KB)
90,rexsearch_src.zip
Compiles a regular expression into a fast automaton (11KB)
91,rexsearch_demo.zip
Compiles a regular expression into a fast automaton (50KB)
92,sascript.zip
A simple stack-based language that you can easily add to your projects (52KB)
93,strtok_src.zip
A customizable string tokenizer (23KB)
94,ismart_demo.zip
A template-based smart pointer implementation(19KB)
95,ismart_src.zip
A template-based smart pointer implementation(2KB)
96,smartptr.zip
A smart pointer wrapper class(4KB)
97,blockallocator.zip
A block allocator for use with STL containers that greatly improves speed in programs doing massive data insertions and extractions(6KB)
98,stltools.zip
Defines some TCHAR compatible STL elements and gives you an std::ostream to send output to the debugger windows. (4KB)
99,tokeniterator.zip
Token Iterator provides an easy to use, familiar, and customizable way in which to go through the tokens contained in a string (7KB)
100,stdsort.zip
An introduction to sorting using STL(4KB)
101,clniex_src.zip
Class CIniEx carries out extended set of ini-files functions in memory (106KB)
102,dtconverter.zip
A simple app that converts to and between time_t, DATE, and regular date string expressions(17KB)
103,dumphandle_demo.zip
A method of getting more details about application crashes.(24KB)
104,libdump.zip
A tool to display the contents of a library file (383KB)
105,vbactivexwithvc.zip
A simple way to call a VB ActiveX DLL from a VC/MFC Client(24KB)
106,staticlink.zip
VC++ Standard Edition only has support for dynamically linked exes. This article shows you how to by-pass this restriction.(14KB)
107,displayloadedmodules.zip
A Debugging Tool for Application using Multiple DLLs (246KB)
108,dynamicdiiloading_demo.zip
How to dynamically load a DLL (11KB)
109,hookimport_src.zip
A class to hook any imported function call made by your app.(7KB)
110,plug-in_demo.zip
Extending the functionality of your programs using explicit linking (60KB)
111,data_seg_share_demo.zip
Using #pragma statements to share variables in a DLL(37KB)
112,niftyloadlib_src.zip
The home of NiftyLoadLibrary - and some notes on rebasing dlls(3KB)
113,rcremap.zip
Remapping resource script ID's (21KB)
114,get_info.zip
Getting the complete information about DLL/Exe module (29KB)
115,vbstring.zip
Handling VB strings (as part of an array of UDT) (5KB)
Radmin自动登陆器 v3.0 - By: ybmj@vip.163.com 20180106 By: ybmj@vip.163.com , http://dep.yibinu.cn/wgzxnew/ 1、程序功能和使用环境介绍 2、程序操作方法介绍 3、登录信息文件RadminM.txt介绍 4、登录信息文件RadminM.txt的转换和编制 5、v3.0版新增解锁 远程桌面功能 6、相关配置和多种语言支持介绍 7、免责申明 1、程序功能和使用环境介绍 (1)、程序功能 为了安全高效地使用Radmin Viewer来自动登录和管理多台服务器,故编制RadminM (Radmin Connection Manager,Radmin自动登录器)。 v3.0版的可执行文件是RadminM.exe,一台电脑只能运行一个实例,再次运行只是将已运行的实例调到前台。v3.0版之前的老版本的可执行文件是RadminM2.exe。 新版的功能已经比较完善,基本上可以代替Radmin Viewer 3.5进行管理(除Intel AMT功能外),另外还增加了一些实用功能,支持Windows Xp、Vista、Win7、Win8、2003、2000、9x及相应Windows Server版等操作系统。 (2)、程序使用环境要求 使用前请将Radmin Viewer 3.5的Radmin.exe文件直接拷贝到该目录中,其它Radmin Viewer 3.x版本也可以,中文版、英文版均可; 请设置防火墙允许Radmin.exe和RadminM.exe(仅扫描功能用)访问网络; 若要用到聊天、语音聊天、传送信息等连接模式,必须将相应的8个dll文件也拷贝到该目录中:ChatLPCx.dll、raudiox.dll、rchatx.dll、unicows.dll、vcintcx.dll、vcintsx.dll、voicex.dll、WinLpcDl.dll。 (3)、Radmin Server使用权限设置(新版本可选) 注意:在v1.5及以前的老版本中,Radmin Server被控端必须将“使用权限...”(Permissions)设置为“Windows NT 安全性”(Security),如果设置为“Radmin安全性”(Security)将不能实现自动登录功能。在新版本中,这两种安全性模式下,都可以实现自动登录功能。 (4)、开发环境 v1.5及以前的老版本用AutoIt语言开发,AutoIt是解释性语言,功能和稳定性有限,并且一些防病毒软件会报警。 为了在功能和稳定性方面进一步提高和改进,v2.0版使用VC++ Unicode(MFC)编程,程序在编译时已经集成了VC运行库,可独立运行。 由于MFC越益臃肿笨重,为了提高稳定性和效率,v3.0版使用WTL VC++ Unicode编程,程序短小精悍、可独立运行。WTL是Windows Template Library,可参见 http://wtl.sourceforge.net/ 。 2、程序操作方法介绍 (1)、程序中的鼠标操作 * 双击某条记录以默认模式自动连接(等待6秒);若该记录包含私有代理将自动进行代理连接(代理登录和目标登录各等待6秒); * 左上角的选择框或主菜单都可以选择默认连接模式; * 先右击某条记录(或F9)填为强制代理(支持域名),并选中强制代理选项,便可对另一条记录强制进行代理连接(将忽略私有代理); * 支持鼠标滚轮; * 主菜单和右键菜单均可完成本程序的常规操作;记录窗格的右键菜单或单击工具栏的相应按钮可直接选择进行指定模式的连接(将忽略默认连接模式); * 主菜单中的“配置”菜单可以选择程序的各项相关配置; * 工具栏各个按钮的功能均有提示; * 单击工具栏上的“显示隐藏树状目录”按钮可以显示隐藏目录树窗格,目录树窗格的右键菜单可完成目录树的一些常规操作; * 单击工具栏上的“选择切换图标查看模式”按钮可以切换或选择记录窗格的图标查看模式; * 记录窗格和目录树窗格都支持鼠标拖放功能,强烈建议用户使用该功能前备份RadminM.txt,以免损坏或丢失数据;直接鼠标拖放为移动,Ctrl+鼠标拖放为复制。拖放时状态栏有提示信息; * 程序启动时,记录自动按记录名称升序排列;在记录窗格单击列表框某列表头,可以按该列进行记录排序,再次单击可以反向排序。 (2)、程序中的常用快捷键 * Enter :以默认模式连接记录; * Insert :新建记录; * Ctrl+e :编辑记录; * Ctrl+c :复制记录; * Ctrl+x :剪切记录; * Ctrl+v :粘贴记录; * Delete :删除记录或目录(在记录窗格),或删除树状目录(在目录树窗格); * F1 :显示程序信息; * F2 :更名树状目录; * F3 :单条扫描(等待5秒,用于扫描网速较慢的记录); * F5 :全部扫描(多线程同时扫描,每条记录等待5秒); 扫描过程中左下角状态栏会有提示,扫描完成后提示消失,扫描过程中建议不要新建、修改、删除、粘贴、剪切、排序记录,不然可能出现扫描结果错乱,其它功能可正常使用; * F7 :新建树状目录; * F9 :将选中记录填为强制代理(主菜单上“强制代理信息”项显示将从[无]变为[有],打开该菜单可查看信息); * Ctrl+- :隐藏窗口到系统托盘; * Ctrl+= :显示窗口; * 双击系统托盘图标可隐藏或显示窗口; * 窗口大小可调整,支持最大化和还原; * 支持Home、End、PageUp、PageDown等操作。 3、登录信息文件RadminM.txt介绍 (1)、RadminM.txt内容说明 登录信息存放在RadminM.txt文件中,若没有会自动创建,密码用RC4加密,请用户注意保管。RadminM.txt是遵循CSV格式的ANSI文本文件,所有字段内容都不能包含英文惊叹号“!”、英文逗号“,”、竖线分隔符“|”。 第一行为登录记录各字段的名称。每行存放一条记录,每条记录包含用17个英文逗号分隔的18个字段。 RecordName 记录名称是关键字段,支持中文记录名称,不能为空、不要有重名; IP、Port、User、Password 分别是IP地址、端口、用户名、密码。IP地址不能为空,若端口为空程序将使用缺省端口4899; Domain 是域名,该字段有内容在登录时便会自动填写; ColorDepth 是在“完全控制”或“仅限查看”连接模式,指定传输图像的色彩深度。色彩深度大小与传输速度成反比; Updates 是在“完全控制”或“仅限查看”连接模式,指定屏幕每秒最大刷新率,为1到100之间的数值; UnlockDesktop 是在“完全控制”连接模式连接成功后,若远程桌面已登录锁定、且焦点位于密码输入框,可用连接Radmin的密码解锁远程桌面、或 (当服务器端为Radmin Server v3.5时) 先锁定再解锁远程桌面。具体配置参见后面的介绍; Fullscreen 是在“完全控制”或“仅限查看”连接模式,以全屏幕方式、或全屏伸展方式显示远程PC窗口; Nofullkbcontrol 是在“完全控制”连接模式,阻止系统热键(如ALT-TAB)传递到远程PC; Monitor 是在“完全控制”或“仅限查看”连接模式,若远程PC有多个监视器,可指定显示其中某个监视器上的图像。比如:/monitor"\\.\DISPLAY1"。注意:只能指定在已连接窗口的菜单中显示出来的监视器; Sendrequest 是请求Radmin服务器发送Radmin服务器激活文件。将忽略其它选项。详情请参见Radmin帮助文档; Pbpath 是以指定的电话薄文件启动Radmin Viewer。比如:/pbpath"C:\my.rpb"。将忽略其它选项; Proxy 是记录的私有代理信息。私有代理格式:记录名称+目录路径。需要先将某条已有记录设置为强制代理,再选作私有代理。 AsProxyBy 是被用作私有代理字段。是指该记录被其它哪些记录用作私有代理,由程序自动处理(只读); Memory 是备注字段; TreePath 是目录路径字段,由若干英文惊叹号“!”(目录分隔符)分隔的字符串构成,支持中文目录名,如根目录下DirA子目录下的DirB子目录:!DirA!DirB 。 (2)、私有代理字段Proxy 本程序除了支持强制代理外,每条记录都可以指定私有代理。Proxy字段便是存放用作私有代理的记录信息,只能有一条;注意:只能从已有记录中指定私有代理;Proxy字段的格式:记录名称+目录路径;建议先将某条已有记录设置为强制代理,再到新建记录或编辑记录对话框中填写为私有代理;当然,若熟悉后也可以手工填写。 (3)、被用作私有代理字段AsProxyBy AsProxyBy是被用作私有代理字段,用于存放该记录被其它哪些记录用作私有代理的信息,多条记录间用竖线分隔符“|”分隔,由程序自动处理(只读);该字段主要用于当该记录名称或目录路径更改时,程序会自动更新将该记录用作私有代理的其它记录的私有代理信息;建议用户不要随意修改RadminM.txt文件中该字段的内容,不然可能会出现程序功能错乱。 (4)、格式符合要求的RadminM.txt文件示范 RecordName,IP,Port,User,Password,Domain,ColorDepth,Updates,UnlockDesktop,Fullscreen,Nofullkbcontrol,Monitor,Sendrequest,Pbpath,Proxy,AsProxyBy,Memory,TreePath sample01,192.168.0.6,4899,user01,,,,,,,,,,,,,,! sample02,192.168.0.8,4899,user02,,,,,,,,,,,,,,!DirA!DirB sample03,192.168.0.9,4899,user03,,,,,,,,,,,,,,!DirC!DirD 4、登录信息文件RadminM.txt的转换和编制 (1)、V2.0转V3.0记录文件 单击主菜单、帮助中的“V2.0转V3.0记录文件”菜单项,可以将RadminM V2.0的记录文件转换为RadminM V3.0的记录文件。执行转换之前,请先备份好RadminM.txt。新生成的文件可能覆盖RadminM.txt。 (2)、v1.5的RadminM.txt文件需先转换为v2.0的格式,再导入新版本v3.0中使用 v1.5的RadminM.txt简单修改一下就可以转换为v2.0的格式。修改的具体方法是: (A)用UltraEdit编辑器打开v1.5的RadminM.txt(用其它编辑器也可参照完成类似修改); (B)Ctrl+R调出替换对话框,在上面需要替换栏输入:^p ,在下面替换为栏输入:,!^p ,(这里,^p代表回车换行),设置好后再单击“全部替换”按钮即可,需要时可单击“帮助”按钮查看帮助信息; (C)将第一行末尾的 “!” 手工改为 “TreePath”; (D)处理完后保存为RadminM.txt。 用其它编辑器也可参照完成类似修改。转换完成后,再用上面介绍的“V2.0转V3.0记录文件”菜单项导入v3.0中使用。 (3)、用记事本、UltraEdit、Excel等编制RadminM.txt RadminM.txt可以用记事本、UltraEdit、Excel等编制。也可将已有RadminM.txt导入Excel处理,具体方法是: (A)启动Excel,选择菜单“数据->导入外部数据->导入数据”,选择RadminM.txt文件; (B)文本导入向导第1步,直接单击“下一步”; (C)第2步必须选中“逗号”分隔符,再单击“下一步”; (D)第3步必须将所有18列都设置为文本,依次选中下面数据预览里的各列,再选择右上面列数据格式里的“文本”。全部设置好后,再单击“完成”、“确定”即可成功导入; (E)处理完后须保存为CSV格式文件,再更名为RadminM.txt便可使用。 5、v3.0版新增解锁远程桌面功能 (1)、解锁远程桌面功能简介 当以“完全控制”连接远程PC成功后,若远程桌面已登录锁定、且焦点位于密码输入框,可用连接Radmin的密码解锁远程桌面、或 (当服务器端为Radmin Server v3.5时) 先锁定再解锁远程桌面。 要正常使用这一功能,必须满足以下条件:远程PC已经登录、锁定远程桌面的用户密码与连接Radmin的密码一致、远程桌面的焦点位于密码输入框。 (2)、可能存在的安全隐患 注意:当服务器端为Radmin Server v3.5之前的老版本、解锁前远程桌面并未锁定而焦点又正好位于文本编辑框中,启用该功能可能会出现明文密码。 (3)、相关配置 用户可以为每条记录单独配置解锁远程桌面功能,相关配置信息保存在每条记录的UnlockDesktop字段中。慎重起见,默认并未启用该功能。用户可以根据实际情况,单独为每条记录选择不使用(该字段为空白)、或者“UnlockDesktop”、或者“LockThenUnlock”。 该字段为空白,也就是不使用该功能,便不会出现明文密码。 “UnlockDesktop”是指直接解锁远程桌面,适用于Radmin Server各版本,但可能出现明文密码。 “LockThenUnlock”是指若解锁前远程桌面处于未锁定状态、可以先锁定远程桌面再解锁,这样可以避免出现明文密码。但这要求必须使用Radmin Viewer 3.5的Radmin.exe文件,并且只对连接Radmin Server v3.5版本才有效。Radmin Viewer 3.5之前的老版本无法发送锁屏组合键Win+L,Radmin Server v3.5之前的老版本无法接收锁屏组合键Win+L,仍然存在出现明文密码的可能性。 6、相关配置和多种语言支持介绍 (1)、配置文件RadminM.ini 主菜单中的“配置”菜单可以选择程序的各项相关配置。程序的各项配置都保存在RadminM.ini配置文件中,若不存在程序会自动创建。若由于配置混乱、异常关闭等原因导致程序运行后无法显示主窗口,可以先备份然后删除RadminM.ini文件即可正常运行。 (2)、多种语言支持 本程序使用INI文件实现多种语言支持,每种语言信息用一个扩展名为lng的INI格式文件存放。语言文件可以使用Unicode或ANSI格式,一般建议使用Unicode格式。这种方式具有更多扩展性,用户可以非常简单方便地添加自己的语言文件。 本程序的默认语言是简体中文,另外提供英文语言文件English.lng。本程序启动时若没有外部语言文件,将使用内置的默认语言(简体中文)。若本程序目录下有*.lng的外部语言,程序启动后便会自动在“关于->语言”菜单下列出外部语言(以语言文件的文件名命名)。用户选择某种外部语言便可以动态切换到新语言界面,无需重新启动程序,用户的语言选择将自动保存到RadminM.ini文件中,关闭程序后下次启动也会自动使用用户选择的新语言界面。 用户可以参照English.lng语言文件的格式和内容,方便地编制修改自己的语言文件,比如French.lng。用户只需将自己编制好的语言文件拷贝到本程序目录下,重新启动程序后便会自动在“关于->语言”菜单下列出用户添加的新语言French。选择该语言便可以动态切换到新语言界面,无需重新启动程序,关闭程序后下次启动也会自动使用用户选择的新语言界面。 注意:语言文件中间不能有空行,空行就意味文件结束,空行之后就无法查找翻译。若需要空行标识分隔,可以在空行前加英文分号 ;,也即注释行。 语言文件中的字符串,若需要前导和后导空格,可以将字符串用英文双引号或英文单引号包含即可。不需要空格的就无需加引号。 本程序的多种语言支持功能参照网友Yonsm提供的方式实现,有兴趣的用户可以访问网站 http://yonsm.net/ini-language-engine/。 (3)、启用Radmin帮助 在本程序中,若要启用菜单项“帮助->Radmin帮助”,需要将Radmin的chm帮助拷贝为本程序目录中的Radmin35.chm。 7、免责申明 用户可自行斟酌选用该程序,若转载请注明出处。对一切后果,作者不承担任何责任! ======================================================================================== RadminM v3.0 - By: ybmj@vip.163.com 20150615 By: ybmj@vip.163.com , http://dep.yibinu.cn/wgzxnew/ 1. The features and the running environmental of RadminM 2. The operation of RadminM 3. RadminM.txt of login information file 4. Translate and Preparation RadminM.txt 5. UnlockDesktop feature of v3.0 newly additional 6. Related settings and Multilanguage support 7. Disclaimer 1. The features and the running environmental of RadminM (1). The features of RadminM In order to safely and efficiently use Radmin Viewer to automatically login and manage multiple servers, so the program RadminM(Radmin Connection Manager) was intended to develop. The executable file is RadminM.exe of RadminM v3.0. Only one instance can run in a computer, and it only bring the running instance to the foreground if RadminM run again. And the executable file of RadminM before v3.0 is RadminM2.exe. The new version have been more improvement of the function, and user basically can manage instead of Radmin Viewer 3.5 (except Intel AMT technology). And there ars some useful features else. It support for Windows Xp, Vista, Win7, Win8, 2003, 2000, 9x and the corresponding version of Windows Server operating systems. (2). The environmental requirements of RadminM running Before use, please copy the Radmin.exe of Radmin Viewer 3.5 to this directory, Other Radmin Viewer 3.x versions of Chinese or English are also available. Please set the firewall to allow Radmin.exe and RadminM.exe (only scan function used) to access the network. To use Text Chat, Voice Chat, Send Message such as connection mode, user must copy also corresponding 8 dll files to this directory: ChatLPCx.dll, raudiox.dll, rchatx.dll, unicows.dll, vcintcx.dll, vcintsx.dll, voicex.dll, WinLpcDl.dll. (3). To set Radmin Server's Permissions(Option in the new version) Note: In v1.5 and previous versions, Radmin Server's "Permissions ..." must be set to "Windows NT security", RadminM can not be automatically login feature if it was set to "Radmin security". The new version can be automatically login in these two security modes. (4). The development environments of RadminM RadminM v1.5 and the previous version is developed by AutoIt language. As AutoIt is an interpreted language, it is limited in the functionality and stability, and some anti-virus software will alarm. In order to further improve the functionality and stability, the new version using VC++ UNICODE(MFC) programming environment. The program had already integrated VC runtime library when it was compiled, it can run independently. Because the MFC is more and more bloated and heavy, in order to further improve the stability and efficiency, v3.0 using WTL VC++ UNICODE programming environment. The program dapper, and can run independently. WTL is the abbreviation of Windows Template Library, user may refer to http://wtl.sourceforge.net/ . 2. The operation of RadminM (1). The mouse operation of RadminM * Double-click a record, RadminM will automatically connect in the default mode(wait 6 second), or RadminM will automatically Proxy connect if the record has Proxy(each of Proxy login and Target login wait respectively 6 second). * You may select the default connection mode at the ComboBox of the top left corner or the main menu. * Right-click a record (or F9) to fill as Forced Proxy (supports domain name) at first, and check the CheckBox of Forced Proxy or the menu item, you can connect another record via Forced Proxy (the Proxy will be ignored). * Mouse wheel support. * You can complete the normal operation with the main menu and right-click menu. By the right-click menu of records pane (Right Pane) or click the corresponding button on the toolbar, you can directly connect in specify mode (the default connection mode will be ignored). * There is the function prompted for each button on the toolbar. * Clicking "Show or Hide Tree" button on the toolbar will show or hide the directory tree pane. You may complete some normal trees operations by right-click menu in trees pane (Left Pane). * Records pane and trees pane support the mouse drag-and-drop function. To avoid damage or loss of data, we strongly recommended to backup RadminM.txt before useing this function. Directly drag-and-drop to move, Ctrl + drag-and-drop to copy. There is the prompted information at the status bar as drag-and-drop. * Records automatically sort in ascending order by record name when the program starts. Clicking the table head of listctrl in records pane will sort records according to this column, and clicking again will sort reverse. (2). The common Shortcuts of RadminM: * Enter : automatically connection in the default mode. * Insert : new record. * Ctrl+e : edit record. * Ctrl+c : copy record. * Ctrl+x : cut record. * Ctrl+v : paste record. * Delete : delete record and subdir (in records pane). delete subdir (in trees pane). * F1 : help information. * F2 : rename subdir (in trees pane) or edit record(in records pane). * F3 : scan one record (wait 5 seconds, used for slowly network). * F5 : scan all records by multithreading (wait 5 second for each record). There is prompt at the status bar of bottom left corner when the scan is processing, and prompt will disappear after the scan has finished. We are not recommended to create, modify, delete, paste, cut, sort records when the scan is processing, otherwise the scan results may appear confusion. But other functions may be used normally. * F7 : new subdir. * F9 : fill the selected record as Forced Proxy. (The "Forced-Proxy" item of the main menu will show from [No] to [Yes]. To click the menu, you can view the information.) * Ctrl+- : hide RadminM window to the system tray. * Ctrl+= : show RadminM window. * Double-click the system tray icon to hide or show RadminM window. * RadminM window is resizable, maximize and restore support. * RadminM supports Home, End, PageUp, PageDown, etc. 3. RadminM.txt of login information file (1). RadminM.txt description Login information is stored in RadminM.txt file. RadminM will automatically create if RadminM.txt is not exist. PassWord is encrypted by RC4, user keep attention to store. RadminM.txt is text file to follow CSV (ANSI) formatted. The contents of all field can not contain English exclamation mark "!", English comma ",", vertical separator "|". The first line is the the names of login record fields. There is only a record each line, what contains 18 fields delimited by 17 English comma. RecordName (Record Name) is the key field, support Chinese record name, but can not be empty, do not have the same record name. IP, Port, User, Password are the IP address, port, username, password. IP address can not be empty.The program will use the default port 4899 if the Port is empty. Domain is the domain name, it will be used to automatically fill in the login if Domain has content. ColorDepth is used with the "Full Control" connection mode (no mode switches) or "View Only" connection mode (the "/noinput" switch). Defines the color depth of images that Radmin Server will transfer to Radmin Viewer. ColorDepth is in inverse proportion to transmission rate. Updates is used with "Full Control" connection mode or "View Only" connection mode. Will display the remote computer window with no more than the specified number of updates per second. That is the maximum updates per second. Please input number between 1 to 100. UnlockDesktop is used with "Full Control" connection mode . After "Full Control" connection has successed, it can unlock the remote desktop with the connection password if the remote desktop has locked and the focus is in the password input box, or lock first the remote desktop then unlock when remote PC run Radmin Server v3.5. Fullscreen is used with the "Full Control" connection mode or "View Only" connection mode. Will display the remote computer window in full screen, or expanding the image if the screens resolution of the remote and local computer differs. Nofullkbcontrol is used with "Full Control" mode. The key prevents the transfer of system hotkeys (such as ALT-TAB) to the remote computer. Monitor is used with "Full Control" or "View Only" connection mode. If there are several monitors on the remote computer, this key makes it possible for you to display an image on one of them. Example: /monitor"\\.\DISPLAY1" . Note, you can only specify a monitor from which show on the connected window's menu. Sendrequest is to send specified Radmin Server activation request file to the Famatech Activation Server and saves received license file. Will ignore other options. Please refer to Radmin help for details. Pbpath is to start Radmin Viewer with specified phonebook file. Example: /pbpath"C:\my.rpb". Will ignore other options. Proxy is used to store private-proxy information of the record. Proxy Format: RecordName+TreePath. User need to select a record and set to forced-proxy at first, then fill as Proxy in the NewRecord or EditRecord dialog. AsProxyBy is being used as Proxy field. It is automatically processed by the program (Read Only). Memory is memo field. TreePath is the directory path field. TreePath is a string that consist of multiple strings division by English exclamation mark '!' (directory separator). It support Chinese directory name. Example: !DirA!DirB, the DirB under the DirA under the root. (2). The Proxy field This program not noly supports forced-proxy, each record but also can be specified private-proxy (abbreviated as Proxy). The Proxy field is used to store private-proxy information of the record, it can be only one. Note, user can only specify Proxy from existing records. Proxy Format: RecordName+TreePath. We recommend to select a record and set to forced-proxy at first, then fill as Proxy in the NewRecord or EditRecord dialog. Of course, you can also fill it by hand after familiar. (3). The AsProxyBy field The AsProxyBy field is being used as Proxy field, it is used to store the information which other records use this record as Proxy. Multiple records are delimited with vertical separator "|". It is automatically processed by the program (Read Only). This field is mainly used to automatically update the Proxy information of other records which use this record as Proxy when this record's RecordName or TreePath is changed. We recommend that user do not arbitrarily modify the contents of this field in RadminM.txt, otherwise the program may appear functional disorder. (4). Example: a fitting format RadminM.txt RecordName,IP,Port,User,Password,Domain,ColorDepth,Updates,UnlockDesktop,Fullscreen,Nofullkbcontrol,Monitor,Sendrequest,Pbpath,Proxy,AsProxyBy,Memory,TreePath sample01,192.168.0.6,4899,user01,,,,,,,,,,,,,,! sample02,192.168.0.8,4899,user02,,,,,,,,,,,,,,!DirA!DirB sample03,192.168.0.9,4899,user03,,,,,,,,,,,,,,!DirC!DirD 4. Translate and Preparation RadminM.txt (1). V2.0 to V3.0 RadminM.txt User can translate RadminM V2.0 record file to V3.0 by "V2.0 to V3.0 RadminM.txt" menu of Help in the main menu. Please backup RadminM.txt before performing the transfer. New file may overwrite RadminM.txt. (2). The v1.5 RadminM.txt need to translate to v2.0 fromat, then it can be translated to v3.0 The v1.5 RadminM.txt can be used in the new version after simply modification. The modification procedure is: (A) To open the v1.5 RadminM.txt by UltraEdit editor. (B) Ctrl+R to bring up the Replace dialog box, input in the above Find What pane: ^p, input in the below Replace With pane: ,!^p . (^p is CRLF here.). After properly setting, then click "Replace All" button. You may click the "Help" button to get the help information if you need. (C) Replace "!" with "TreePath" by hand at end of the first line. (D) Save the file to RadminM.txt after processed. You can also refer to complete a similar modification with other editors. After this, user can Translate it to v3.0 by fore-mentioned "V2.0 to V3.0 RadminM.txt" menu. Then it can be used in the new version v3.0. (3). To prepare RadminM.txt by Notepad, UltraEdit, Excel, etc RadminM.txt can be prepared using Notepad, UltraEdit, Excel, etc. You can also import RadminM.txt to Excel to process. The procedure is: (A) Start Excel, then click the menu "Data|Import External Data|Import Data", select RadminM.txt file. (B) Text Import Wizard - Step 1 of 3, direct click "Next". (C) Text Import Wizard - Step 2 of 3, you must check the "Comma" delimiter and then click "Next". (D) Text Import Wizard - Step 3 of 3, you must set all 18 columns to text format. You should select the data columns in turn below Data preview, and then check the "Text" above Column data format. After properly setting, to click "Finish" and "OK" to complete successfully import. (E) The file must save as CSV format after processed. The file can be used for RadminM after direct renamed to RadminM.txt. 5. UnlockDesktop feature of v3.0 newly additional (1). The UnlockDesktop feature After "Full Control" connection has successed, it can unlock the remote desktop with the connection password if the remote desktop has locked and the focus is in the password input box, or lock first the remote desktop then unlock when remote PC run Radmin Server v3.5. To successfully use this feature, there must be conditions: remote PC has already logined, and the password for locked remote desktop as same as the password for conneced Radmin Server, and the focus of remote desktop is in the password input box. (2). Possible security risk Note, there may be plaintext password, if the Radmin Server is old version before v3.5, and the remote desktop has not locked before to unlock, and the focus of remote desktop is exactly on a text edit box. (3). UnlockDesktop setting User can singly prepare UnlockDesktop setting for every record. UnlockDesktop setting is saved in UnlockDesktop filed of every record in RadminM.txt. To be deliberate, this feature is not enabled by default. User can choose and use this feature according to the actual situation. User can choose disabled this feature(Blank filed), or "UnlockDesktop", or "LockThenUnlock" for every record. When this filed is blank, that is disabled this feature, and there wiil not be plaintext password. When this filed is “UnlockDesktop”, that is directly unlock remote desktop. That suit each versions of Radmin Server. But there may be plaintext password. When this filed is “LockThenUnlock”, that is locked first the remote desktop then unlocked if the remote desktop has not locked before to unlock. This will avoid to appear plaintext password. But it must use the Radmin.exe of Radmin Viewer 3.5, and it only suit to connect Radmin Server v3.5. It can not send the Win+L LockScreen combination key to the remote computer by old version before Radmin Viewer 3.5. It can not receive the Win+L LockScreen combination key by old version before Radmin Server 3.5. The possibility to appear plaintext password still exists. 6. Related settings and Multilanguage support (1). Settings file RadminM.ini User may select the RadminM's related settings by Settings Menu of the main menu. All RadminM's related settings is stored in file RadminM.ini. RadminM will automatically create if RadminM.ini is not exist. If the RadminM main window can not display, it maybe the settings is confusion, or abnormal shutdown. User may backup the file RadminM.ini and then delete it. After this, user can run RadminM normal. (2). Multilanguage support This program achieve multilingual support by INI file. Each language information is stored in an INI format file with .lng extension. Language files is text file to follow Unicode or ANSI formatted. We generally recommended to use Unicode format. This mode has more scalability, the user can very simply and easily add your own language file. The default language of this program is simplified Chinese, there is other English language file English.lng as example. If there is no external language file, RadminM use the built-in default language(Chinese) when the program starts. If there are any *.lng external languages under this program directory, RadminM will automatically load and list in the "Settings|Language" menu after the program starts. In this menu, the name of external language is used the filename of the language file. By choosed a language in the menu, users can dynamically switch to the new language interface without having to restart the program. The user's language selection will be automatically saved to RadminM.ini file. After closeing the program, RadminM will automatically use the new language interface selected by the user when the next start. Users can refer to the format and content of English.lng, and easily prepared to modify their own language files, such French.lng. Users only need to copy the prepared language file to this program directory. After restarting the program, RadminM will automatically load and list the new language added by the user (such French) in the "Settings|Language" menu. By choosed the new language in the menu, users can dynamically switch to the new language interface without having to restart the program. After closeing the program, RadminM will automatically use the new language interface selected by the user when the next start. Note, Intermediate of language file can not have blank lines. Blank lines will mean the end of the file, the items will not be able to find the translation after the blank line. If you need a blank line identification or separator, you can add english semicolon in front of blank line. That is a comment line. If you need leading or rear guide space, the string of language file may be contained with double quotes or single quotes.Or it need not quotation marks. This program's multilingual support features achieve by reference of Yonsm's way, interested users may visit the website http://yonsm.net/ini-language-engine/. (3). Use Radmin Help If user want to use Help->Radmin Help of this program, user need to copy the chm help file to Radmin35.chm in the RadminM directory. 7. Disclaimer Users can choose and use this program at their discretion. Please indicate the source if reproduced. The author does not assume any responsibility for all the consequences!
// ipmonDlg.cpp : implementation file // #include "stdafx.h" #include "ipmon.h" #include "ipmonDlg.h" #include "mstcpip.h" #include "afxsock.h" #include "Iphlpapi.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About PROTN2T aOfProto [ PROTO_NUM + 1] = { { IPPROTO_IP , "IP" }, { IPPROTO_ICMP , "ICMP" }, { IPPROTO_IGMP , "IGMP" }, { IPPROTO_GGP , "GGP" }, { IPPROTO_TCP , "TCP" }, { IPPROTO_PUP , "PUP" }, { IPPROTO_UDP , "UDP" }, { IPPROTO_IDP , "IDP" }, { IPPROTO_ND , "NP" }, { IPPROTO_RAW , "RAW" }, { IPPROTO_MAX , "MAX" }, { NULL , "" } } ; char *get_proto_name( unsigned char proto ) { BOOL bFound = FALSE ; for( int i = 0 ; i < PROTO_NUM ; i++ ) { if( aOfProto[i].proto == proto ) { bFound = TRUE ; break ; } } if( bFound ) return aOfProto[i].pprototext ; return aOfProto[PROTO_NUM].pprototext ; } class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CIpmonDlg dialog CIpmonDlg::CIpmonDlg(CWnd* pParent /*=NULL*/) : CDialog(CIpmonDlg::IDD, pParent) { //{{AFX_DATA_INIT(CIpmonDlg) //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_threadID = 0 ; m_Multihomed = FALSE ; m_Local = TRUE ; } void CIpmonDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CIpmonDlg) DDX_Control(pDX, IDC_LIST, m_ctrList); DDX_Control(pDX, IDC_LOOKUP, m_start); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CIpmonDlg, CDialog) //{{AFX_MSG_MAP(CIpmonDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_LOOKUP, OnLookUp) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CIpmonDlg message handlers BOOL CIpmonDlg::OnInitDialog() { CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here CHAR szHostName[128] = {0}; HOSTENT* pHost = NULL; CHAR* pszIp = NULL; int iNum = 0; if(AfxSocketInit(NULL)==FALSE) { AfxMessageBox("Sorry, socket load error!"); return FALSE; } if(gethostname(szHostName, 128)==0) { pHost = gethostbyname(szHostName); if(pHost != NULL) { pszIp = inet_ntoa(*(in_addr*)pHost->h_addr_list[iNum]); m_ipsource = inet_addr(pszIp); } else AfxMessageBox("pHost = NULL!"); } else AfxMessageBox("can't find host name!"); // ListView initialize DWORD dwStyle=GetWindowLong(m_ctrList.GetSafeHwnd(),GWL_STYLE); dwStyle&=~LVS_TYPEMASK; dwStyle|=LVS_REPORT; SetWindowLong(m_ctrList.GetSafeHwnd(),GWL_STYLE,dwStyle); m_ctrList.InsertColumn(0,"数据",LVCFMT_LEFT,525); m_ctrList.InsertColumn(0,"大小",LVCFMT_LEFT,80); m_ctrList.InsertColumn(0,"端口",LVCFMT_LEFT,40); m_ctrList.InsertColumn(0,"目的地址",LVCFMT_LEFT,100); m_ctrList.InsertColumn(0,"端口",LVCFMT_LEFT,40); m_ctrList.InsertColumn(0,"源地址",LVCFMT_LEFT,100); m_ctrList.InsertColumn(0,"协议",LVCFMT_LEFT,50); ::SendMessage(m_ctrList.m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); // Here read all IPs of this host DWORD dwSize = 0 ; GetIpAddrTable( NULL , &dwSize, FALSE ) ; PMIB_IPADDRTABLE pIpAddrTable = (PMIB_IPADDRTABLE )new BYTE [ dwSize ] ; if( pIpAddrTable ) { if( GetIpAddrTable( (PMIB_IPADDRTABLE)pIpAddrTable, // // buffer for IP table &dwSize, // size of buffer FALSE // sort by IP address ) == NO_ERROR ) { if( pIpAddrTable->dwNumEntries > 2 ) // Second is MS TCP loopback IP ( 127.0.0.1 ) { m_Multihomed = TRUE ; char szIP[16]; for( int i = 0 ; i < (int)pIpAddrTable->dwNumEntries ; i++ ) { in_addr ina ; ina.S_un.S_addr = pIpAddrTable->table[i].dwAddr ; char *pIP = inet_ntoa( ina ) ; strcpy( szIP , pIP ) ; if( stricmp( szIP , "127.0.0.1" ) ) m_IPArr.Add(pIpAddrTable->table[i].dwAddr) ; } } } delete [] pIpAddrTable ; } return TRUE; // return TRUE unless you set the focus to a control } void CIpmonDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void CIpmonDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CIpmonDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } UINT threadFunc ( LPVOID p ) { CIpmonDlg *pDlg = static_cast(p) ; char buf [1000] , *bufwork ; MSG msg ; int iRet ; DWORD dwErr ; char *pSource , *pDest ; IPHEADER *pIpHeader ; in_addr ina ; char szSource [16] , szDest[16] , szErr [ 50 ]; char *pLastBuf = NULL ; int HdrLen, totallen; WORD sourport, destport; struct TCPPacketHead *pTCPHead; struct ICMPPacketHead *pICMPHead; struct UDPPacketHead *pUDPHead; BYTE *pdata = NULL; /*---------------------------------------------------------------------*/ PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE) ; // Force to make the queue pDlg->m_threadID = GetCurrentThreadId() ; while( TRUE ) { if( PeekMessage( &msg , 0 , WM_CLOSE,WM_CLOSE,PM_NOREMOVE ) ) { closesocket( pDlg->m_s ) ; pDlg->m_threadID = 0 ; pDlg->m_start.EnableWindow(TRUE) ; break ; } memset( buf , 0 , sizeof(buf) ) ; iRet = recv( pDlg->m_s , buf , sizeof( buf ) , 0 ) ; if( iRet == SOCKET_ERROR ) { dwErr = WSAGetLastError() ; sprintf( szErr , "Error recv() = %ld " , dwErr ) ; continue ; } else if( *buf ) { bufwork = buf ; pIpHeader = (IPHEADER *)bufwork ; WORD iLen = ntohs(pIpHeader->total_len) ; while( TRUE ) { if( iLen <= iRet ) { ina.S_un.S_addr = pIpHeader->sourceIP ; pSource = inet_ntoa( ina ) ; strcpy( szSource , pSource ) ; ina.S_un.S_addr = pIpHeader->destIP ; pDest = inet_ntoa( ina ) ; strcpy( szDest , pDest ) ; CString str, strProto, strSourPort, strDestPort, strData, strSize; strProto = get_proto_name( pIpHeader->proto ); /*-------------------zhuwei add(2002.11.9)-----------------------------*/ HdrLen = pIpHeader->header_len&0xf; HdrLen *= 4; totallen = ntohs(pIpHeader->total_len); totallen-=HdrLen; switch(pIpHeader->proto) { case IPPROTO_ICMP: { pICMPHead=(struct ICMPPacketHead *)(buf+HdrLen); //strL4.Format(" type:%d code:%d\n",pICMPHead->Type,pICMPHead->Code); strSourPort = "-"; strDestPort = "-"; pdata=((BYTE *)pICMPHead)+ICMP_HEAD_LEN; totallen -= ICMP_HEAD_LEN; break; } case IPPROTO_TCP: { pTCPHead=(struct TCPPacketHead *)(buf+HdrLen); sourport = ntohs(pTCPHead->SourPort); destport = ntohs(pTCPHead->DestPort); //strL4.Format(" sour port:%d,dest port:%d",sourport,destport); strSourPort.Format("%d",sourport); strDestPort.Format("%d",destport); HdrLen = (pTCPHead->HLen)>>4; //in fact only 4 bits HdrLen *= 4; pdata=((BYTE *)pTCPHead)+HdrLen; totallen -= HdrLen; break; } case IPPROTO_UDP: { pUDPHead=(struct UDPPacketHead *)(buf+HdrLen); sourport = ntohs(pUDPHead->SourPort); destport = ntohs(pUDPHead->DestPort); //strL4.Format(" sour port:%d,dest port:%d",sourport,destport); strSourPort.Format("%d",sourport); strDestPort.Format("%d",destport); pdata=((BYTE *)pUDPHead)+UDP_HEAD_LEN; totallen -= UDP_HEAD_LEN; break; } } if(pIpHeader->proto == IPPROTO_ICMP) strData.Format("type:%d code:%d data:%s",pICMPHead->Type,pICMPHead->Code,pdata); else strData.Format(" %s",pdata); strSize.Format("%d",totallen); pDlg->AddData(strProto,szSource,strSourPort,szDest,strDestPort,strSize,strData); if( iLen < iRet ) { iRet -= iLen ; bufwork += iLen ; pIpHeader = (IPHEADER *)bufwork ; } else break ; // pIpHeader->total_len == iRet and go out } else { // read last part of buf. I wrote it , but always recv() read exactly // the lenght of the packet int iLast = iLen - iRet ; pLastBuf = new char [ iLen ] ; int iReaden = iRet ; memcpy( pLastBuf , bufwork , iReaden ) ; iRet = recv( pDlg->m_s , pLastBuf + iReaden , iLast , 0 ) ; if( iRet == SOCKET_ERROR ) { dwErr = WSAGetLastError() ; sprintf( szErr , "Error recv() = %ld " , dwErr ) ; break ; } else { bufwork = pLastBuf ; pIpHeader = (IPHEADER *)bufwork ; if( iRet == iLast ) iRet = iLen ; else { // read all last data iReaden += iRet ; iLast -= iRet ; while( TRUE ) { iRet = recv( pDlg->m_s , pLastBuf +iReaden , iLast , 0 ) ; if( iRet == SOCKET_ERROR ) { dwErr = WSAGetLastError() ; sprintf( szErr , "Error recv() = %ld " , dwErr ) ; break ; } else { iReaden += iRet ; iLast -= iRet ; if( iLast <= 0 ) break ; } } // while } } } } // while if( pLastBuf ) delete [ ] pLastBuf ; } else { AfxMessageBox( "No data on network" ) ; continue ; } } return TRUE ; } void CIpmonDlg::OnLookUp() { // TODO: Add your control notification handler code here char szErr [ 50 ] , szHostName[MAX_PATH]; DWORD dwErr ; SOCKADDR_IN sa; gethostname(szHostName, sizeof(szHostName)) ; m_iphostsource = m_ipsource ; m_ipcheckedhost = ntohl(m_iphost) ; if( 0 == m_threadID ) { SetDlgItemText(IDC_LOOKUP,"停止查看!" ); } else { if( m_threadID ) { PostThreadMessage(m_threadID,WM_CLOSE,0,0) ; SetDlgItemText(IDC_LOOKUP,"开始查看!"); m_start.EnableWindow(FALSE) ; } return ; } DWORD dwBufferLen[10] ; DWORD dwBufferInLen= 1 ; DWORD dwBytesReturned = 0 ; m_s = socket( AF_INET , SOCK_RAW , IPPROTO_IP ) ; if( INVALID_SOCKET == m_s ) { dwErr = WSAGetLastError() ; sprintf( szErr , "Error socket() = %ld " , dwErr ) ; AfxMessageBox( szErr ) ; closesocket( m_s ) ; return ; } int rcvtimeo = 5000 ; if( setsockopt( m_s , SOL_SOCKET , SO_RCVTIMEO , (const char *)&rcvtimeo , sizeof(rcvtimeo) ) == SOCKET_ERROR) { dwErr = WSAGetLastError() ; sprintf( szErr , "Error WSAIoctl = %ld " , dwErr ) ; AfxMessageBox( szErr ) ; closesocket( m_s ) ; return ; } sa.sin_family = AF_INET; sa.sin_port = htons(7000); sa.sin_addr.s_addr= m_iphostsource; if (bind(m_s,(PSOCKADDR)&sa, sizeof(sa)) == SOCKET_ERROR) { dwErr = WSAGetLastError() ; sprintf( szErr , "Error bind() = %ld " , dwErr ) ; AfxMessageBox( szErr ) ; closesocket( m_s ) ; return ; } if( SOCKET_ERROR != WSAIoctl( m_s, SIO_RCVALL , &dwBufferInLen, sizeof(dwBufferInLen), &dwBufferLen, sizeof(dwBufferLen), &dwBytesReturned , NULL , NULL ) ) AfxBeginThread( threadFunc , (LPVOID)this ); else { dwErr = WSAGetLastError() ; sprintf( szErr , "Error WSAIoctl = %ld " , dwErr ) ; AfxMessageBox( szErr ) ; closesocket( m_s ) ; return ; } } void CIpmonDlg::OnOK() { // TODO: Add extra validation here if( NULL != m_threadID ) PostThreadMessage(m_threadID,WM_CLOSE,0,0) ; if( m_IPArr.GetSize() ) m_IPArr.RemoveAll() ; CDialog::OnOK(); } void CIpmonDlg::AddData(CString s0,CString s1, CString s2, CString s3, CString s4, CString s5, CString s6) { int index; index = m_ctrList.InsertItem(0,s0); m_ctrList.SetItem(index,1,LVIF_TEXT,s1, 0, 0, 0,0); m_ctrList.SetItem(index,2,LVIF_TEXT,s2, 0, 0, 0,0); m_ctrList.SetItem(index,3,LVIF_TEXT,s3, 0, 0, 0,0); m_ctrList.SetItem(index,4,LVIF_TEXT,s4, 0, 0, 0,0); m_ctrList.SetItem(index,5,LVIF_TEXT,s5, 0, 0, 0,0); m_ctrList.SetItem(index,6,LVIF_TEXT,s6, 0, 0, 0,0); }
Radmin自动登陆器 v3.0 - By: ybmj@vip.163.com 20150615 By: ybmj@vip.163.com , http://dep.yibinu.cn/wgzxnew/ 1、程序功能和使用环境介绍 2、程序操作方法介绍 3、登录信息文件RadminM.txt介绍 4、登录信息文件RadminM.txt的转换和编制 5、v3.0版新增解锁远程桌面功能 6、相关配置和多种语言支持介绍 7、免责申明 1、程序功能和使用环境介绍 (1)、程序功能 为了安全高效地使用Radmin Viewer来自动登录和管理多台服务器,故编制RadminM (Radmin Connection Manager,Radmin自动登录器)。 v3.0版的可执行文件是RadminM.exe,一台电脑只能运行一个实例,再次运行只是将已运行的实例调到前台。v3.0版之前的老版本的可执行文件是RadminM2.exe。 新版的功能已经比较完善,基本上可以代替Radmin Viewer 3.5进行管理(除Intel AMT功能外),另外还增加了一些实用功能,支持Windows Xp、Vista、Win7、Win8、2003、2000、9x及相应Windows Server版等操作系统。 (2)、程序使用环境要求 使用前请将Radmin Viewer 3.5的Radmin.exe文件直接拷贝到该目录中,其它Radmin Viewer 3.x版本也可以,中文版、英文版均可; 请设置防火墙允许Radmin.exe和RadminM.exe(仅扫描功能用)访问网络; 若要用到聊天、语音聊天、传送信息等连接模式,必须将相应的8个dll文件也拷贝到该目录中:ChatLPCx.dll、raudiox.dll、rchatx.dll、unicows.dll、vcintcx.dll、vcintsx.dll、voicex.dll、WinLpcDl.dll。 (3)、Radmin Server使用权限设置(新版本可选) 注意:在v1.5及以前的老版本中,Radmin Server被控端必须将“使用权限...”(Permissions)设置为“Windows NT 安全性”(Security),如果设置为“Radmin安全性”(Security)将不能实现自动登录功能。在新版本中,这两种安全性模式下,都可以实现自动登录功能。 (4)、开发环境 v1.5及以前的老版本用AutoIt语言开发,AutoIt是解释性语言,功能和稳定性有限,并且一些防病毒软件会报警。 为了在功能和稳定性方面进一步提高和改进,v2.0版使用VC++ Unicode(MFC)编程,程序在编译时已经集成了VC运行库,可独立运行。 由于MFC越益臃肿笨重,为了提高稳定性和效率,v3.0版使用WTL VC++ Unicode编程,程序短小精悍、可独立运行。WTL是Windows Template Library,可参见 http://wtl.sourceforge.net/ 。 2、程序操作方法介绍 (1)、程序中的鼠标操作 * 双击某条记录以默认模式自动连接(等待6秒);若该记录包含私有代理将自动进行代理连接(代理登录和目标登录各等待6秒); * 左上角的选择框或主菜单都可以选择默认连接模式; * 先右击某条记录(或F9)填为强制代理(支持域名),并选中强制代理选项,便可对另一条记录强制进行代理连接(将忽略私有代理); * 支持鼠标滚轮; * 主菜单和右键菜单均可完成本程序的常规操作;记录窗格的右键菜单或单击工具栏的相应按钮可直接选择进行指定模式的连接(将忽略默认连接模式); * 主菜单中的“配置”菜单可以选择程序的各项相关配置; * 工具栏各个按钮的功能均有提示; * 单击工具栏上的“显示隐藏树状目录”按钮可以显示隐藏目录树窗格,目录树窗格的右键菜单可完成目录树的一些常规操作; * 单击工具栏上的“选择切换图标查看模式”按钮可以切换或选择记录窗格的图标查看模式; * 记录窗格和目录树窗格都支持鼠标拖放功能,强烈建议用户使用该功能前备份RadminM.txt,以免损坏或丢失数据;直接鼠标拖放为移动,Ctrl+鼠标拖放为复制。拖放时状态栏有提示信息; * 程序启动时,记录自动按记录名称升序排列;在记录窗格单击列表框某列表头,可以按该列进行记录排序,再次单击可以反向排序。 (2)、程序中的常用快捷键 * Enter :以默认模式连接记录; * Insert :新建记录; * Ctrl+e :编辑记录; * Ctrl+c

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧