C编辑,WM_​​PASTE

发布于 2024-09-30 14:40:07 字数 232 浏览 0 评论 0原文

假设我在 CEdit 后代中有一个 wm_paste 消息的处理程序:

LRESULT CMyEdit::OnPaste(WPARAM wParam, LPARAM lParam)
{
//do some processing
return 0;
}

假设在某些情况下我想触发粘贴的默认行为 从这个方法。我该怎么做? CEdit::OnPaste 不存在...

干杯

let's say I've got a handler of the wm_paste message in a CEdit descendant:

LRESULT CMyEdit::OnPaste(WPARAM wParam, LPARAM lParam)
{
//do some processing
return 0;
}

and let's say that in some cases I want to trigger the default behaviour for paste
from this method. How do I do it? CEdit::OnPaste does not exist...

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧人九事 2024-10-07 14:40:07

调用 CWnd::DefWindowProc,传递它WM_PASTEwParamlParam

通常,基类中的 OnXxx 处理程序由一行调用 DefWindowProc 组成 - 如果 CEdit::OnPaste 存在,那么它就会执行此操作。

Call CWnd::DefWindowProc, passing it WM_PASTE, wParam and lParam.

Typically the OnXxx handlers in base classes consist of a single line that calls DefWindowProc -- if CEdit::OnPaste existed, that's what it would do.

偷得浮生 2024-10-07 14:40:07

您也可以简单地调用 CWnd::Default。该函数定义在wincore.cpp中,使用_afxThreadState.GetData()获取当前正在处理的消息的信息,然后调用CWnd::DefWindowProc。

我提到这一点是因为如果您在消息映射中使用了 ON_WM_PASTE() 宏,因此 OnPaste 函数没有参数,那么 Tim Robinson 提到的解决方案将不起作用,因为没有 wParam 和 lParam 参数传递给 CWnd::DefWindowProc 。

You can also simply call CWnd::Default. This function, which is defined in wincore.cpp, uses _afxThreadState.GetData() to obtain the information on the message that is currently being processed and then calls CWnd::DefWindowProc.

I mention that because if you used the ON_WM_PASTE() macro in the message map and thus have no parameters to the OnPaste function then the solution mentioned by Tim Robinson will not work since there are no wParam and lParam parameters to pass to CWnd::DefWindowProc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文