Originally published on: Thu, 16 Jul 2009 03:24:17 +0000
Several years ago, popup ads began to plague my web-browsing experience. At the time, I used only IE as my browser, so I sought out a solution specifically for IE. I wrote a short C program that I called popnix. The version of popnix below is an early console-mode variant of the code. I later put a GUI on the program and gave it to a few friends who were quite happy with the results.
I should state that although this code was really targeted for IE 5 and 6, it still seems to work with version 7 even though IE now has its own blocking mechanisms. I haven't tried IE 8, yet.
Please note that popnix may not function properly if you're running with lower-level privileges as it tries to close an application that it did not invoke.
popnix.c
The code loops continuously, until interrupted with a CTRL-C or a CTRL-BREAK. At one-second intervals, popnix iterates through the list of top-level windows, looking for any with a classname of "IEFrame". If an IEFrame window is found and it's not the first IEFrame window found, popnix tries to remove the popup.
Popnix first displays a message, then invokes a sound via a call to MessageBeep(0), then it finally posts a WM_CLOSE message on the offending window's message queue.
Later versions had more features and were more flexible about allowing some popups but not others. The above reference version attempts to close all other IEFrame popup windows, even if they are "good" popups.
Unless otherwise noted, all code and text entries are Copyright ©2009 by James K. Lawless
Save to del.icio.us
Save to StumbleUpon
Digg it
Save to Reddit
Share on Facebook
Share on Twitter
More bookmarks
Subscribe!
Auto Save Clipboard Images Redux
Extending SpiderMonkey JavaScript on Windows
Rhino JavaScript to EXE with launch4j
Compiling Rhino JavaScript to Java
Directory Traversal in Rhino JavaScript
A Command-Line MP3 Player for Windows
Auto Save Images from the Clipboard
Java in a Windows EXE with launch4j
An Interview with Tom Zimmer: Forth System Developer
Setting Windows Console Text Colors in C
Changing the C64 Text Color in C
An Interview with Tom Zimmer: Forth System Developer
Scott Ballantyne: Blazin' Into Forth
Invoking the Default Windows Screen-Saver
Stacking Images with PerlMagick
MicroISV on a Shoestring
DadHacker
The Bottom Feeder
Writin' That Code!
The Recursive ISV
The Thomsen Blog
Prototypically Speaking
The Reinvigorated Programmer