천객만래 [千客萬來] (It has an interminable succession of visitors)

'EnumChildWindows'에 해당되는 글 1건

  1. 2011.08.10 [개발/MFC] 탭브라우저에서 ActiveX가 포함된 웹페이지 핸들 찾기
// 탭브라우저에서 ActiveX가 포함된 웹페이지 핸들 찾기

BOOL CALLBACK EnumIEServer(HWND hwnd, LPARAM lParam)
{
    char szClassName[MAX_PATH];
    GetClassName(hwnd, szClassName, MAX_PATH-1);
    HWND *phWnd = (HWND *)lParam;

    if(strcmp(szClassName, "Internet Explorer_Server") == 0)
    {
        *phWnd = hwnd;
        return FALSE;
 }

 return TRUE;
}

HWND GetIEPage()
{
HWND hIEServer = NULL;
IServiceProvider* psp;
hr = m_pWeb->QueryInterface( IID_IServiceProvider, (void**)&psp );
 
if( SUCCEEDED(hr) && psp )  
{
 IOleWindow* pow; 
 psp->QueryService( SID_SShellBrowser, IID_IOleWindow, (void**)&pow ); 
 if( SUCCEEDED(hr) && pow)
 {   
   HWND hWnd = NULL; 
   hr = pow->GetWindow( &hWnd );
   if( SUCCEEDED(hr) && hWnd )
   {
  //hWnd is the handle of TabWindowClass 
  EnumChildWindows(hWnd, EnumIEServer, (LPARAM)&hIEServer);
   }
   pow->Release();  
 }
 psp->Release();                           
}
return hIEServer;
 }
Posted by SB패밀리