//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
No comments:
Post a Comment