Chinaunix

标题: 关于定义的获取HTTP:// [打印本页]

作者: ooko    时间: 2005-05-20 04:29
标题: 关于定义的获取HTTP://
从命令行窗体中获取http://开头 做为自动分别是URL的问题
if (http1==-1){
http1=m_MouseIn.Find("http://";
}else {
nType=1; //是URL
off=0;

}
switch (nType) {
        case 4: //下面的、。是判断停止的,这里出问题了
                http2=m_szMouseInLine.Find(' ',http1);
                if (http2==-1) {
                        http2=m_szMouseInLine.Find("、",http1);
                }
                if (http2==-1) {
                        http2=m_szMouseInLine.Find("。",http1);
                }
                if (http2==-1) {
                        http2=m_szMouseInLine.GetLength()-1;               
                }
                break;

}
        if (http2!=-1&&x>;=http1&&x<=http2) {
                m_LinkURL=m_szMouseInLine.Mid(http1+off,http2-http1-off);
                if (m_LinkURL.Find(',')==-1&&m_LinkURL.Find(","==-1) {
                        m_LinkURL.MakeLower();
                        ::SetCursor(m_hLinkCursor);
                        m_bAtURL=nType+1;

判断当http://后面含有空格、。
不包含
现在的问题是
如显示
http://
可正常点击
http://、http://
这样的话后面的就无效了。 只有当换巷后才起作用。我想让他们在同一行都能起作用。请指教




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2