none
WIN10无法使用winhttp.dll RRS feed

  • 问题

  • 严重性 代码 说明 项目 文件 禁止显示状态
    错误 C1083 无法打开类型库文件: “c:\windows\system32\winhttp.dll”: 加载类型库/DLL 时出错。 Black_Minecraft d:\cpp\project\black_minecraft\black_minecraft\winhttprequest.h 1

    win10版本是14393,在win8下编译通过,为什么win10就不行呢?

    #import "C:\\Windows\\System32\\winhttp.dll" no_namespace
    
    
    class CWinHttpRequest : public COleDispatchDriver
    {
    public:
    	CWinHttpRequest(){}
    	CWinHttpRequest(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
    	CWinHttpRequest(const CWinHttpRequest& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
    
    public:
    
    	
    public:
    
    
    	
    public:
    	void SetProxy(long ProxySetting, VARIANT& ProxyServer, VARIANT& BypassList)
    	{
    		static BYTE parms[] = VTS_I4 VTS_VARIANT VTS_VARIANT ;
    		InvokeHelper(0xd, DISPATCH_METHOD, VT_EMPTY, NULL, parms, ProxySetting, &ProxyServer, &BypassList);
    	}
    	void SetCredentials(LPCTSTR UserName, LPCTSTR Password, long Flags)
    	{
    		static BYTE parms[] = VTS_BSTR VTS_BSTR VTS_I4 ;
    		InvokeHelper(0xe, DISPATCH_METHOD, VT_EMPTY, NULL, parms, UserName, Password, Flags);
    	}
    	void Open(LPCTSTR Method, LPCTSTR Url, VARIANT& Async)
    	{
    		static BYTE parms[] = VTS_BSTR VTS_BSTR VTS_VARIANT ;
    		InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, parms, Method, Url, &Async);
    	}
    	void SetRequestHeader(LPCTSTR Header, LPCTSTR Value)
    	{
    		static BYTE parms[] = VTS_BSTR VTS_BSTR ;
    		InvokeHelper(0x2, DISPATCH_METHOD, VT_EMPTY, NULL, parms, Header, Value);
    	}
    	CString GetResponseHeader(LPCTSTR Header)
    	{
    		CString result;
    		static BYTE parms[] = VTS_BSTR ;
    		InvokeHelper(0x3, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, Header);
    		return result;
    	}
    	CString GetAllResponseHeaders()
    	{
    		CString result;
    		InvokeHelper(0x4, DISPATCH_METHOD, VT_BSTR, (void*)&result, NULL);
    		return result;
    	}
    	void Send(VARIANT& Body)
    	{
    		static BYTE parms[] = VTS_VARIANT ;
    		InvokeHelper(0x5, DISPATCH_METHOD, VT_EMPTY, NULL, parms, &Body);
    	}
    	long get_Status()
    	{
    		long result;
    		InvokeHelper(0x7, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
    		return result;
    	}
    	CString get_StatusText()
    	{
    		CString result;
    		InvokeHelper(0x8, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
    		return result;
    	}
    	CString get_ResponseText()
    	{
    		CString result;
    		InvokeHelper(0x9, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
    		return result;
    	}
    	VARIANT get_ResponseBody()
    	{
    		VARIANT result;
    		InvokeHelper(0xa, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL);
    		return result;
    	}
    	VARIANT get_ResponseStream()
    	{
    		VARIANT result;
    		InvokeHelper(0xb, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, NULL);
    		return result;
    	}
    	VARIANT get_Option(long Option)
    	{
    		VARIANT result;
    		static BYTE parms[] = VTS_I4 ;
    		InvokeHelper(0x6, DISPATCH_PROPERTYGET, VT_VARIANT, (void*)&result, parms, Option);
    		return result;
    	}
    	void put_Option(long Option, VARIANT& newValue)
    	{
    		static BYTE parms[] = VTS_I4 VTS_VARIANT ;
    		InvokeHelper(0x6, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, Option, &newValue);
    	}
    	BOOL WaitForResponse(VARIANT& Timeout)
    	{
    		BOOL result;
    		static BYTE parms[] = VTS_VARIANT ;
    		InvokeHelper(0xf, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms, &Timeout);
    		return result;
    	}
    	void Abort()
    	{
    		InvokeHelper(0xc, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
    	}
    	void SetTimeouts(long ResolveTimeout, long ConnectTimeout, long SendTimeout, long ReceiveTimeout)
    	{
    		static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 VTS_I4 ;
    		InvokeHelper(0x10, DISPATCH_METHOD, VT_EMPTY, NULL, parms, ResolveTimeout, ConnectTimeout, SendTimeout, ReceiveTimeout);
    	}
    	void SetClientCertificate(LPCTSTR ClientCertificate)
    	{
    		static BYTE parms[] = VTS_BSTR ;
    		InvokeHelper(0x11, DISPATCH_METHOD, VT_EMPTY, NULL, parms, ClientCertificate);
    	}
    	void SetAutoLogonPolicy(long AutoLogonPolicy)
    	{
    		static BYTE parms[] = VTS_I4 ;
    		InvokeHelper(0x12, DISPATCH_METHOD, VT_EMPTY, NULL, parms, AutoLogonPolicy);
    	}
    
    	
    public:
    
    };
    


    2016年10月4日 14:00

答案

全部回复

  • Hi,

    你确定路径是对的?在win10 的环境下面。

    你尝试过使用 raw_interfaces_only:

    #import "..\drawctl\drawctl.tlb" no_namespace, raw_interfaces_only

    这儿有相信的使用说明https://msdn.microsoft.com/en-us/library/8etzzkb6.aspx

    你有clean up 工程,再去编译吗?

    我在我的电脑上面发现了好多这个文件,不知道文件是否一样。

    Best Regards,

    Hart


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    2016年10月5日 3:30
    版主
  • 谢谢你的回答,问题已经解决。

    windows10中已经把com版winhttp.dll改成winhttpcom.dll了。

    • 已建议为答案 ThankfulHeart 2016年10月6日 8:10
    • 已标记为答案 Baron Bi 2016年10月24日 6:06
    2016年10月6日 4:55
  • 谢谢你的回答,问题已经解决。

    windows10中已经把com版winhttp.dll改成winhttpcom.dll了。

    问题解决了,根据MSDN的政策,请mark你的case。

    Best Regards,

    Hart


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    2016年10月7日 4:26
    版主