请问怎么在IE控件中使用代理时屏蔽弹出的用户名与密码输入对话框

请教如何在IE控件中使用代理时屏蔽弹出的用户名与密码输入对话框
现在我需要使用IE控件(WebBrowser)通过Navigate2方法访问页面,而且需要支持代理.代理设置现在是已经设置进去了,但就是用户名和密码无法在程序中设置进去,总是弹出对话框提示输入用户名和密码.我现在想把这个对话框去掉,请问各位有什么好办法没有?

我自己找了下,有两种方法,一个是利用IAuthenticate Interface中的Authenticate方法;
另一个是自己组装出Proxy-Authorization头,对passwd与username进行base64编码,再在Navigate2时把组装好的Http request header加进去.
这两种方法都是可行的,但是有个问题,就是这两种方法都只能用于Basic认证.
MSDN中,对IAuthenticate::Authenticate Method明确提到:
The default user interface can handle any authentication schemes recognized by the Microsoft® Win32® Internet API. Currently, the user name and password options handle only the Basic authentication scheme.

通过自己加Http header的方法,不能覆盖除basic认证以外的认证.

所以请教大家,有没有什么好办法,可以再不弹出代理用户名输入框的情况下对IE控件设置代理用的用户名与密码,而且能够适用于利用其它认证如NTLM认证的代理服务器?

另外,有什么有效的办法是可以将WinInet和Webbrowser联系起来的? 我原来想过利用WinInet的InternetSetOption函数传递INTERNET_OPTION_PROXY_USERNAME来完成这一功能,但是无法获得对应的HINTERNET句柄,也不能传递NULL.  
还一个疑惑是,WinInet通过InternetSetOption设置的用户名与密码应该不仅限于Basic认证的代理服务器吧? 那么底层又会通过什么方法来适应不同的认证方法呢?

------解决方案--------------------
InternetSetOption中的HINTERNET可以使NULL
------解决方案--------------------
学习了,lz搞定没,搞定了说下方法
------解决方案--------------------

//To pass a doamin as in a NTLM authentication scheme, use this format: Username = Domain\username
int IAuthenticate.Authenticate(ref IntPtr phwnd, ref IntPtr pszUsername, ref IntPtr pszPassword)
{
int hr = Hresults.E_ACCESSDENIED; //to abort, to proceed Hresults.S_OK
int iRet = hr; //Assume failure
phwnd = this.Handle;
pszUsername = IntPtr.Zero;
pszPassword = IntPtr.Zero;
if (WBAuthenticate != null)
{
AuthenticateEvent.SetParameters();
WBAuthenticate(this, AuthenticateEvent);
if (AuthenticateEvent.handled == true)
{
//Marshal.StringToCoTaskMemAuto
pszUsername = Marshal.StringToCoTaskMemUni(AuthenticateEvent.username);
pszPassword = Marshal.StringToCoTaskMemUni(AuthenticateEvent.password);
iRet = AuthenticateEvent.retvalue; //Should be 0
}
//Reset
AuthenticateEvent.SetParameters();
//accepted return values
if ((iRet == Hresults.S_OK) || (iRet == Hresults.E_INVALIDARG) || (iRet == Hresults.E_ACCESSDENIED))
hr = iRet;
}
return hr;
}

http://csexwb2.googlecode.com/svn/trunk/cEXWB.cs

------解决方案--------------------
关注,学习
------解决方案--------------------
HOOK截取那个窗口就行了