C++/(Windows)IE 탭 종료


  1. HWND hWnd = NULL;
  2. hWnd = ::FindWindow(_T("IEFrame"), NULL);
  3. if (hWnd)
  4. {
  5.     HWND hWndChild = NULL;
  6.     hWndChild = ::FindWindowEx(hWnd, 0, _T("Frame Tab"), NULL);
  7.     if (hWndChild)
  8.     {
  9.         // tabbed
  10.         hWndChild = ::FindWindowEx(hWndChild, 0, _T("TabWindowClass"), NULL);
  11.         if (hWndChild)
  12.         {
  13.             ::PostMessage(hWndChild, WM_CLOSE, 0, 0);
  14.         }
  15.     }
  16.     else
  17.     {
  18.         // not tabbed, close IE
  19.         ::PostMessage(hWnd, WM_CLOSE, 0, 0);
  20.     }
  21. }

* IEFrame = Top most IE
* Frame Tab = Tabs holder
* TabWindowsClass = Top most tab

captureids.png
[PNG image (11.84 KB)]




이 글에는 0 개의 댓글이 있습니다.