本文整理汇总了C++中CDWordArray::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CDWordArray::GetSize方法的具体用法?C++ CDWordArray::GetSize怎么用?C++ CDWordArray::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDWordArray
的用法示例。
在下文中一共展示了CDWordArray::GetSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
bool CAcceleratorManager::Write()
{
CDWordArray AccelsDatasArray;
CDWordArray CmdDatasArray;
int iCount = 0;
CCmdAccelOb*pCmdAccel;
CAccelsOb* pAccel;
DWORD dwAccelData;
WORD wKey;
POSITION pos = m_mapAccelTable.GetStartPosition();
while (pos != NULL)
{
m_mapAccelTable.GetNextAssoc(pos, wKey, pCmdAccel);
CmdDatasArray.RemoveAll();
POSITION pos = pCmdAccel->m_Accels.GetHeadPosition();
while (pos != NULL)
{
pAccel = pCmdAccel->m_Accels.GetNext(pos);
// if (!pAccel->m_bLocked) {
dwAccelData = pAccel->GetData();
CmdDatasArray.Add(dwAccelData);
// }
}
if (CmdDatasArray.GetSize() > 0)
{
CmdDatasArray.InsertAt(0, MAKELONG(pCmdAccel->m_wIDCommand, CmdDatasArray.GetSize()));
AccelsDatasArray.Append(CmdDatasArray);
iCount++;
}
}
// AccelsDatasArray.InsertAt(0, MAKELONG(65535, iCount));
int count = AccelsDatasArray.GetSize();
DWORD *data = (DWORD *)malloc(count * sizeof(DWORD));
ASSERT(data != NULL);
for (int index = 0; index < count; index++)
data[index] = AccelsDatasArray[index];
regSetBinaryValue("keyboard", (char *)data, count*sizeof(DWORD));
AccelsDatasArray.RemoveAll();
CmdDatasArray.RemoveAll();
free(data);
return true;
}
示例2: GetDualPosition
int CMonitor::GetDualPosition(CPoint point)
{
CRect rc(0, 0, 0, 0);
CRect rcWork;
HMONITOR hMonitor;
CDWordArray arrHMonitor;
::EnumDisplayMonitors(NULL, NULL, EnumMonitorProc, (LPARAM)&arrHMonitor);
int nMonitorCount = arrHMonitor.GetSize();
CArray<CRect, CRect &> arrRect;
for(int i = 0; i < nMonitorCount; i++)
{
MONITORINFO mi;
memset(&mi, 0x00, sizeof(MONITORINFO));
mi.cbSize = sizeof(MONITORINFO);
hMonitor = (HMONITOR)arrHMonitor[i];
::GetMonitorInfo(hMonitor, &mi);
rcWork = mi.rcWork;
if( rcWork.left <= point.x && point.x <= rcWork.right &&
rcWork.top <= point.y && point.y <= rcWork.bottom )
{
return i;
}
}
return -1;
}
示例3: GetMonitorRect
CRect CMonitor::GetMonitorRect(int index)
{
int nMonitorCount;
CRect rcWork;
HMONITOR hMonitor;
CDWordArray arrHMonitor;
::EnumDisplayMonitors(NULL, NULL, EnumMonitorProc, (LPARAM)&arrHMonitor);
nMonitorCount = arrHMonitor.GetSize();
if( index < 0 || nMonitorCount <= index )
{
// 범위에 없는 경우는 무조건 기본 영역
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, 0);
return rcWork;
}
MONITORINFO mi;
memset(&mi, 0x00, sizeof(MONITORINFO));
mi.cbSize = sizeof(MONITORINFO);
hMonitor = (HMONITOR)arrHMonitor[index];
::GetMonitorInfo(hMonitor, &mi);
rcWork = mi.rcWork;
return rcWork;
}
示例4: SetRegistryDWordArray
BOOL SetRegistryDWordArray(HKEY root, const CString & var, CDWordArray & data)
{
CString path;
path.LoadString(IDS_PROGRAM_ROOT);
CString name;
makePath(path, var, name);
HKEY key;
LONG result = makeKey(root,
path,
&key);
if(result != ERROR_SUCCESS)
{ /* save it */
::SetLastError((DWORD)result);
return FALSE;
} /* save it */
result = ::RegSetValueEx(key, name, 0, REG_BINARY, (LPBYTE)&(data[0]),
data.GetSize() * sizeof(DWORD));
::RegCloseKey(key);
if(result != ERROR_SUCCESS)
::SetLastError((DWORD)result);
return result == ERROR_SUCCESS;
}
示例5: SetSelectedTasks
void CTDCTaskListCtrl::SetSelectedTasks(const CDWordArray& aTaskIDs, DWORD dwFocusedTaskID)
{
DeselectAll();
int nID = aTaskIDs.GetSize();
if (nID)
{
CTLSHoldResync hr(*this);
while (nID--)
{
DWORD dwTaskID = aTaskIDs[nID];
int nItem = FindTaskItem(dwTaskID);
if (nItem != -1)
{
BOOL bAnchor = (dwTaskID == dwFocusedTaskID);
DWORD dwState = LVIS_SELECTED;
if (bAnchor)
{
dwState |= LVIS_FOCUSED;
m_lcTasks.SetSelectionMark(nItem);
m_lcColumns.SetSelectionMark(nItem);
}
m_lcTasks.SetItemState(nItem, dwState, (LVIS_SELECTED | LVIS_FOCUSED));
m_lcColumns.SetItemState(nItem, dwState, (LVIS_SELECTED | LVIS_FOCUSED));
}
}
}
}
示例6: SetTabStops
void CRRECRuler::SetTabStops( const CDWordArray& arr )
/* ============================================================
Function : CRRECRuler::SetTabStops
Description : Sets the tab stops in the internal tab stop
array, in device pixels
Access : Public
Return : void
Parameters : const CDWordArray& arr - The array to
copy from
Usage : Call to set the tab stops of the ruler.
============================================================*/
{
m_tabs.RemoveAll();
int max = arr.GetSize();
for ( int t = 0 ; t < max ; t++ )
{
m_tabs.Add( arr[ t ] );
}
if (GetSafeHwnd())
{
Invalidate(FALSE);
UpdateWindow();
}
}
示例7: Read
BOOL CBCGPRegistry::Read(LPCTSTR pszKey, LPPOINT& lpPoint)
{
ASSERT(m_hKey);
BOOL bSucess = FALSE;
BYTE* pData = NULL;
UINT uDataSize;
Read (pszKey, &pData, &uDataSize);
try
{
if (pData != NULL && m_Info.lMessage == ERROR_SUCCESS && m_Info.dwType == REG_BINARY)
{
CMemFile file (pData, uDataSize);
CArchive ar (&file, CArchive::load);
ar.m_bForceFlat = FALSE;
ASSERT(ar.IsLoading());
CDWordArray dwcArray;
ASSERT(dwcArray.IsSerializable());
dwcArray.Serialize(ar);
ar.Close();
if (dwcArray.GetSize() == 2)
{
lpPoint->x = dwcArray.GetAt(0);
lpPoint->y = dwcArray.GetAt(1);
bSucess = TRUE;
}
}
}
catch (CMemoryException* pEx)
{
pEx->Delete ();
TRACE(_T("Memory exception in CBCGPRegistry::Read ()!\n"));
}
catch (CArchiveException* pEx)
{
pEx->Delete ();
TRACE(_T("CArchiveException exception in CBCGPRegistry::Read ()!\n"));
}
m_Info.dwType = REG_POINT;
m_Info.dwSize = sizeof(POINT);
if (pData != NULL)
{
delete [] pData;
pData = NULL;
}
return bSucess;
}
示例8:
int CMonitor::GetMonitorCount()
{
int nMonitorCount = 1;
CDWordArray arrHMonitor;
::EnumDisplayMonitors(NULL, NULL, EnumMonitorProc, (LPARAM)&arrHMonitor);
nMonitorCount = arrHMonitor.GetSize();
return nMonitorCount;
}
示例9: PopulateInstancesList
void COXCustomizeInstanceManagerPage::PopulateInstancesList()
{
int nInstanceRunningCount=m_instanceManager.GetNumberOfInstances();
CString sInstanceRunningCount;
sInstanceRunningCount.Format(_T("%d"),nInstanceRunningCount);
m_staticInstanceCount.SetWindowText(sInstanceRunningCount);
int nSelectedItem=-1;
#if _MFC_VER > 0x0421
POSITION pos=m_listInstances.GetFirstSelectedItemPosition();
#else
ASSERT(::IsWindow(m_listInstances.m_hWnd));
POSITION pos = (POSITION) (1+m_listInstances.GetNextItem(-1, LVIS_SELECTED));
#endif
if(pos!=NULL)
{
#if _MFC_VER > 0x0421
int nSelectedItem=m_listInstances.GetNextSelectedItem(pos);
#else
ASSERT(::IsWindow(m_listInstances.m_hWnd));
int nSelectedItem = (int)pos-1;
POSITION npos = (POSITION) (1+m_listInstances.GetNextItem(nSelectedItem, LVIS_SELECTED));
#endif
ASSERT(pos==NULL);
ASSERT(nSelectedItem!=-1);
}
m_listInstances.DeleteAllItems();
// populate list of all running instances
CDWordArray arrInstances;
VERIFY(m_instanceManager.GetInstanceCollection(arrInstances));
ASSERT(arrInstances.GetSize()==nInstanceRunningCount);
DWORD dwCurrentPID=m_instanceManager.GetCurrentInstanceID();
for(int nIndex=0; nIndex<nInstanceRunningCount; nIndex++)
{
CString sItem;
sItem.Format(IDS_OX_CSTMZEINSTANCEINSTANCEF,nIndex+1);//"Instance %d"
VERIFY(m_listInstances.InsertItem(nIndex,sItem)==nIndex);
CString sPID;
sPID.Format(_T("%d"),arrInstances[nIndex]);
m_listInstances.SetItemText(nIndex,1,sPID);
VERIFY(sItem.LoadString(IDS_OX_CSTMZEINSTANCECURRENT));//"Current"
if(arrInstances[nIndex]==dwCurrentPID)
m_listInstances.SetItemText(nIndex,2,sItem);
m_listInstances.SetItemData(nIndex,(LPARAM)arrInstances[nIndex]);
}
if(nSelectedItem>=0 && nSelectedItem<m_listInstances.GetItemCount())
{
m_listInstances.SetItemState(nSelectedItem,LVIS_SELECTED|LVIS_FOCUSED,
LVIS_SELECTED|LVIS_FOCUSED);
}
}
示例10: GetSelectedTaskIDs
int CTDCTaskListCtrl::GetSelectedTaskIDs(CDWordArray& aTaskIDs, DWORD& dwFocusedTaskID) const
{
aTaskIDs.RemoveAll();
aTaskIDs.SetSize(m_lcTasks.GetSelectedCount());
int nCount = 0;
POSITION pos = m_lcTasks.GetFirstSelectedItemPosition();
while (pos)
{
int nItem = m_lcTasks.GetNextSelectedItem(pos);
aTaskIDs[nCount] = m_lcTasks.GetItemData(nItem);
nCount++;
}
dwFocusedTaskID = GetFocusedListTaskID();
ASSERT((!aTaskIDs.GetSize() && (dwFocusedTaskID == 0)) || (Misc::FindT(aTaskIDs, dwFocusedTaskID) >= 0));
return aTaskIDs.GetSize();
}
示例11: SelectTasks
BOOL CTDCTaskListCtrl::SelectTasks(const CDWordArray& aTaskIDs, BOOL bTrue)
{
ASSERT(aTaskIDs.GetSize());
if (!aTaskIDs.GetSize())
return FALSE;
if (!bTrue)
{
SetSelectedTasks(aTaskIDs, aTaskIDs[0]);
}
else
{
CDWordArray aTrueTaskIDs;
aTrueTaskIDs.Copy(aTrueTaskIDs);
m_data.GetTrueTaskIDs(aTrueTaskIDs);
SetSelectedTasks(aTrueTaskIDs, aTrueTaskIDs[0]);
}
return TRUE;
}
示例12: OnCalendarClearSelected
void CCalendarDlg::OnCalendarClearSelected()
{
CDWordArray dwaSelection;
m_pCalendarCtrl->GetSelectedItems(dwaSelection);
for(int i=0; i<dwaSelection.GetSize(); i++)
{
CalendarDataItem* p = NULL;
if(g_CalendarData.Lookup((void*)dwaSelection[i], (void*&)p))
{
p->bMarked = false;
p->csLines.RemoveAll();
}
}
m_pCalendarCtrl->UpdateCells();
}
示例13: OnCalendarMarkSelected
void CCalendarDlg::OnCalendarMarkSelected()
{
CDWordArray dwaSelection;
m_pCalendarCtrl->GetSelectedItems(dwaSelection);
for(int i=0; i<dwaSelection.GetSize(); i++)
{
CalendarDataItem* p = NULL;
if(!g_CalendarData.Lookup((void*)dwaSelection[i], (void*&)p))
{
p = new CalendarDataItem;
g_CalendarData.SetAt((void*)dwaSelection[i], (void*)p);
}
p->bMarked = true;
}
m_pCalendarCtrl->UpdateCells();
}
示例14: StartNewGame
void CCLLKDlg::StartNewGame(void)
{
CTime t=CTime::GetCurrentTime();
tGameTime=t;
strTiShi1="系统时间:"+t.Format("%H:%M:%S");
m_StatusBar.SetText(strTiShi1,2,0);
strTiShi2.Format(" 该局时间:00:00:00");
m_StatusBar.SetText(strTiShi2,1,0);
strTiShi3.Format("当前游戏:%d行%d列%d种方块",m_nRow-2,m_nCol-2,m_Kind);
m_StatusBar.SetText(strTiShi3,0,0);
delete[] m_map;
m_map=new int[m_nCol*m_nRow];
for (int iNum=0;iNum<(m_nCol*m_nRow);iNum++)
{
m_map[iNum]=BLANK_STATE;
}
srand(time(NULL));
CDWordArray tmpMap;
for (int i=0;i<(m_nRow-2)*(m_nCol-2)/2;i++)
{
int x=rand()%m_Kind;
tmpMap.Add(x);
tmpMap.Add(x);
}
for (int i=1;i<(m_nCol-1);i++)
{
for (int j=1;j<(m_nRow-1);j++)
{
INT_PTR nIndex=(int(rand()*0.1+rand()*0.01+rand()))%tmpMap.GetSize();
m_map[i+j*m_nCol]=tmpMap.GetAt(nIndex);
tmpMap.RemoveAt(nIndex);
}
}
Invalidate(false);
}
示例15: OnCalendarAddEntryToSelected
void CCalendarDlg::OnCalendarAddEntryToSelected()
{
// TODO: Add your command handler code here
CCalendarInputDlg dlg;
if(dlg.DoModal() == IDOK && !dlg.m_Text.IsEmpty())
{
CDWordArray dwaSelection;
m_pCalendarCtrl->GetSelectedItems(dwaSelection);
for(int i=0; i<dwaSelection.GetSize(); i++)
{
CalendarDataItem* p = NULL;
if(!g_CalendarData.Lookup((void*)dwaSelection[i], (void*&)p))
{
p = new CalendarDataItem;
p->bMarked = false;
g_CalendarData.SetAt((void*)dwaSelection[i], (void*)p);
}
p->csLines.Add(dlg.m_Text);
}
m_pCalendarCtrl->UpdateCells();
}
}