By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,566 Members | 1,820 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,566 IT Pros & Developers. It's quick & easy.

convert to c#

P: n/a


Who can tell me how to convert the InternetSetOption in c#?

#include "Wininet.h"

#pragma comment(lib, "Wininet.lib")
static BOOL SetRegisterInfo(HKEY Key, LPCTSTR SubKey, LPCTSTR find, DWORD
set)

{
.....

}

void OnDisableWWW()

{

SetRegisterInfo(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)0);

SetRegisterInfo(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)0);
BOOL bProxy = 0;

bProxy = InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL,
0);

bProxy = InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0);

}

void OnEnableWWW()

{

SetRegisterInfo(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)1);

SetRegisterInfo(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)1);

BOOL bProxy = 0;

bProxy = InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL,
0);

bProxy = InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0);

}
Nov 15 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Maybe

Boolean InternetSetOption(IntPtr, UInt32, IntPtr, UInt32);

Haven't tested it though.
Zürcher See wrote:
Who can tell me how to convert the InternetSetOption in c#?

#include "Wininet.h"

#pragma comment(lib, "Wininet.lib")
static BOOL SetRegisterInfo(HKEY Key, LPCTSTR SubKey, LPCTSTR find, DWORD
set)

{
....

}

void OnDisableWWW()

{

SetRegisterInfo(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)0);

SetRegisterInfo(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)0);
BOOL bProxy = 0;

bProxy = InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL,
0);

bProxy = InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0);

}

void OnEnableWWW()

{

SetRegisterInfo(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)1);

SetRegisterInfo(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)1);

BOOL bProxy = 0;

bProxy = InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL,
0);

bProxy = InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0);

}


Nov 15 '05 #2

P: n/a
I haven't the winnet c library, there is a dll or class in c#?
"Antenna" <q1****************@hotmail.com> schrieb im Newsbeitrag
news:bv**********@news.worldonline.be...
Maybe

Boolean InternetSetOption(IntPtr, UInt32, IntPtr, UInt32);

Haven't tested it though.
Zürcher See wrote:
Who can tell me how to convert the InternetSetOption in c#?

#include "Wininet.h"

#pragma comment(lib, "Wininet.lib")
static BOOL SetRegisterInfo(HKEY Key, LPCTSTR SubKey, LPCTSTR find, DWORD set)

{
....

}

void OnDisableWWW()

{

SetRegisterInfo(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)0);

SetRegisterInfo(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)0);
BOOL bProxy = 0;

bProxy = InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL,
0);

bProxy = InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0);

}

void OnEnableWWW()

{

SetRegisterInfo(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)1);

SetRegisterInfo(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Int ernet Settings",
"ProxyEnable", (DWORD)1);

BOOL bProxy = 0;

bProxy = InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL,
0);

bProxy = InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0);

}

Nov 15 '05 #3

P: n/a
Is System.Net.GlobalProxySelection what you want? The System.Net
namespace contains everything you want to do Internet stuff.

The Select method sets the proxy that all HttpWebRequest instances use.
Nov 15 '05 #4

P: n/a
I can't use the HttpWebRequest, I have to use internet explorer
(AxInterop.SHDocVw.dll), it has been "asked" from our customer.
"Antenna" <q1****************@hotmail.com> schrieb im Newsbeitrag
news:bv**********@news.worldonline.be...
Is System.Net.GlobalProxySelection what you want? The System.Net
namespace contains everything you want to do Internet stuff.

The Select method sets the proxy that all HttpWebRequest instances use.

Nov 15 '05 #5

P: n/a
Ok, but why don't you just DllImport InternetSetOption() from wininet.dll?

[DllImport("wininet.dll")]
InternetSetOption(IntPtr, UInt32, IntPtr, UInt32);

Zürcher See wrote:
I can't use the HttpWebRequest, I have to use internet explorer
(AxInterop.SHDocVw.dll), it has been "asked" from our customer.
"Antenna" <q1****************@hotmail.com> schrieb im Newsbeitrag
news:bv**********@news.worldonline.be...
Is System.Net.GlobalProxySelection what you want? The System.Net
namespace contains everything you want to do Internet stuff.

The Select method sets the proxy that all HttpWebRequest instances use.



Nov 15 '05 #6

P: n/a
Ops, now I have found it, befor I looked for it but I haven't found it,
perhaps a type error

thanks

"Antenna" <q1****************@hotmail.com> schrieb im Newsbeitrag
news:bv**********@news.worldonline.be...
Ok, but why don't you just DllImport InternetSetOption() from wininet.dll?

[DllImport("wininet.dll")]
InternetSetOption(IntPtr, UInt32, IntPtr, UInt32);

Zürcher See wrote:
I can't use the HttpWebRequest, I have to use internet explorer
(AxInterop.SHDocVw.dll), it has been "asked" from our customer.
"Antenna" <q1****************@hotmail.com> schrieb im Newsbeitrag
news:bv**********@news.worldonline.be...
Is System.Net.GlobalProxySelection what you want? The System.Net
namespace contains everything you want to do Internet stuff.

The Select method sets the proxy that all HttpWebRequest instances use.


Nov 15 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.