本文整理汇总了C++中CWinApp::GetProfileBinary方法的典型用法代码示例。如果您正苦于以下问题:C++ CWinApp::GetProfileBinary方法的具体用法?C++ CWinApp::GetProfileBinary怎么用?C++ CWinApp::GetProfileBinary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWinApp
的用法示例。
在下文中一共展示了CWinApp::GetProfileBinary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetProfileBinary
BOOL helper::GetProfileBinary(LPCTSTR lpszSection, LPCTSTR lpszEntry,
LPBYTE pData, const LPBYTE pDefault, UINT uSize)
{
LPBYTE pTmpData;
UINT uBytes;
CWinApp *pApp = AfxGetApp();
// 拷贝缺省值
memcpy(pData, pDefault, uSize);
if (pApp->GetProfileBinary(lpszSection, lpszEntry, &pTmpData, &uBytes))
{
memcpy(pData, pTmpData, uSize);
delete [] pTmpData;
return TRUE;
}
return FALSE;
}
示例2: ReadRegCharFormat
* Class CEsmScriptOptions Method - bool ReadRegCharFormat (void);
*
* Input the char formats from the registry.
*
*=========================================================================*/
bool CEsmScriptOptions::ReadRegCharFormat (void) {
CWinApp* pApp = AfxGetApp();
CString RegName;
CHARFORMAT2 CharFormat;
BYTE* pData = (BYTE *) &CharFormat;
UINT Size;
BOOL Result;
int Index;
/* Input all the script formats */
for (Index = 0; Index < ESMSCRIPT_NUMFORMATS; Index++) {
RegName.Format(_T("%s%d"), ESMSCR_REGENTRY_CHARFORMAT, Index);
Size = sizeof(CharFormat);
Result = pApp->GetProfileBinary(ESMSCR_REGSEC_SCRIPT, RegName, &pData, &Size);
if (Result) {
memcpy(&m_Formats[Index], pData, sizeof(CHARFORMAT2));
delete [] pData;
}
}
return (true);
}
示例3: TransferSettings
void CUIforETWDlg::TransferSettings(bool saving)
{
CWinApp* pApp = AfxGetApp();
NameToBoolSetting bools[] =
{
{ L"CompressTraces", &bCompress_ },
{ L"CswitchStacks", &bCswitchStacks_ },
{ L"SampledStacks", &bSampledStacks_ },
{ L"FastSampling", &bFastSampling_ },
{ L"GPUTracing", &bGPUTracing_ },
{ L"CLRTracing", &bCLRTracing_ },
{ L"ShowCommands", &bShowCommands_ },
{ L"UseOtherKernelLogger", &bUseOtherKernelLogger_ },
{ L"BackgroundMonitoring", &bBackgroundMonitoring_ },
{ L"ChromeDeveloper", &bChromeDeveloper_ },
{ L"IdentifyChromeProcessesCPU", &bIdentifyChromeProcessesCPU_ },
{ L"AutoViewTraces", &bAutoViewTraces_ },
{ L"RecordPreTrace", &bRecordPreTrace_ },
{ L"HeapStacks", &bHeapStacks_ },
{ L"VirtualAllocStacks", &bVirtualAllocStacks_ },
{ L"VersionChecks", &bVersionChecks_ },
};
for (auto& m : bools)
{
if (saving)
pApp->WriteProfileInt(pSettings, m.pName, *m.pSetting);
else
*m.pSetting = pApp->GetProfileIntW(pSettings, m.pName, *m.pSetting) != false;
}
NameToRangedInt ints[] =
{
// Note that a setting of kKeyLoggerFull cannot be restored from
// settings, to avoid privacy problems.
{ L"InputTracing", (int*)&InputTracing_, kKeyLoggerOff, kKeyLoggerAnonymized },
{ L"TracingMode", (int*)&tracingMode_, kTracingToMemory, kHeapTracingToFile },
{ L"GpuMode", (int*)&gpuMode_, kGPUDefault, kGPUVerbose },
};
for (auto& m : ints)
{
if (saving)
pApp->WriteProfileInt(pSettings, m.pName, *m.pSetting);
else
{
int temp = pApp->GetProfileIntW(pSettings, m.pName, *m.pSetting);
if (temp < m.min)
temp = m.min;
if (temp > m.max)
temp = m.max;
*m.pSetting = temp;
}
}
NameToUInt64 bigInts[] =
{
{ L"ChromeKeywords", &chromeKeywords_ },
};
for (auto& m : bigInts)
{
if (saving)
{
pApp->WriteProfileBinary(pSettings, m.pName, (LPBYTE)m.pSetting, sizeof(*m.pSetting));
}
else
{
LPBYTE temp = 0;
UINT byteCount = sizeof(temp);
pApp->GetProfileBinary(pSettings, m.pName, &temp, &byteCount);
if (byteCount == sizeof(temp))
*m.pSetting = *(uint64_t*)temp;
delete [] temp;
}
}
NameToString strings[] =
{
{ L"HeapProfiledProcess", &heapTracingExes_ },
{ L"WSMonitoredProcesses", &WSMonitoredProcesses_ },
{ L"ExtraKernelFlags", &extraKernelFlags_ },
{ L"ExtraStackWalks", &extraKernelStacks_ },
{ L"ExtraUserProviders", &extraUserProviders_ },
{ L"PerfCounters", &perfCounters_ },
};
for (auto& m : strings)
{
if (saving)
pApp->WriteProfileStringW(pSettings, m.pName, m.pSetting->c_str());
else
{
CString result = pApp->GetProfileStringW(pSettings, m.pName, m.pSetting->c_str());
*m.pSetting = result;
}
}
}