⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 publicfunc.cpp

📁 iocp vc例子,自己是学DELPHI
💻 CPP
字号:
// PublicFunc.cpp: implementation of the CPublicFunc class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "PublicFunc.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CPublicFunc::CPublicFunc()
{
}

CPublicFunc::~CPublicFunc()
{
}

CString CPublicFunc::GetFullPathOfFile(CString strFileName)
{
	CString strRet;
	TCHAR szPath[MAX_PATH];
	if (GetModuleFileName(NULL, szPath, MAX_PATH)>0)
		strRet = szPath;
	int nPos=strRet.ReverseFind('\\');
	if (nPos>0) strRet = strRet.Left(nPos+1);
	strRet += strFileName;
	return strRet;
}

CString CPublicFunc::GetPathName(CString source)
{
	CString dest = "";
	int pos = source.ReverseFind('\\');
	if (pos <= 0)		// the first character cannot be '\'
		return "";
	dest = source.Left(pos+1);
	return dest;
}

CString CPublicFunc::GetShortName(CString source)
{
	CString dest = "";
	int pos = source.ReverseFind('\\');
	if (pos < 0)
	{
		dest = source;
		return dest;
	}
	dest = source.Right(source.GetLength()-pos-1);
	return dest;
}

CString CPublicFunc::GetFullTempPath(CString strFileName)
{
	TCHAR szTempPath[MAX_PATH];
	::GetTempPath(MAX_PATH, szTempPath);
	return CString(szTempPath+strFileName);
}

CString CPublicFunc::GetFullTempName(CString strFilePath)
{
	if (strFilePath.IsEmpty())
		strFilePath = GetFullTempPath();

	TCHAR szTempName[MAX_PATH];
	::GetTempFileName(strFilePath, _T("znet"), 0, szTempName);
	return CString(szTempName);
}

CString CPublicFunc::GetExtName(CString source)
{
	CString dest = "";
	int pos = source.ReverseFind('.');
	if (pos <= 0)		// the first character cannot be '\'
		return "";
	dest = source.Right(source.GetLength()-pos-1);
	return dest;
}

⌨️ 快捷键说明

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