1. On WindowsXP and upward one very easy way to achieve what you want would be to add entries to your hosts file to point certain domain names to localhost. See here:
http://answers.yahoo.com/question/index?qid=20080120053857AAqCQgE[
^].
There is no need to reboot since upward from Windows9x the changes are immediate. It might be nescessary to resart IE since I've read somewhere that IE caches name lookups.
Remember though that his will block the whole domain. It is not possible to only block certain applications or websites that live under that domain.
2. Use a proxy on your machine and preferably one written in Java. You can easily make some modifications so it can react to messages sent from your application to block or unblock a certain URL. Here a nice list of Open Source Proxies that are all written in Java:
http://proxies.xhaus.com/java/[
^]
Regards,
Manfred