QuestionSolvedProxy Source/Program

Posts 14 of 4 · Page 1 of 1
Proxy Source/Program
Hello MPGH member! I need a proxy source/program that change the ip on all programs or just a specified process.
the program will auto load a proxy from a txt file from de internet and it will change your IP for the process (not the proxy program another program)
i want it as a single exe file or a bult in file so i can but it in to anoter vb.net program.
if you know a source or can help me i can give you credits in the program called "MineCafe" http://www.mpgh.net/forum/411-minecr...-minecafe.html
please make a comment or send me a pm.
Thanks!
Add this class to your program:

Code:
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Public Class ProxyChanger
    <DllImport("wininet.dll")> _
    Public Shared Function InternetSetOption(hInternet As IntPtr, dwOption As Integer, lpBuffer As IntPtr, dwBufferLength As Integer) As Boolean
    End Function
    Public Const INTERNET_OPTION_SETTINGS_CHANGED As Integer = 39
    Public Const INTERNET_OPTION_REFRESH As Integer = 37
    Public Function SetProxy(Server As String, Port As String) As Boolean
        Dim RKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
        RKey.SetValue("ProxyServer", Server + ":" + Port)
        InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0)
        InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0)
        RKey.SetValue("ProxyEnable", 1)
        Dim IsEnabled As Boolean = False
        If Not RKey.GetValue("ProxyEnable") = 0 Then
            IsEnabled = True
        End If
        Return IsEnabled
    End Function
    Public Function DisableProxy() As Boolean
        Dim RKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
        RKey.SetValue("ProxyEnable", 0)
        Dim Result As Boolean = False
        If RKey.GetValue("ProxyEnable") = 0 Then
            Result = True
        End If
        Return Result
    End Function
    Public Function EnableProxy() As Boolean
        Dim RKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
        RKey.SetValue("ProxyEnable", 1)
        Dim Result As Boolean = False
        If Not RKey.GetValue("ProxyEnable") = 0 Then
            Result = True
        End If
        Return Result
    End Function
    Public Function IsProxyEnabled() As Boolean
        Dim RKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
        Dim Result As Boolean = True
        If RKey.GetValue("ProxyEnable") = 0 Then
            Result = False
        End If
        Return Result
    End Function
End Class
Create a new instance of this class from your program and call the functions to Set / Disable proxy:

Code:
Dim PChanger As New ProxyChanger
If PChanger.SetProxy("192.11.23.12", "6969") Then
MsgBox("Proxy Changed And Enabled")
Else
MsgBox("Unable To Change Proxy")
End If
Disable the proxy like this:
Code:
PChanger.DisableProxy()
Quote Originally Posted by Hassan View Post
Add this class to your program:

Code:
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Public Class ProxyChanger
    <DllImport("wininet.dll")> _
    Public Shared Function InternetSetOption(hInternet As IntPtr, dwOption As Integer, lpBuffer As IntPtr, dwBufferLength As Integer) As Boolean
    End Function
    Public Const INTERNET_OPTION_SETTINGS_CHANGED As Integer = 39
    Public Const INTERNET_OPTION_REFRESH As Integer = 37
    Public Function SetProxy(Server As String, Port As String) As Boolean
        Dim RKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
        RKey.SetValue("ProxyServer", Server + ":" + Port)
        InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0)
        InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0)
        RKey.SetValue("ProxyEnable", 1)
        Dim IsEnabled As Boolean = False
        If Not RKey.GetValue("ProxyEnable") = 0 Then
            IsEnabled = True
        End If
        Return IsEnabled
    End Function
    Public Function DisableProxy() As Boolean
        Dim RKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
        RKey.SetValue("ProxyEnable", 0)
        Dim Result As Boolean = False
        If RKey.GetValue("ProxyEnable") = 0 Then
            Result = True
        End If
        Return Result
    End Function
    Public Function EnableProxy() As Boolean
        Dim RKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
        RKey.SetValue("ProxyEnable", 1)
        Dim Result As Boolean = False
        If Not RKey.GetValue("ProxyEnable") = 0 Then
            Result = True
        End If
        Return Result
    End Function
    Public Function IsProxyEnabled() As Boolean
        Dim RKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", True)
        Dim Result As Boolean = True
        If RKey.GetValue("ProxyEnable") = 0 Then
            Result = False
        End If
        Return Result
    End Function
End Class
Create a new instance of this class from your program and call the functions to Set / Disable proxy:

Code:
Dim PChanger As New ProxyChanger
If PChanger.SetProxy("192.11.23.12", "6969") Then
MsgBox("Proxy Changed And Enabled")
Else
MsgBox("Unable To Change Proxy")
End If
Disable the proxy like this:
Code:
PChanger.DisableProxy()
Okey, Thanks ^^ you want credits in minecafe? pm me name + link you want.
Quote Originally Posted by maxkaxx View Post
Okey, Thanks ^^ you want credits in minecafe? pm me name + link you want.
No, it's fine.
Marked solved. No more posting.
Posts 14 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

Need help?