如何获取选项卡的句柄 [英] How to get handles of tabs

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

问题描述

大家好

我正在进行一个需要在其他应用程序中显示槽标签的项目.我正在使用win32 api来访问其他应用程序中的句柄.我设法使我的代码正常工作,但是它有一个小故障.事实证明,当您在选项卡上使用FindWindowEx()时,它仅返回第一个选项卡句柄.我使用它的方式是,实际上我只单击了第二个选项卡一次,然后该项目就可以完美运行.

我使用了Spy ++,当我第一次查看第一个选项卡时,它没有显示任何兄弟姐妹(即使我还有两个选项卡),但是当我单击兄弟姐妹并返回到第一个选项卡并再次使用spy ++进行检查时,它没有显示任何兄弟姐妹告诉我兄弟姐妹.因此,我无法使用GetWindow(GW_HWNDNEXT),因为在单击选项卡之前,它不知道它具有同级.

我真的在尝试避免使用enumchildWindows(),因为我不知道它是如何工作的,我一直在试图理解,但是我几乎找不到示例,也很难找到如何使用它的很好的解释.

Hi all

I am working on a project that requires getting trough tabs in a different application. I am using win32 api in order to access the handles in the other app. I managed to get my code to work, however it has a glitch. it turns out that when you use FindWindowEx() on the tab, it returns the first tab handle only. The way I got it to work is that I actually click the second tab only once end then the project runs flawless.

I used the Spy++ and when I looked at the 1st tab for the first time it shows no siblings(even though I have two more tabs), however when I click on the siblings and go back to the first tab and check again with spy++ it shows me the siblings. Therefore I can''t use GetWindow(GW_HWNDNEXT) because it doesn''t know it has a sibling until I click on the tab.

I am really trying to avoid using enumchildWindows() since I have no idea how it works, I''ve been trying to understand but I can hardly find examples, or a good explanation how to use it.

thank you in anticipation.

推荐答案

您无法避免使用enumChildWindow.选项卡页(可能是选项卡控件的子窗口).
You can''t avoid using enumChildWindow. The tab pages are (probably) child windows of the tab control.


找到了一种解决EnumChildWindows()的方法,该方法无法正常工作,因为选项卡2,3,除非您单击它们,否则不会创建它们.有一个名为SendInput()的函数,该函数可让您将所需的任何内容发送到任意位置,希望我能在上面写一篇文章,这几天我实际上学到了很多Win32,谢谢大家您的所有帮助!
found a way to get around the EnumChildWindows() which didn''t work because the handles for tab 2,3,... aren''t created until you click on them. There is a function called SendInput() which allows you to just send whatever you want where ever the cursor is placed, hopefully I should be placing an article on this, I actually learned a lot of Win32 these past few day, thank you guys for all your help!


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

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