/*
函数名称: McRegGetValue
创建 人:
创建日期:
功能描述:从注册表获取路径
返回类型:CString
参数意义:subkey: keyName: 注册表名称
修改记录:
*/
CString fun::McRegGetValue(CString subKey, CString keyName)
{
TCHAR lpszBuff[256];
LPTSTR lpszStr = lpszBuff +128;
subKey = "SOFTWARE\\zwMcAplank"+subKey;
LPTSTR lpszKey= subKey.GetBuffer(128);
LPTSTR lpszName = keyName.GetBuffer(128);
struct HKEY__ * hKey =NULL;
DWORD dwStrCb = 0;
DWORD dwValueType = 0;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,subKey, 0,KEY_QUERY_VALUE|KEY_SET_VALUE,&hKey)!= ERROR_SUCCESS)
{
return "";
}
dwValueType = REG_SZ;//注册表类型
dwStrCb = 128;
if(RegQueryValueEx(hKey,lpszName,0,&dwValueType,(BYTE *)lpszStr,&dwStrCb)!=ERROR_SUCCESS)
{
RegCloseKey(hKey);
return "";
}
RegCloseKey(hKey);
return CString(lpszStr);
}
/*
函数名称:GetModulePath
创建日期:
功能描述:获取当前模块路径
参数描述:ModuleName:模块名称
*/
CString fun::GetModulePath(char *ModuleName)
{
CString strPath = "";
CString str_Temp;
str_Temp = "\\";
str_Temp += ModuleName;
GetModuleFileName(GetModuleHandle(_T("McAplank.zrx")),strPath.GetBuffer(256) ,256);
strPath.ReleaseBuffer();
try
{
strPath.Delete(strPath.ReverseFind('\\'),str_Temp.GetLength());
}
catch(...)
{
acedAlert(_T("获取配置文件路径错误"));
return strPath;
}
return strPath;
}
从注册表获取路径
最新推荐文章于 2024-07-24 23:11:30 发布