从Windows句柄获取对象 [英] Get Object from Windows Handle

查看:95
本文介绍了从Windows句柄获取对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您知道对象类型,并且拥有对象的句柄(hwnd),是否可以将其转换为变量?

If you know an object type, and you have the object's handle (hwnd), is there a way to turn that into a variable?

示例:

Set myObj = Magic(hwnd)

推荐答案

HWND只是由OS映射到内部对象的数字(它们可以并且确实可以回收).你真的不能把它们变成任何东西.

HWNDs are just numbers that are mapped to internal objects by the OS (and they can and do get recycled). You can't really turn them into anything.

在您的示例中,您希望myObj做什么?所有用于操作Windows的Windows API都采用HWND.

What would you expect myObj to do in your example? All the Windows APIs for manipulating windowss take HWNDs.

这篇关于从Windows句柄获取对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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