关于写入系统注册区函数WriteProfileBinary的问题

LEONARD0824 2003-08-21 11:17:14
我看了一本书上说WriteProfileBinary的作用:用来写入注册区以替代ini文件写入。
具体的语句是:AfxGetApp()->WriteProfileBinary()
但我查了CWinApp的函数,没有WriteProfileBinary,只有WriteProfileInt,WriteProfileString,而且它们只和ini文件有关。
请问,是否用WriteProfileBinary函数? 如何使用?
...全文
165 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingzai 2003-08-21
  • 打赏
  • 举报
回复
These are strictly undocumented,I am using GetProfileBinary and WriteProfileBinary in my app to save the
WINDOWPLACEMENT structure, and it works
UINT nSize = 0 ;
LPBYTE pPlacementBytes = NULL ;
if ( AfxGetApp()->GetProfileBinary( "Window", "Placement",
&pPlacementBytes, &nSize ) )
{
ASSERT(pPlacementBytes != NULL);
if ( pPlacementBytes != NULL )
{
ASSERT(nSize == sizeof(WINDOWPLACEMENT));
if ( nSize == sizeof(WINDOWPLACEMENT) )
{
memcpy( &m_Placement, pPlacementBytes, nSize ) ;
bSized = true ;
}

delete [] pPlacementBytes ;
}
}

and

UINT nSize = sizeof(WINDOWPLACEMENT) ;
ZeroMemory( &m_Placement, nSize ) ;
m_Placement.length = nSize ;
if ( GetWindowPlacement( &m_Placement ) )
AfxGetApp()->WriteProfileBinary( "Window", "Placement",
(LPBYTE)&m_Placement, nSize ) ;
kingzai 2003-08-21
  • 打赏
  • 举报
回复
These are strictly undocumented,I am using GetProfileBinary and WriteProfileBinary in my app to save the
WINDOWPLACEMENT structure, and it works
UINT nSize = 0 ;
LPBYTE pPlacementBytes = NULL ;
if ( AfxGetApp()->GetProfileBinary( "Window", "Placement",
&pPlacementBytes, &nSize ) )
{
ASSERT(pPlacementBytes != NULL);
if ( pPlacementBytes != NULL )
{
ASSERT(nSize == sizeof(WINDOWPLACEMENT));
if ( nSize == sizeof(WINDOWPLACEMENT) )
{
memcpy( &m_Placement, pPlacementBytes, nSize ) ;
bSized = true ;
}

delete [] pPlacementBytes ;
}
}

and

UINT nSize = sizeof(WINDOWPLACEMENT) ;
ZeroMemory( &m_Placement, nSize ) ;
m_Placement.length = nSize ;
if ( GetWindowPlacement( &m_Placement ) )
AfxGetApp()->WriteProfileBinary( "Window", "Placement",
(LPBYTE)&m_Placement, nSize ) ;

2,586

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 资源
社区管理员
  • 资源
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧