Windowfrompoint解决方案或替代方案 [英] Windowfrompoint solution or alternative

查看:98
本文介绍了Windowfrompoint解决方案或替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< DllImport(  user32.dll)> ; 
公共 功能 WindowFromPoint( ByVal point As Point) As IntPtr
结束 功能



我是希望有人有一种方法可以让windowfrompoint api在32位和64位系统中工作。如果那是不可能的,是否有另一个api或方法来获取鼠标光标下的窗口?



这是来自pinvoke.net网站:

  -   IntPtr  WindowFromPoint(POINT Point)始终 return  < span class =code-digit> 0    32/64位进程。 
- IntPtr WindowFromPoint( int x, int y)在 32位中运行但在 64位进程中失败。



此问题顶部的import语句适用于64位系统,但不适用于32位

解决方案

< blockquote>阅读这些:

https://sites.google.com/site/x64lab/home/notes-on-x64-windows-gui-programming/windowfrompoint-on-x64-vista [ ^ ]



HTTP:// stackoverf low.com/questions/12949753/windowfrompoint-doesnt-work-correctly-on-64bit-net-framework [ ^ ]



活动禁用控件 [ ^ ]


我从未使用过WindowFromPoint,但看到了一个签名在x32中运行,另一个在x64中运行,我要做的是检查我的程序是在32位还是64位操作系统中运行并调用其中一个。要查看它正在运行的操作系统类型,您可以查看这个(StackOverflow) ) [ ^ ]

<DllImport("user32.dll")>
    Public Function WindowFromPoint(ByVal point As Point) As IntPtr
    End Function


I am hoping somebody has a method of getting the windowfrompoint api to work in both 32 bit and 64 bit systems. If that is not possible, is there another api or method to get the window under the mouse cursor?

This is from the pinvoke.net site:

- IntPtr WindowFromPoint(POINT Point) always return 0 in both 32/64 bit process.
- IntPtr WindowFromPoint(int x, int y) works in 32-bit but fails in 64-bit process.


The import statement at the top of this question works for me on a 64 bit system, but not on 32 bit

解决方案

Read these:
https://sites.google.com/site/x64lab/home/notes-on-x64-windows-gui-programming/windowfrompoint-on-x64-vista[^]

http://stackoverflow.com/questions/12949753/windowfrompoint-doesnt-work-correctly-on-64bit-net-framework[^]

Re-Active Disabled Controls[^]


I've never used WindowFromPoint,but seeing that one signature works in x32 and the other in x64,what i would do is check if my program is running in a 32 or 64 bits OS and call one or the other. To check what type of OS it's running you may check this(StackOverflow)[^]


这篇关于Windowfrompoint解决方案或替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆