VC获取窗口句柄!求大神解惑!
程序中调用另一个窗口的控件单击等操作
1.使用spy++等工具检测窗格布局如下:
[桌面Desktop]
--1窗格“有信”
----2窗格“”
--------3窗格“”
----------------4窗格“”
---------------------按钮1
---------------------按钮2
---------------------...(所需要获取的16个控件)
----------------4窗格"UXTab"
--------3窗格“”
--7个按钮
--------3窗格“”
--四个子窗格
2.使用GW_CHILD、GW_HWNDNEXT获取窗口句柄(但与spy++中显示的层次结构不一样)
请大家指导或提供思路,谢谢大家!新年快乐~
1.使用spy++等工具检测窗格布局如下:
[桌面Desktop]
--1窗格“有信”
----2窗格“”
--------3窗格“”
----------------4窗格“”
---------------------按钮1
---------------------按钮2
---------------------...(所需要获取的16个控件)
----------------4窗格"UXTab"
--------3窗格“”
--7个按钮
--------3窗格“”
--四个子窗格
2.使用GW_CHILD、GW_HWNDNEXT获取窗口句柄(但与spy++中显示的层次结构不一样)
hMain = (HWND)FindWindow(NULL, L"有信");
//SendMessage(hMain, WM_CLOSE, 0, 0); //居然关闭不了 汗= =!
//DestroyWindow(hMain);
HWND hChild = GetWindow(hMain,GW_CHILD);//"" 3个有效句柄
HWND step0_1 = GetWindow(hChild,GW_HWNDFIRST);
HWND step0_2 = GetWindow(step0_1,GW_HWNDNEXT);
HWND step0_3 = GetWindow(step0_2,GW_HWNDNEXT);
HWND hChild1 = GetWindow(hChild,GW_CHILD);//"" "" "" 4个有效句柄
HWND step1_1 = GetWindow(hChild1,GW_HWNDFIRST);
HWND step1_2 = GetWindow(step1_1,GW_HWNDNEXT);
HWND step1_3 = GetWindow(step1_2,GW_HWNDNEXT);
HWND step1_4 = GetWindow(step1_3,GW_HWNDNEXT);
HWND step1_5 = GetWindow(step1_4,GW_HWNDNEXT);
HWND hChild2 = GetWindow(hChild1,GW_CHILD);//"" "UXTab" 2 8个有效句柄
HWND step2_1 = GetWindow(hChild2,GW_HWNDFIRST);
HWND step2_2 = GetWindow(step2_1,GW_HWNDNEXT);
HWND step2_3 = GetWindow(step2_2,GW_HWNDNEXT);
HWND step2_4 = GetWindow(step2_3,GW_HWNDNEXT);
HWND step2_5 = GetWindow(step2_4,GW_HWNDNEXT);
HWND step2_6 = GetWindow(step2_5,GW_HWNDNEXT);
HWND step2_7 = GetWindow(step2_6,GW_HWNDNEXT);
HWND step2_8 = GetWindow(step2_7,GW_HWNDNEXT);
HWND step2_9 = GetWindow(step2_8,GW_HWNDNEXT);
HWND step2_10 = GetWindow(step2_9,GW_HWNDNEXT);
HWND step2_11 = GetWindow(step2_10,GW_HWNDNEXT);
HWND step2_12 = GetWindow(step2_11,GW_HWNDNEXT);
HWND step2_13 = GetWindow(step2_12,GW_HWNDNEXT);
HWND step2_14 = GetWindow(step2_13,GW_HWNDNEXT);
HWND step2_15 = GetWindow(step2_14,GW_HWNDNEXT);
HWND step2_16 = GetWindow(step2_15,GW_HWNDNEXT);
HWND step2_17 = GetWindow(step2_16,GW_HWNDNEXT);
HWND step2_18 = GetWindow(step2_17,GW_HWNDNEXT);
HWND hChild3 = GetWindow(hChild2,GW_CHILD);//"" * 16 1个有效句柄
HWND step3_1 = GetWindow(hChild3,GW_HWNDFIRST);
HWND step3_2 = GetWindow(step3_1,GW_HWNDNEXT);
HWND step3_3 = GetWindow(step3_2,GW_HWNDNEXT);
HWND step3_4 = GetWindow(step3_3,GW_HWNDNEXT);
HWND step3_5 = GetWindow(step3_4,GW_HWNDNEXT);
HWND step3_6 = GetWindow(step3_5,GW_HWNDNEXT);
HWND step3_7 = GetWindow(step3_6,GW_HWNDNEXT);
HWND step3_8 = GetWindow(step3_7,GW_HWNDNEXT);
HWND step3_9 = GetWindow(step3_8,GW_HWNDNEXT);
HWND step3_10 = GetWindow(step3_9,GW_HWNDNEXT);
HWND step3_11 = GetWindow(step3_10,GW_HWNDNEXT);
HWND step3_12 = GetWindow(step3_11,GW_HWNDNEXT);
HWND step3_13 = GetWindow(step3_12,GW_HWNDNEXT);
HWND step3_14 = GetWindow(step3_13,GW_HWNDNEXT);
HWND step3_15 = GetWindow(step3_14,GW_HWNDNEXT);
HWND step3_16 = GetWindow(step3_15,GW_HWNDNEXT);请大家指导或提供思路,谢谢大家!新年快乐~
...全文
相关推荐
VC中获取窗口句柄的各种方法
窗口句柄是系统分配的一个唯一整数值,它允许程序与特定窗口进行交互。本篇文章将详细介绍在VC中获取窗口句柄的多种方法。1.
VC获取自身窗口句柄
本文将围绕“VC获取自身窗口句柄”这一主题展开,详细介绍相关知识点,包括窗口句柄的基本概念、获取窗口句柄的方法、以及在实际编程中的应用。
VC由进程ID获取窗口句柄
VC由进程ID获取窗口句柄VC由进程ID获取窗口句柄是Windows编程中的一种常见操作。通过获取进程ID,可以获取该进程下的所有窗口句柄,从而实现对该进程的控制和操作。
VC_各种情况下的窗口句柄的获取
在Visual C++(VC)开发环境中,有许多方法可以用来获取窗口句柄,本文将详细介绍几种常见的获取窗口句柄的方法。
获取任务栏窗口句柄VC源代码
总的来说,"获取任务栏窗口句柄VC源代码"这个主题,涉及到Windows API的使用、非公开API的风险、MFC框架的窗口操作以及Windows编程的基本概念。


工具平台和程序库
