如何检查VC ++中是否存在链接? [英] How to check if a link exists or not in VC++?

查看:199
本文介绍了如何检查VC ++中是否存在链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个链接。我已通过正则表达式检查该链接是否为有效的网址。现在,我想检查链接是否是有效的http链接。即它不应该是不存在的链路。
有一种方法在VC ++ 6.0(MFC)检查?

I have a link. I have checked that the link is a valid URL through regular expressions. Now, I want to check if the link is a valid http link or not. i.e. it should not be a non-existing link. Is there a way in VC++ 6.0 (MFC) to check that?

推荐答案

一个选择是试图获得来自该URL的数据,方法是使用 URLOpenBlockingStream函数

One option is to try to get data from that URL by using the URLOpenBlockingStream function.

示例:

IStream* pStream = NULL;
if (SUCCEEDED(URLOpenBlockingStream(0, "URL string", &pStream, 0, 0))) {
    // Release the stream immediately since we don't use the data.
    pStream->Release();
    return TRUE;
}
else {
    return FALSE;
}

这篇关于如何检查VC ++中是否存在链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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