- HWND hWnd = NULL;
- hWnd = ::FindWindow(_T("IEFrame"), NULL);
- if (hWnd)
- {
- HWND hWndChild = NULL;
- hWndChild = ::FindWindowEx(hWnd, 0, _T("Frame Tab"), NULL);
- if (hWndChild)
- {
- // tabbed
- hWndChild = ::FindWindowEx(hWndChild, 0, _T("TabWindowClass"), NULL);
- if (hWndChild)
- {
- ::PostMessage(hWndChild, WM_CLOSE, 0, 0);
- }
- }
- else
- {
- // not tabbed, close IE
- ::PostMessage(hWnd, WM_CLOSE, 0, 0);
- }
- }
* IEFrame = Top most IE
* Frame Tab = Tabs holder
* TabWindowsClass = Top most tab
* Frame Tab = Tabs holder
* TabWindowsClass = Top most tab

[PNG image (11.84 KB)]