列表框:WM_CHAR 搜索项目的时间间隔
Listbox: WM_CHAR time interval for searching items
列表框控件 WM_CHAR
的 Microsoft documentation 说明了这一点(强调 短间隔 是我的):
WM_CHAR
Moves selection to the first item that begins with the character that the user typed. If the list box has the LBS_OWNERDRAW style, no action occurs. Multiple characters that are typed within a short interval are treated as a group, and the first item that begins with that series of characters is selected.
他们提到短间隔。
有谁知道这个间隔的持续时间是否可以通过某种方式获得?
我有一个 onwer 绘制列表框,其中没有发生上述行为(这是正常记录的行为),我自己使用 1.5 秒的间隔(这似乎或多或少短间隔的持续时间)。
一切正常,但我不想使用 1.5 秒的硬编码持续时间,而是想从某个地方检索这个持续时间(注册表,一些 API 我不知道,... ) 因此间隔是列表框的默认行为所使用的间隔。
在我的测试中,我发现 ListBox 使用时间 return 由 GetDoubleClickTime()
编辑并在 4 上倍增。
所以 interval = 4 * GetDoubleClickTime()
或 GetDoubleClickTime() << 2
.
我们可以通过 SetDoubleClickTime
函数改变双击时间来测试
例如
UINT t = GetDoubleClickTime();
SetDoubleClickTime(4000);
test();
SetDoubleClickTime(t);
或通过钩子修改 GetDoubleClickTime
return 值或在调试器下更改 asm 代码(即使是临时全局 windows 设置也不更改)。无论如何,从 GetDoubleClickTime
更改 return 值对 ListBox 行为有明显影响
列表框控件 WM_CHAR
的 Microsoft documentation 说明了这一点(强调 短间隔 是我的):
WM_CHAR
Moves selection to the first item that begins with the character that the user typed. If the list box has the LBS_OWNERDRAW style, no action occurs. Multiple characters that are typed within a short interval are treated as a group, and the first item that begins with that series of characters is selected.
他们提到短间隔。
有谁知道这个间隔的持续时间是否可以通过某种方式获得?
我有一个 onwer 绘制列表框,其中没有发生上述行为(这是正常记录的行为),我自己使用 1.5 秒的间隔(这似乎或多或少短间隔的持续时间)。
一切正常,但我不想使用 1.5 秒的硬编码持续时间,而是想从某个地方检索这个持续时间(注册表,一些 API 我不知道,... ) 因此间隔是列表框的默认行为所使用的间隔。
在我的测试中,我发现 ListBox 使用时间 return 由 GetDoubleClickTime()
编辑并在 4 上倍增。
所以 interval = 4 * GetDoubleClickTime()
或 GetDoubleClickTime() << 2
.
我们可以通过 SetDoubleClickTime
函数改变双击时间来测试
例如
UINT t = GetDoubleClickTime();
SetDoubleClickTime(4000);
test();
SetDoubleClickTime(t);
或通过钩子修改 GetDoubleClickTime
return 值或在调试器下更改 asm 代码(即使是临时全局 windows 设置也不更改)。无论如何,从 GetDoubleClickTime
更改 return 值对 ListBox 行为有明显影响