• c++ 遍历任务栏窗口


    // ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
    //
    
    #include "stdafx.h"
    #include <Windows.h>
    #include <stdio.h>
    #include <locale.h>
    
    
    BOOL CALLBACK EnumTaskbarWnds( HWND hwnd, LPARAM lParam )
    {
        WCHAR szClass[256];
     
        if( !GetWindow( hwnd, GW_OWNER ) && IsWindowVisible( hwnd ) ) // 滤掉不在任务栏显示的窗口
            {
            GetClassName( hwnd, szClass, 256 );
            if( wcscmp( szClass, L"Shell_TrayWnd" ) != 0 // 滤掉任务栏本身
                && wcscmp( szClass, L"Progman" ) != 0 // 滤掉桌面
                ) 
                {
                    if(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW){
                        return true;
                    }
                //这就是你想要的窗口了。
     
                WCHAR szTitle[256];
                GetWindowText( hwnd, szTitle, 256 );
                wprintf( L"%s | %s
    ", szTitle, szClass ); 
                //ShowWindow(hwnd,SW_MINIMIZE);
                }//end if
            }//end if
     
        return TRUE;
    }
    const int TB_BUTTONCOUNT = WM_USER + 24;
    int _tmain(int argc, _TCHAR* argv[])
    {
        _wsetlocale(LC_ALL, L"chs");
        
        EnumWindows( EnumTaskbarWnds, NULL );
        scanf("stopaa");
        return 0;
    }
  • 相关阅读:
    笔记2-斐波那契数列
    笔记1-排序
    C++ 顶层const和底层const ?
    C++指针常量与常量指针的区别?
    C++指针和引用的区别?
    函数指针, 指针函数?
    手机横竖屏问题
    Swift
    Swift 渐变色
    Swift guard 关键字
  • 原文地址:https://www.cnblogs.com/wangjixianyun/p/3237338.html
Copyright © 2020-2023  润新知