用于在现有MFC应用程序中添加HTTP客户端支持的API? [英] What API to use for adding HTTP client support in an existing MFC app?

查看:177
本文介绍了用于在现有MFC应用程序中添加HTTP客户端支持的API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近获得的任务是添加与网络地图服务进行互动的功能一个现有的MFC应用程序,我需要一个客户端HTTP API。

I have recently been given a task to add the ability to interact with Web Map Services to an existing MFC application and I am in need of a client-side HTTP API.

根据我的研究,主要候选人似乎是 CAtlHttpClient WinHTTP 。我很想知道,如果有人有经验,他们可以分享或意见,这将是更好的方式(或建议其他完全)。

Based on my research, the leading candidates seem to be CAtlHttpClient and WinHTTP. I was curious to see if anyone had experiences they could share or opinions on which would be the better way to go (or suggestions for something else entirely).

乍一看,CAtlHttpClient似乎有点高一级,更容易使用。然而,在我的研究中,似乎任何时候人们有一个问题,不能用它做某事,答案是使用WinHTTP。

At first glance, CAtlHttpClient seems to be a bit higher level and easier to use. However, in my research it seemed that any time people had a problem with not being able to do something with it, the answer was "use WinHTTP".

结果

我使用WinHTTP结束,因为WinInet显示对话框,我们的应用程序可通过COM API使用。我避免了Ultimate TCP / IP,因为我为一家大公司工作,并获得第三方软件批准用于产品是一个完整的噩梦。

I wound up using WinHTTP because WinInet displays dialog boxes and our application is usable through a COM API. I avoided Ultimate TCP/IP because I work for a large company and getting third party software approved for use in a product is a complete nightmare.

推荐答案

最简单的是 WinInet MFC封装容器 CInternetSession 和朋友。

The simplest one is the WinInet MFC wrappers: CInternetSession and friends.

WinHTTP尽管是不同的API,但是建立在与WinInet相同的模型上,但提供了更好的HTTP支持(没有FTP,但你可能不在乎)。是否需要WinHTTP提供的额外好处应该检查。

WinHTTP, although a different API, is built on the same model as WinInet yet provides better HTTP support (no FTP though but you probably don't care). Whether you need the extra goodies provided by WinHTTP should be examined.

WinHTTP的一个缺点是ATL / MFC不提供包装器,而不是WinInet。

A down side of WinHTTP is that ATL/MFC don't provide wrappers for it, as opposed to WinInet.

正如Rob提到的, UltimateTCP 是一个很好的选择。它的一个优点是它是一个库:你链接代码到你的应用程序,从而消除DLL地狱潜在的问题。此外,它带有完整的源代码,如果你遇到执行的限制,这可能很方便。

And as Rob mentioned, UltimateTCP is a excellent alternative. One of its advantages is that it's a library: you link the code into your application, thereby eliminating DLL hell potential problems. Also, it comes with full source code which might be convenient if you run into a limitation of the implementation.

选择你自己!

这篇关于用于在现有MFC应用程序中添加HTTP客户端支持的API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆