如何把一个结构体变量数组写入注册表? 如何把一个结构体变量数组写入注册表? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 TRegistry 只有WriteInteger,WriteString之类,怎么写一个结构体进去。 把结构体按照顺序变成一个String 就可以了 CWinApp::WriteProfileBinaryCWinApp::GetProfileBinarymsdn上的例子CWinApp* pApp = AfxGetApp();const TCHAR* pszKey = _T("My Section");struct complex { double re, im;} myData = { 1.4142, -0.5 };// Write the information to the registry.pApp->WriteProfileBinary(pszKey, _T("ComplexData"), (LPBYTE)&myData, sizeof(myData));// Read the information from the registry.complex* pData;UINT n;BOOL ret = pApp->GetProfileBinary(pszKey, _T("ComplexData"), (LPBYTE*)&pData, &n);ASSERT(ret);ASSERT(n == sizeof(complex));ASSERT(myData.re == pData->re);ASSERT(myData.im == pData->im);delete [] pData; // free the buffer 关键的是把结构体的数据转化为string ,然后WriteString写入。 tooltips定位显示的问题 《代码大全》中文第二版下载 用内存映射创建文件,可否灵活控制文件的大小 提问: [求助]很菜的问题,MFC/向导建的单对话框程序入口点是什么啊 1000分求打印机控制DLL 为何不能安装VS6 如何固定OpenGL窗口大小不变 一个关于图象透明的问题 关于Server/Client方式的问题 请问如何结束调用的进程 基于OPENGL的点云三角化设计 大神求助啊!
CWinApp::GetProfileBinarymsdn上的例子CWinApp* pApp = AfxGetApp();const TCHAR* pszKey = _T("My Section");
struct complex {
double re, im;
} myData = { 1.4142, -0.5 };// Write the information to the registry.pApp->WriteProfileBinary(pszKey, _T("ComplexData"), (LPBYTE)&myData,
sizeof(myData));// Read the information from the registry.complex* pData;
UINT n;
BOOL ret = pApp->GetProfileBinary(pszKey, _T("ComplexData"), (LPBYTE*)&pData,
&n);ASSERT(ret);
ASSERT(n == sizeof(complex));
ASSERT(myData.re == pData->re);
ASSERT(myData.im == pData->im);
delete [] pData; // free the buffer