帮忙指点一下InternetQueryOption的用法

lake_cx 2008-08-25 04:45:05
我想用它查询IE的代理服务器设置,但是用户名和密码拿不到,总是返回False,错误代码是ERROR_INTERNET_INCORRECT_HANDLE_TYPE

TCHAR szBuf[256];
DWORD dwSize = sizeof(szBuf);
InternetQueryOption(NULL, INTERNET_OPTION_PROXY_PASSWORD, szBuf, &dwSize);

使用INTERNET_OPTION_PROXY_USERNAME也拿不到用户名,我的IE版本是6.0.2900.2180.xpsp_sp2_rtm

同时问下用INTERNET_OPTION_PROXY拿到的是不是INTERNET_PROXY_INFO的数组?为什么会有好几个dwAccessType是乱七八糟的数值的?是不是我找到dwAccessType为INTERNET_OPEN_TYPE_PROXY的就行了?
...全文
868 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lake_cx 2008-08-25
  • 打赏
  • 举报
回复
沉得太快了,再顶下
lake_cx 2008-08-25
  • 打赏
  • 举报
回复
Scope of HINTERNET Handle

The HINTERNET handle used to set or retrieve Internet options determines the actions for which the options are valid.

These handles have three levels:


The root HINTERNET handle (created by a call to InternetOpen) would contain all the Internet options that affect this instance of WinINet.
HINTERNET handles that connect to a server (created by a call to InternetConnect)
HINTERNET handles that are associated with a resource or enumeration of resources on a particular server.
In addition to the various HINTERNET handles, an application can also use NULL to set or retrieve the default values of the Internet options used by Internet Explorer and the WinINet functions. Setting Internet options when using NULL as the handle changes the default values of the options, which are currently stored in the registry. Client applications should not use registry functions to change the default values of the Internet options, because the implementation of how the options are stored can be altered in the future.

The following table lists the type of HINTERNET handles and the scope of the Internet options associated with them.

Handle Type Scope
NULL The default option settings for Internet Explorer.
INTERNET_HANDLE_TYPE_CONNECT_FTP The option settings for this connection to an FTP server. These options affect any operations initiated from this HINTERNET handle, such as file downloads.
INTERNET_HANDLE_TYPE_CONNECT_GOPHER The option settings for this connection to a Gopher server. These options affect any operations initiated from this HINTERNET handle, such as file downloads.
INTERNET_HANDLE_TYPE_CONNECT_HTTP The option settings for this connection to an HTTP server. These options affect any operations initiated from this HINTERNET handle, such as file downloads.
INTERNET_HANDLE_TYPE_FILE_REQUEST The option settings associated with this file request.
INTERNET_HANDLE_TYPE_FTP_FILE The option settings associated with this FTP resource download.
INTERNET_HANDLE_TYPE_FTP_FILE_HTML The option settings associated with this FTP resource download formatted in HTML.
INTERNET_HANDLE_TYPE_FTP_FIND The option settings associated with this search of files on an FTP server.
INTERNET_HANDLE_TYPE_FTP_FIND_HTML The option settings associated with this search of files on an FTP server formatted in HTML.
INTERNET_HANDLE_TYPE_GOPHER_FILE The option settings associated with this Gopher resource download.
INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML The option settings associated with this Gopher resource download formatted in HTML.
INTERNET_HANDLE_TYPE_GOPHER_FIND The option settings associated with this search of files on an Gopher server.
INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML The option settings associated with this search of files on an Gopher server formatted in HTML.
INTERNET_HANDLE_TYPE_HTTP_REQUEST The option settings associated with this HTTP request.
INTERNET_HANDLE_TYPE_INTERNET The option settings associated with this instance of the WinINet functions.


an application can also use NULL to set or retrieve the default values of the Internet options used by Internet Explorer and the WinINet functions.
这句不是说可以用NULL来获取由Internet Explorer设置的“Internet 选项”的默认值?
zhb1190 2008-08-25
  • 打赏
  • 举报
回复
hInternet
[in] Handle on which to query information.

如一楼所说,要指明要查询谁的信息!
所以要指明句柄
吹泡泡的小猫 2008-08-25
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 Mackz 的回复:]
第一个参数要给出打开的连接句柄。
[/Quote]

要OpenInternet的句柄,如果这样就能拿到代理服务器的密码,那....
yyunffu 2008-08-25
  • 打赏
  • 举报
回复
对,一楼正解。
函数的目的是要查询当前连接中的属性,当然要指明句柄。
ygl1982820 2008-08-25
  • 打赏
  • 举报
回复
不会,study,帮忙LZ顶下
菜牛 2008-08-25
  • 打赏
  • 举报
回复
第一个参数要给出打开的连接句柄。

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧