I am trying to make it to where it will read the registry and report back if ProxyEnable is set to the value of 1. If it is, it replies back that the privacy is in risk, if not it says privacy is safe.

Here is my code. Any help with this would be much appreciated. Thanks!

Dim regkey2 As RegistryKey


        regkey2 = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")
        Dim proxyEnabled As String

        proxyEnabled = regkey2.GetValue("ProxyEnable").ToString()


        MsgBox("Proxy server is enabled. Your privacy is at risk!")

You can get the value as an integer by

Dim key As String = "HKEY_CURRENT_USER\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"
Dim proxyEnabled As Long = My.Computer.Registry.GetValue(key, "ProxyEnable", Nothing)

If proxyEnabled <> 0 Then
    MsgBox("Proxy server is enabled. Your privacy is at risk!")
End If

Thank you very much Reverend Jim. I appreciate it. So I assume the <> 0 Then means greater than or less than 0 then display that message? Am I reading your code correctly?

Edited 10 Months Ago by powerade661: Capitalization error

Jim, this doesn't seem to work. I enabled the proxy and it does not detect it as being enabled. Any ideas?

Yes. The <> 0 means greater to or less than (in other words, not equal to) zero. When you enable the proxy does the value of the registry item change to a non-zero value?

Edited 10 Months Ago by Reverend Jim

Ok umm now it's working. It could just be because I was debugging too soon. I don't really know why but it works fine now. Interesting... Sorry about that. Thank you for your help. :)

This question has already been answered. Start a new discussion instead.