Member Avatar for powerade661

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!")

Recommended Answers

All 7 Replies

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
Member Avatar for powerade661

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?

Member Avatar for powerade661

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?

Member Avatar for powerade661

Yes it does. I don't understand why it's not working..

Member Avatar for powerade661

This is what it says. Capture3.PNG

Member Avatar for powerade661

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. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.