CCmdTarget - MSDN6翻译交流

本文介绍了CCmdTarget类及其在消息映射中的作用。CCmdTarget是MFC消息映射体系的基础类,用于路由命令和消息到处理函数。文章还提到了几个重要的派生类,如CView和CWinApp,并解释了如何使用此类实现消息处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

BUG和建议请提出,谢谢!

CCmdTarget

CCmdTarget is the base class for the Microsoft Foundation Class Library message-map architecture. A message map routes commands or messages to the member functions you write to handle them. (A command is a message from a menu item, command button, or accelerator key.)

CCmdTarget是微软基础类库消息映射体系中的基类。消息映射安排命令或消息到你编写的成员函数来处理它们。(命令是来自菜单项、命令按钮或快捷键的消息。)

Key framework classes derived from CCmdTarget include CView, CWinApp, CDocument, CWnd, and CFrameWnd. If you intend for a new class to handle messages, derive the class from one of these CCmdTarget-derived classes. You will rarely derive a class from CCmdTarget directly.

继承自CCmdTarget的(关键框架)类包括CView, CWinApp, CDocument, CWnd, CFrameWnd。如果你打算用一个新的类来处理消息,(请)从这些CCmdTarget派生类来继承那个(新)类。你会很少直接从CCmdTarget继承一个类。

For an overview of command targets and OnCmdMsg routing, see Command Targets, Command Routing, and Mapping Messages in Visual C++ Programmer's Guide.

CCmdTarget includes member functions that handle the display of an hourglass cursor. Display the hourglass cursor when you expect a command to take a noticeable time interval to execute.

CCmdTarget包含用于显示沙漏光标的成员函数。当你预料一个命令的执行(会明显地占用一段时间)时,请显示沙漏光标。

Dispatch maps, similar to message maps, are used to expose OLE automation IDispatch functionality. By exposing this interface, other applications (such as Visual Basic) can call into your application. For more information on the IDispatch interfaces, see Creating the IDispatch Interface and Dispatch Interface and API Functions in the Win32 SDK OLE Programmer's Reference.

#include <afxwin.h>

Class MembersBase ClassHierarchy Chart

Sample    MFC Sample ACDUAL

See Also   CCmdUI, CDocument, CDocTemplate, CWinApp, CWnd, CView, CFrameWnd, COleDispatchDriver

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值