www.pudn.com > acdx.rar > GnuGkAppConfig.cpp
/*============================================================= Function: Author: Leon Wang==============================================================*/ // GnuGkAppConfig.cpp: implementation of the GnuGkAppConfig class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "GnuGkAppConfig.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// //##ModelId=424BB6450396 GnuGkAppConfig::GnuGkAppConfig() { m_inipath = getAppPath(); } //##ModelId=424BB64503A1 GnuGkAppConfig::~GnuGkAppConfig() { } //##ModelId=424BB6450392 int GnuGkAppConfig::getConfigKey(CString section,CString configKey, int defaultValue) { char tempChar[MAX_PATH]; GetPrivateProfileString(section,configKey,"",tempChar,MAX_PATH,m_inipath); defaultValue = atoi(tempChar); return defaultValue; } //##ModelId=424BB6450382 CString GnuGkAppConfig::getConfigKey(CString section,CString configKey, CString defaultValue) { char tempChar[MAX_PATH]; GetPrivateProfileString(section,configKey,"",tempChar,MAX_PATH,m_inipath); defaultValue = CString(tempChar); return defaultValue; } // get application configuration file work path //##ModelId=424BB64503A3 CString GnuGkAppConfig::getAppPath() { char pt[MAX_PATH] ; CString appname = "ACDX"; GetFullPathName(appname+".exe",MAX_PATH,pt,NULL); CString pathtp(pt); pathtp.TrimLeft(); pathtp.TrimRight(); int pos = pathtp.ReverseFind('\\'); pathtp = pathtp.Mid(0,pos); CString inipath = ""; inipath += pathtp; inipath +="\\"+appname+".ini"; return inipath; }