当前位置: 首页>>代码示例>>C++>>正文


C++ CDWordArray::SetAt方法代码示例

本文整理汇总了C++中CDWordArray::SetAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CDWordArray::SetAt方法的具体用法?C++ CDWordArray::SetAt怎么用?C++ CDWordArray::SetAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDWordArray的用法示例。


在下文中一共展示了CDWordArray::SetAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Write

BOOL CBCGPRegistry::Write(LPCTSTR pszKey, LPPOINT& lpPoint)
{
	if (m_bReadOnly)
	{
		ASSERT (FALSE);
		return FALSE;
	}

	ASSERT(m_hKey);
	BYTE* pData = NULL;
	DWORD dwLen = 0;

	{
		CMemFile file(32);
		CArchive ar(&file, CArchive::store);

		CDWordArray dwcArray;
		dwcArray.SetSize(2);
		dwcArray.SetAt(0, lpPoint->x);
		dwcArray.SetAt(1, lpPoint->y);

		ASSERT(dwcArray.IsSerializable());
		dwcArray.Serialize(ar);
		ar.Close();

		dwLen = (DWORD) file.GetLength();
		pData = file.Detach();
	}

	ASSERT(pData != NULL && dwLen > 0);

	LONG lReturn = RegSetValueEx(m_hKey, pszKey, 0, REG_BINARY,
		pData, dwLen);
	
	m_Info.lMessage = lReturn;
	m_Info.dwSize = dwLen;
	m_Info.dwType = REG_POINT;

	if (pData != NULL)
	{
		free(pData);
		pData = NULL;
	}

	if(lReturn == ERROR_SUCCESS)
		return TRUE;
	
	return FALSE;
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:49,代码来源:BCGPRegistry.cpp

示例2: Write

BOOL CRegistry::Write(LPCTSTR pszKey, LPPOINT& lpPoint)
{
	if (m_bReadOnly)
	{
		ASSERT (FALSE);
		return FALSE;
	}

	ASSERT(m_hKey);
	const int iMaxChars = 20;
	CDWordArray dwcArray;
	BYTE* byData = (BYTE*)::calloc(iMaxChars, sizeof(TCHAR));
	ASSERT(byData);

	dwcArray.SetSize(5);
	dwcArray.SetAt(0, lpPoint->x);
	dwcArray.SetAt(1, lpPoint->y);

	CMemFile file(byData, iMaxChars, 16);
	CArchive ar(&file, CArchive::store);
	ASSERT(dwcArray.IsSerializable());
	dwcArray.Serialize(ar);
	ar.Close();
	const DWORD dwLen = (DWORD) file.GetLength();
	ASSERT(dwLen < iMaxChars);
	LONG lReturn = RegSetValueEx(m_hKey, pszKey, 0, REG_BINARY,
		file.Detach(), dwLen);

	m_Info.lMessage = lReturn;
	m_Info.dwSize = dwLen;
	m_Info.dwType = REG_POINT;

	if(byData)
	{
		free(byData);
		byData = NULL;
	}

	if(lReturn == ERROR_SUCCESS)
		return TRUE;

	return FALSE;
}
开发者ID:CoryXie,项目名称:RemoteDesktopControl,代码行数:43,代码来源:Registry.cpp

示例3: Write

//***************************************************************************************
BOOL CBCGPXMLSettings::Write(LPCTSTR pszKey, LPPOINT& lpPoint)
{
	if (m_bReadOnly)
	{
		ASSERT (FALSE);
		return FALSE;
	}

	const int iMaxChars = 20;
	CDWordArray dwcArray;
	BYTE* byData = (BYTE*)::calloc(iMaxChars, sizeof(TCHAR));
	ASSERT(byData);

	dwcArray.SetSize(5);
	dwcArray.SetAt(0, lpPoint->x);
	dwcArray.SetAt(1, lpPoint->y);

	CMemFile file(byData, iMaxChars, 16);
	CArchive ar(&file, CArchive::store);
	ASSERT(dwcArray.IsSerializable());
	dwcArray.Serialize(ar);
	ar.Close();
#if _MSC_VER >= 1300
	ULONGLONG dwLen = file.GetLength ();
#else
	const DWORD dwLen = file.GetLength ();
#endif
	LPBYTE lpbData = file.Detach ();
	BOOL bRes = Write (pszKey, lpbData, (UINT) dwLen);

	if(byData)
	{
		free(byData);
		byData = NULL;
	}

	return bRes;
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:39,代码来源:CxBCGPXMLSettings.cpp


注:本文中的CDWordArray::SetAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。