//Code to Click Internt Explorer Security warning Dialog Box Automatically
BOOL g_bStopDialogWatcherThread = FALSE; // To Stop & start Thread
UINT WindowWatcher(LPVOID lpParam)
{
g_bStopDialogWatcherThread = FALSE;
while(1)
{
Sleep(300);
HWND hWnd;
HWND hWndWarning = ::FindWindow(NULL,"Internet Explorer");
hWnd=::FindWindowEx(hWndWarning , NULL , "Button","&Yes" );
if(hWnd!=NULL && hWndWarning!=NULL)
{
::SetForegroundWindow(hWndWarning);
::SetFocus(hWnd);
::PostMessage ( hWnd , WM_LBUTTONDOWN , 0 , 0 );
::PostMessage ( hWnd , WM_LBUTTONUP , 0 , 0 );
Sleep(1000);
}
if(g_bStopDialogWatcherThread)
{
break;
}
}
return 1;
}
AfxBeginThread(WindowWatcher,THREAD_PRIORITY_NORMAL,0,0,0);//to start the thread
Search This Blog
Showing posts with label Internet explorer. Show all posts
Showing posts with label Internet explorer. Show all posts
Saturday, February 7, 2009
Thursday, January 1, 2009
Getting all Titles in Internet explorer running instance using COM
#import "mshtml.tlb" // Internet Explorer 5
#include "msHtml.h"
#include "ExDispID.h"
#import "shdocvw.dll"
#include "ExDisp.h"
void CIETabTiltleDlg::OnBnClickedOk() // Copy the following lines
{
SHDocVw::IShellWindowsPtr m_spSHWinds;
m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows));
ASSERT(m_spSHWinds != NULL);
CString strCount,m_strWinCount;
long nCount = m_spSHWinds->GetCount();
strCount.Format("%i", nCount);
m_strWinCount = strCount;
IDispatchPtr spDisp;
for (long i = 0; i <>
{
_variant_t va(i, VT_I4);
spDisp = m_spSHWinds->Item(va);
SHDocVw::IWebBrowser2Ptr spBrowser(spDisp);
if (spBrowser != NULL)
{
//m_ctlListLoc is the name of list box of your application
//m_ctlListLoc is the name of list box of your application
m_ctlListLoc.AddString(spBrowser->GetLocationName());
MSHTML::IHTMLDocument2Ptr spDoc(spBrowser->GetDocument());
if (spDoc != NULL)
{
//m_ctlListTitle is the name of list box of your application
//m_ctlListTitle is the name of list box of your application
m_ctlListTitle.AddString(spDoc->Gettitle());
}
}
}
m_spSHWinds=NULL;
}
Subscribe to:
Posts (Atom)