在C#,我有的IntPtr到Win32的WndProc。什么是语法调用它
问题说明
我在子类本机窗口(组合框的编辑控件...)
I'm subclassing a native window (the edit control of a combobox...)
oldWndProc = SetWindowLong函数(HandleOfCbEditControl,GWL_WNDPROC,newWndProc);
oldWndProc = SetWindowLong(HandleOfCbEditControl, GWL_WNDPROC, newWndProc);
在我的子类的WndProc,我将有code这样的,正确的,但我不能找出语法调用oldWndProc。
In my subclassing wndproc, I'll have code like this, right, but I can't figure out the syntax for calling the oldWndProc.
int MyWndProc(int Msg, int wParam, int lParam)
{
if (Msg.m == something I'm interested in...)
{
return something special
}
else
{
return result of call to oldWndProc <<<< What does this look like?***
}
}
编辑:在这个问题的话子类化指的是Win32 API的意义,而不是C#。子类在这里并不意味着压倒一切的。NET基类的行为。这意味着告诉WIN32调用Windows当前回调的函数指针来代替。它无关的传承在C#。
The word "subclassing" in this question refers to the WIN32 API meaning, not C#. Subclassing here doesn't mean overriding the .NET base class behavior. It means telling WIN32 to call your function pointer instead of the windows current callback. It has nothing to do with inheritence in C#.
正确答案
您会打电话的 CallWindowProc的通过P /调用。只要定义参数INT变量(因为它看起来像你如何在调用SetWindowLong调用中定义他们的),所以是这样的:
You'll call CallWindowProc by P/Invoke. Just define the parameters as int variables (as it looks like that's how you defined them in the SetWindowLong call), so something like this:
[的DllImport(CallWindowProc的...] 公共静态外部INT CallWindowProc的(INT previousProc,INT nativeControlHandle,诠释味精,诠释lParam的,诠释的wParam);
[DllImport("CallWindowProc"...] public static extern int CallWindowProc(int previousProc, int nativeControlHandle, int msg, int lParam, int wParam);
记住,对于编组,INT,UINT和IntPtr的都是相同的。
Remember, that for marshaling, int, uint and IntPtr are all identical.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcgkjij
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20