1

我的桌面上有一个名为“卡巴斯基反病毒配置向导”的窗口

以下是有关窗口的一些信息:

>>>> Window <<<<
Title:  Kaspersky Anti-Virus Configuration Wizard
Class:  AVP.ConfigureWizard
Position:   612, 247
Size:   499, 388
Style:  0x94CA0044
ExStyle:    0x00010100
Handle: 0x00081308

该窗口未出现在 Windows 任务管理器任务列表中(仅它的进程存在于进程列表中为“avp.exe”,据我所知,这让我很难实现我的目标。首先我会欣赏有人会解释如何在“Windows 任务管理器”的“应用程序”选项卡中不存在的 Kaspersky Programmed i 窗口。其次,如果您能帮我解决我的问题,我将非常感激,详细信息如下:

我想从代码(C++ \ Autoit)中激活窗口(在窗口上设置焦点)。

我尝试使用 WinAPI 的 FindWindow 函数,但无法获得该窗口的句柄。

我得到了 GetForegroundWindow 函数的句柄,我发现当我使用 EnumWindows 函数时,卡巴斯基配置窗口的句柄不在列表中。

这是我的代码:

BOOL CALLBACK EnumWindowsProc(__in  HWND hwnd, __in  LPARAM lParam)
{
    if(g_hWnd == hwnd)
    {
        cout << "Found window";
        return FALSE;
    }
    return TRUE;
}
BOOL CALLBACK EnumDesktopProc(
    __in  LPTSTR lpszDesktop,
    __in  LPARAM lParam
    )
{
    EnumDesktopWindows(OpenDesktop(lpszDesktop,DF_ALLOWOTHERACCOUNTHOOK,FALSE,DESKTOP_ALL),EnumWindowsProc, NULL);
    return true;
}

BOOL CALLBACK EnumWindowStationProc(
    __in  LPTSTR lpszWindowStation,
    __in  LPARAM lParam
    )
{
    EnumDesktops(OpenWindowStation(lpszWindowStation,FALSE, WINSTA_ALL_ACCESS),EnumDesktopProc, NULL );
    return true;
}
int main()
{
    Sleep(3000);
    g_hWnd = GetForegroundWindow(); //Here i switch to kaspersky window to get it's handle
    EnumWindowStations(EnumWindowStationProc, NULL);    //I call EnumDesktopWindows in EnumDesktops in EnumWindowStations to search in all HWND of my Operation System.
}

cout << "Found Window" 语句从未执行。

如果您能帮助我解决这个问题并向我展示激活此窗口的能力,我将不胜感激。

4

0 回答 0