窗口句柄(HWND)是唯一的,还是曾经被重用? [英] Are window handles (HWND) unique, or do they ever get reused?
问题描述
我在想是否有相同值的句柄?
I am thinking if there are handles of the same value ?
为澄清我的问题,假设我打开记事本,键入一些文本,保存它,然后关闭记事本.如果我重复一千次(甚至更多),是否有机会看到与第一次使用的记事本主窗口相同的窗口句柄(HWND)值?如果是这样,为什么?
To clarify my question, let's say I open Notepad, type in some text, save it and then close Notepad. If I repeat this a thousand times (or even more), will I ever have a chance to see the same window handle (HWND) value being used for the Notepad main window that was used the first time? If so, why?
推荐答案
通过 piegonhole主体 ,是的,它们不能唯一.实际上,Microsoft仍然保持与16位Windows的兼容性,因此,句柄为16位值.因此,最多有65536个可能的句柄值.
By the pigeonhole principal, yes, they can't be unique. In fact, Microsoft still maintains compatibility with 16-bit Windows, and as a result handles are 16-bit values. So there are at most 65536 possible handle values.
这篇关于窗口句柄(HWND)是唯一的,还是曾经被重用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!