VC6.0中对消息的特殊处理--PreTranslateMessage说明

本文详细介绍了VC6.0中如何使用PreTranslateMessage函数来过滤并处理窗口消息,特别是在子对话框与父窗口间进行焦点转移的场景。通过重写PreTranslateMessage,实现了在特定按键如回车、Tab和Esc时,控制焦点在子窗口和父窗口之间切换。例如,当焦点在IDC_EDT_TEST_DATA_FILE编辑框上按回车,焦点将移到下一个控件;按Shift+Tab时,焦点会跳转到IDC_RBTN_STEP4 Radio Button等。

首先看看MSDN对PreTranslateMessage的说明

 

 

Override this function to filter window messages before they are dispatched to the Windows functions TranslateMessage and DispatchMessage The default implementation performs accelerator-key translation, so you must call the CWinApp::PreTranslateMessage member function in your overridden version.

 
virtual BOOL PreTranslateMessage(
MSG* pMsg
);

Parameters

pMsg

A pointer to a MSG structure that contains the message to process.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值