I want to make an IE hook, that will silently block some sites.
C++, Win32, Dev-C++
Printable View
I want to make an IE hook, that will silently block some sites.
C++, Win32, Dev-C++
I've made a few of those (doesn't really "hook" though).
Code:#define WIN32_LEAN_AND_MEAN
#define MAX_STRING 1000
#include <windows.h>
#include <imm.h>
char tempString[MAX_STRING];
int tempNumber;
bool tee = true;
int i;
bool inline CheckItOut(HWND hwnd)
{
HWND wND = FindWindowEx(
FindWindowEx(
FindWindowEx(
FindWindowEx(
FindWindowEx(
hwnd,
0,
"WorkerW",
0),
0,
"ReBarWindow32",
0),
0,
"ComboBoxEx32",
0),
0,
"ComboBox",
0),
0,
"Edit",
0);
ZeroMemory(&tempString, sizeof(tempString));
SendMessage(wND,WM_GETTEXT,MAX_STRING,(LPARAM)tempString);
for(i = 0; i < strlen(tempString); i++){
if((tempString[i] == 'b') || (tempString[i] == 'B')){
if((tempString[i+1] == 'u') || (tempString[i+1] == 'U')){
if((tempString[i+2] == 'd') || (tempString[i+2] == 'D')){
tempString[i+1] = 'o';
tempString[i+2] = 'o';
tempString[i+3] = 'b';
tempString[i+4] = ' ';
SendMessage(wND,WM_SETTEXT,0,(LPARAM)tempString);
SetFocus(wND);
SendMessage(wND,WM_IME_KEYDOWN,VK_RETURN,0);
Sleep(50);
SendMessage(wND,WM_IME_KEYUP,VK_RETURN,0);
return true; } } } }
return false;
}
int inline NumberChildren(HWND);
BOOL CALLBACK inline xEnumChildProc( HWND hwnd, LPARAM lParam )
{
ZeroMemory(&tempString, sizeof(tempString));
GetWindowText(hwnd, tempString, MAX_STRING);
tempNumber = strlen(tempString);
if((tempString[tempNumber-29] == '-') && (tempString[tempNumber-1] == 'r'))
CheckItOut(hwnd);
int* count = (int*)lParam;
(*count)++;
return TRUE;
}
int inline NumberChildren(HWND Xhwnd)
{
int count = 0;
EnumChildWindows(Xhwnd, xEnumChildProc, (LPARAM)&count);
return count;
}
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
for(;;)
{
NumberChildren(HWND_DESKTOP);
if(GetAsyncKeyState(VK_F6) && GetAsyncKeyState(VK_F12))
break;
Sleep(50);
}
Beep(2000,150);
Beep(1800,150);
Beep(2000,150);
Beep(1800,150);
Sleep(100);
Beep(2200,100);
Sleep(50);
Beep(2200,100);
Sleep(50);
Beep(2200,100);
return 0;
}
Wow... this is nice!
Nice maybe - but not good enough.
I made it too keep my brother from downloading a certain game. He would have thought it was
the site, and never suspected any thing if it wasn’t for the fact that the address bar "magically
changed on it’s own".
Actually it doesn't block the site if you go there with an Explorer window.
I want the program to monitor IE (including Explorer window) and Firefox windows and if a certain domain (or IP address) is accessed, forward to another web page.