// 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\n", 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;
}