mac_shinobi Posted December 19, 2011 Posted December 19, 2011 (edited) Change Proxy Without Having to Restart Internet Explorer - VBForums The above has the code for vb 6 but with the Private Type's being changed to Private Structure's and not using vbUnicode etc I am getting a bit confused Also this example : http://runegear.net/showthread.php?tid=5570 But the Marshal Side of things is not working Edited December 19, 2011 by mac_shinobi
Steve21 Posted December 19, 2011 Posted December 19, 2011 (edited) What's the actual question? Bit confused. Edit - I'm assuming you're asking why isn't a type a structure? If so, it depends what you're coding in. vb6 = type, vb.net = structure. "Basically" same thing though. Edit 2 - vb6 Private Type INTERNET_PER_CONN_OPTION dwOption As Long dwValue1 As Long dwValue2 As Long End Type vb.net Structure INTERNET_PER_CONN_OPTION Dim dwOption As Long Dim dwValue1 As Long Dim dwValue2 As Long End Structure etc Steve Edited December 19, 2011 by Steve21
mac_shinobi Posted December 19, 2011 Author Posted December 19, 2011 Just want to get it working in vb .net 2010 and in 2010 it is trying to make each one private, public etc Structure INTERNET_PER_CONN_OPTION private dwOption As Long private dwValue1 As Long private dwValue2 As Long End Structure Presume it would be better to get the first example working as think this is the correct method, not doing it short handed as per the 2nd link which is using the wininet.dll file's functions.
Steve21 Posted December 19, 2011 Posted December 19, 2011 Just want to get it working in vb .net 2010 and in 2010 it is trying to make each one private, public etc vb6 isn't .NET though. Different language "as such". You will need to change a lot of things, as things like "type" don't exist anymore in vb.net, it's all changed. In .NET it's structures, and it "has" to have a "type", aka public or private etc. If you just "dim" it, it'll be public by default, or as I did before add private etc Steve
mac_shinobi Posted December 19, 2011 Author Posted December 19, 2011 will play around with it over the next week or so as will need to google how to use structures instead of types and muck around with it a bit. Will drop you a pm if I have any questions etc, if that is ok ?
Steve21 Posted December 19, 2011 Posted December 19, 2011 will play around with it over the next week or so as will need to google how to use structures instead of types and muck around with it a bit. Will drop you a pm if I have any questions etc, if that is ok ? No prob at all. Is it basically just changing IE proxy, without reloading IE you're looking at? Steve
mac_shinobi Posted December 19, 2011 Author Posted December 19, 2011 No prob at all. Is it basically just changing IE proxy, without reloading IE you're looking at? Steve To start with yes
Arthur Posted December 19, 2011 Posted December 19, 2011 Would this be of any use to you @mac_shinobi? Set and unset the Windows Internet Settings Proxy. Works instantly on already running apps like IE « Huddled Masses 1
mac_shinobi Posted December 20, 2011 Author Posted December 20, 2011 Would this be of any use to you @mac_shinobi ? Set and unset the Windows Internet Settings Proxy. Works instantly on already running apps like IE « Huddled Masses Only if I try and code it in c# , otherwise I am still stuck trying to convert the code. I suppose I could try c sharp instead of vb.net
mac_shinobi Posted December 20, 2011 Author Posted December 20, 2011 Would this be of any use to you @mac_shinobi ? Set and unset the Windows Internet Settings Proxy. Works instantly on already running apps like IE « Huddled Masses Does the massive chunk of code go into a module and the 2 functions to set and remove the proxy settings go into the same chunk of code outside of the button click events etc ( within the main class ) you then call these from within the button click event etc ?
Arthur Posted December 20, 2011 Posted December 20, 2011 The example above is a PowerShell script which compiles the C# code contained in PoshHttp.Proxies.cs straight into memory when it is executed. Set-Proxy and Remove-Proxy are then exported as functions into your PowerShell session. You don't necessarily have to use the PowerShell part of the script though. What exactly are you trying to do?
mac_shinobi Posted December 21, 2011 Author Posted December 21, 2011 The example above is a PowerShell script which compiles the C# code contained in PoshHttp.Proxies.cs straight into memory when it is executed. Set-Proxy and Remove-Proxy are then exported as functions into your PowerShell session. You don't necessarily have to use the PowerShell part of the script though. What exactly are you trying to do? I don't always use internet explorer and although chrome relies on IE settings, it does not work correctly at work and thus use firefox. Basically I wanted to make my own proxy switch utility that I could use on my work desktop so that I could just right click on a system tray icon -> set my own proxies up and have each of these proxies appear in the right click pop up menu so I can easily switch between them and set firefox to use IE settings ( system settings ) and then I can adjust these by changing the IE settings on the fly in the system tray I can play around with this over the christmas period.
Steve21 Posted December 21, 2011 Posted December 21, 2011 I don't always use internet explorer and although chrome relies on IE settings, it does not work correctly at work and thus use firefox. Basically I wanted to make my own proxy switch utility that I could use on my work desktop so that I could just right click on a system tray icon -> set my own proxies up and have each of these proxies appear in the right click pop up menu so I can easily switch between them and set firefox to use IE settings ( system settings ) and then I can adjust these by changing the IE settings on the fly in the system tray I can play around with this over the christmas period. The thing is (as far as I know), majority of browsers only load reg settings at the loading point of them. Thus some of the older vb6 versions etc are using old .dll's which force the browser to refresh settings (aka reload the registry). The issue you'll have is will FF/Chrome etc reload the registry settings even if you change them? If not, it might be easier just to change settings, and make the program auto reload the browser? (Or do you need it to stay open for some reason?) Will try to have a play around later, and see what I can do if you want Steve 1
Arthur Posted December 21, 2011 Posted December 21, 2011 although Chrome relies on IE settings, it does not work correctly at work and thus use Firefox. Probably of no use whatsoever, but you can set Chrome's proxy via the command-line. "%UserProfile%\AppData\Local\Google\Chrome\Application\chrome.exe" --proxy-server http://proxy.domain.com:8080 1
mac_shinobi Posted December 21, 2011 Author Posted December 21, 2011 Will try to have a play around later, and see what I can do if you want Steve That would be great - thanks. I was just thinking instead of having 2 registry files and a batch file etc and naming them home, work and then merging those to the registry it would be nice to have a centered form where you have a list box and upon selecting each of the proxies which are shown as a name then it will load the relevant proxy settings into two text fields to start with ie Proxy_One Proxy_Two Proxy_Three If you select Proxy_One it then loads the server / ip address into text field one and the port into text field two which you can adjust / change and click save. Not sure on the best method of saving the proxy settings ie to an ini file / text file or to the registry and if to the registry then where abouts in the registry ? I was hoping to add the options for : * Manually setting a proxy * Using a pac file * Being able to use authentication on a proxy server etc and possibly some other things but I just wanted the basic manual proxy setting and it being able to save / edit the proxy settings and being able to re call the settings that were last saved
Arthur Posted December 21, 2011 Posted December 21, 2011 You might also be interested in @painejake's Proxy Switch program. It is written in C# and the source code is available here. Btw, do you still use Advanced Proxy Manager? I assume you want to create something similar?
mac_shinobi Posted December 21, 2011 Author Posted December 21, 2011 You might also be interested in @painejake 's Proxy Switch program. It is written in C# and the source code is available here. Btw, do you still use Advanced Proxy Manager? I assume you want to create something similar? Not yet - although that does look good ( Advanced Proxy Manager ), will look at Proxy Switch in a bit Would be nice to make something and go through the code to see what it does etc
Arthur Posted December 21, 2011 Posted December 21, 2011 APM is also written in C# and the source is browsable online here. Only reason I thought I would mention it was due to this EduGeek thread from 2007. 1
Steve21 Posted December 23, 2011 Posted December 23, 2011 That would be great - thanks. I was just thinking instead of having 2 registry files and a batch file etc and naming them home, work and then merging those to the registry it would be nice to have a centered form where you have a list box and upon selecting each of the proxies which are shown as a name then it will load the relevant proxy settings into two text fields to start with ie It's only an "extremely" rough version, to see if I understood what you mean, but something like my attached exe? (Note, Not much error checking etc, and only tested it on IE) TestProxyChanger.zip Basically it loads a set of proxies from registry (and the one you have currently set in IE), you can type whatever you want it, Hit load and it'll set IE + Change without reload. Not done any saving back to reg yet etc, just wanted to see if that was what you meant. Thanks, Steve
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now