Try this:
HWND prevWindow = NULL;
HWND hwnd;
for ( ;; )
{
hwnd = FindWindowEx( HWND_MESSAGE, prevWindow, L"OleMainThreadWndClass", NULL );
if ( !hwnd )
break;
if ( GetWindowThreadProcessId( hwnd, NULL ) == GetCurrentThreadId() )
break;
prevWindow = hwnd;
WCHAR className[255];
*className = 0;
::GetClassName( hwnd, className, 255 );
}
Let me know if it works.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…