globefun.cpp

来自「深入浅出Visual C++入门进阶与应用实例 随书光盘 作者 何志丹」· C++ 代码 · 共 50 行

CPP
50
字号


#include "stdafx.h"
#include "GlobeFun.h"

extern "C" CString GetTextWithHtmlLink(CString strText,CString strUrl)
{
	CString strRet ;
	strRet.Format("<p><font COLOR=\"#0000ff\" face=\"宋体\" size=\"2\"><a href=%s title=%s target=\"_blank\">%s</a></font></p>",strUrl,strText,strText);
	return strRet;
}

extern "C" CString GetQMD()
{
	CString strTextWithLink ;
	
	//读取签名档
	CString strFileName = GetExePath() + "QMD.txt" ;
	try
	{
		CFile file(strFileName,CFile::modeRead);		
		int nLength = file.GetLength() ;
		char * pFileData = new char[nLength + 1];
		memset(pFileData,0,nLength+1);
		file.ReadHuge(pFileData,nLength);
		if(nLength < 3000 )
		{	
			CArticleElements arEle ;
			arEle = pFileData ;
			strTextWithLink = arEle.MakeTextWithCurBBSFormat() ;
		}
		else
			AfxMessageBox("签名档的内容必须少于3000字符。");
		delete [] pFileData ;
		file.Close();
	}
	catch(CFileException * e)
	{
		ASSERT(false);
		e->m_cause ;
	}
	
	return strTextWithLink;
}

extern "C" CString GetConfigurationfileName()
{
	CString strFileName = GetExePath() + "config.ini" ;
	return strFileName ;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?