VB6:获取第 3 方控件内子控件的 hWnd
我有一个vb6第三方UpDown控件(让它成为ControlX),通过UISpy我可以看到ControlX里面有2个控件,一个是“ThunderRT6TextBox”,另一个是“UpDown20WndClass”。
我正在 ControlX 周围绘制边框。我正在使用 ControlX hWnd,并且像这样绘制边框:
hdc = BeginPaint(hwnd, tPS)
GetClientRect hwnd, controlXRect
DrawEdge hdc, controlXRect, BDR_SUNKENOUTER, BF_RECT
问题是边框是围绕 ThunderRT6TextBox 而不是 UpDown20WndClass 绘制的(也许 ControlX hWnd 返回其内部 ThunderRT6TextBox 控件 hwnd)。
我想获取 ControlX 的内部 UpDown20WndClass 控件 hWnd,在其周围绘制边框。
我该怎么做?
提前致谢。
I have a vb6 third party UpDown Control (let it be ControlX), with UISpy i could see that ControlX has 2 controls inside, one is a "ThunderRT6TextBox" the other is a "UpDown20WndClass".
I am drawing a border around ControlX. I am using the ControlX hWnd, and i draw the border like this:
hdc = BeginPaint(hwnd, tPS)
GetClientRect hwnd, controlXRect
DrawEdge hdc, controlXRect, BDR_SUNKENOUTER, BF_RECT
The problem is that the border is drawn around the ThunderRT6TextBox but not the UpDown20WndClass (maybe the ControlX hWnd returns it's inner ThunderRT6TextBox control hwnd).
I would like to get the ControlX's inner UpDown20WndClass control hWnd, to draw a border around it.
How can i do this?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 updown 控件已成为文本框的子控件,您应该能够使用 EnumChildWindows 来找到它。您可以使用 WinSpy 查看是否存在包含文本框和 updown 的整体父 hwnd,然后对其进行枚举。
If the updown control has been made a child of the textbox, you should be able to use EnumChildWindows to find it. You might use WinSpy to see if there's an overall parent hwnd that contains both the textbox and the updown, then enum for it.
我当获取 ControlX hwnd 时,它返回“ThunderRT6TextBox”的 hwnd。要获取“UpDown20WndClass”hwnd,我需要其父hwnd(ControlX hwnd)。我将 GetParent 与“ThunderRT6TextBox”hwnd 一起使用,并获得了公共父 hwnd,然后使用 FindWindowEx 我获得了“UpDown20WndClass”。
I when get ControlX hwnd it returns the hwnd of the "ThunderRT6TextBox". To get the "UpDown20WndClass" hwnd, i need its parent hwnd (ControlX hwnd). I used GetParent with "ThunderRT6TextBox" hwnd, and got the common parent hwnd, and then with FindWindowEx i got the "UpDown20WndClass".