Delphi:如何获取 TComboBox 组件的句柄?
据我所知,Combobox由两个组件组成:Edit和ListBox。如果我有编辑字段的句柄,如何获取组合框的句柄? 我尝试使用 GetWindow(MyHandle, GW_HWNDNEXT),其中 MyHandle 是我知道的 Edit 句柄,但结果始终为 0。有人有什么想法吗?
非常感谢。
As far as I know, Combobox consists of two components: Edit and ListBox. How can I get Handle of Combobox, if I have handle of it's Edit field ?
I tried to use GetWindow(MyHandle, GW_HWNDNEXT), where MyHandle is that handle of Edit that I know, but the result is always 0. Someone have any ideas?
Thx a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
“编辑”窗口是“组合框”窗口的子窗口:使用 <代码>GetParent。
The Edit window is a child of the ComboBox window: Use
GetParent
.TCustomCombo
定义ListHandle
和EditHandle
属性。这些具有受保护的可见性,但您始终可以通过子类化或使用标准技巧来获取受保护的成员来获取它们:TCustomCombo
definesListHandle
andEditHandle
properties. These have protected visibility but you can always get at them by either subclassing or using the standard trick to get at protected members:您是如何获得 Edit 的句柄的?如果执行
Combobox1.Handle
,您将获得COMBOBOX
类窗口的句柄。阅读 http://msdn.microsoft.com/en-us /library/bb775792(VS.85).aspx
How did you get the handle of the Edit? If you do
Combobox1.Handle
you get a handle for aCOMBOBOX
class window.Read http://msdn.microsoft.com/en-us/library/bb775792(VS.85).aspx