Using VB6 I would like to block websites using the hosts file located on a PC. This requires that I open Notepad as Administrator and then open up the hosts.txt file from Notepad. Attached is an example of the hosts file that I need to open. As you can see, it has only comments in the file. However, to add a blocked site, requires adding the following line at the end.
The IP address will always be the same. The blocked domain name comes after the address.
Typically the hosts file is located at c:\windows\system32\driver
s\etc The only problem is that it can only be edited
in administrator mode
. So I would have to open NotePad as administrator and then open the file from Notepad in order for this to work. Unless you can think of any other ideas to do this.
Attached is a previous project in which this was done with a simalar file.