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

📄 pubfunc.cpp

📁 本软件带有源码
💻 CPP
字号:
// pubfunc.cpp: implementation of the pubfunc class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "pubfunc.h"

CString GetSysDate()
{
	CString strTemp;
	CTime t = CTime::GetCurrentTime();
	strTemp.Format("%04d/%02d/%02d", t.GetYear(), t.GetMonth(), t.GetDay());

	return strTemp;
}

CString GetSysTime()
{
	CString strTime;
	CTime t = CTime::GetCurrentTime();
	strTime.Format("%02d:%02d:%02d", t.GetHour(), t.GetMinute(), t.GetSecond());

	return strTime;
}

CString GetPath()
{
	CString strPath;
	char exePath[MAX_PATH];
	GetModuleFileName(NULL,exePath,MAX_PATH);
	strPath=exePath;

	strPath.Replace("/","\\");
	int pos=strPath.ReverseFind('\\');
	if(pos>=0)
		strPath=strPath.Left(pos+1);

	return strPath;
}

BOOL SetAccessODBC(char *dstName)
{
	CString szDesc;
	char dbName[60];
	char tmpPath[MAX_PATH];

	sprintf(dbName,"%s.mdb",dstName);
	strcpy(tmpPath,GetPath());
	szDesc.Format("DSN=%s|DESCRIPTION=%s|DBQ=%s|FIL=MicrosoftAccess|DEFAULTDIR=%s|",
			dstName,dstName,dbName,tmpPath);

	for(int i=0;i<szDesc.GetLength();i++){
		if(szDesc.GetAt(i)=='|') szDesc.SetAt(i,'\0');
	}
	SQLConfigDataSource(NULL,ODBC_ADD_DSN,
		"Microsoft Access Driver (*.mdb)\0",
		(LPCSTR)szDesc);

	return TRUE;
}

⌨️ 快捷键说明

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