本文整理汇总了C++中CDWordArray类的典型用法代码示例。如果您正苦于以下问题:C++ CDWordArray类的具体用法?C++ CDWordArray怎么用?C++ CDWordArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDWordArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rc
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;
}
示例2: 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;
}
示例3: EnumMonitorProc
BOOL CALLBACK EnumMonitorProc(HMONITOR hMonitor, HDC hdc, LPRECT prc, LPARAM lParam)
{
CDWordArray *parrHMonitor = (CDWordArray *)lParam;
parrHMonitor->Add((DWORD)hMonitor);
return TRUE;
}
示例4: ASSERT
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;
}
示例5:
int CMonitor::GetMonitorCount()
{
int nMonitorCount = 1;
CDWordArray arrHMonitor;
::EnumDisplayMonitors(NULL, NULL, EnumMonitorProc, (LPARAM)&arrHMonitor);
nMonitorCount = arrHMonitor.GetSize();
return nMonitorCount;
}
示例6: GetRegistryDWordArray
CDWordArray * GetRegistryDWordArray(HKEY root, const CString &var)
{
CString path;
DWORD len;
DWORD type;
path.LoadString(IDS_PROGRAM_ROOT);
CString name;
makePath(path, var, name);
HKEY key;
LONG result = ::RegOpenKey(root, path, &key);
if(result != ERROR_SUCCESS)
{ /* failed */
::SetLastError(result);
return NULL;
} /* failed */
result = ::RegQueryValueEx(key, name, 0, &type, NULL, &len);
if(result != ERROR_SUCCESS)
{ /* failed */
::SetLastError((DWORD)result);
::RegCloseKey(key);
return NULL;
} /* failed */
CDWordArray * data = new CDWordArray;
DWORD count = len / sizeof(DWORD);
data->SetSize((int)count); // preallocate the array data
result = ::RegQueryValueEx(key, name, 0, &type, (LPBYTE)&(*data)[0], &len);
if(result != ERROR_SUCCESS)
{ /* failed */
::RegCloseKey(key);
::SetLastError((DWORD)result);
delete data;
return NULL;
} /* failed */
::RegCloseKey(key);
if(type != REG_BINARY)
{ /* wrong type */
::SetLastError(ERROR_INVALID_DATA);
delete data;
return NULL;
} /* wrong type */
return data;
}
示例7: ASSERT
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);
}
}
示例8: SelectItem
BOOL CTDCTaskListCtrl::SelectItem(int nItem)
{
m_lcTasks.SetSelectionMark(nItem);
m_lcColumns.SetSelectionMark(nItem);
// avoid unnecessary selections
if ((GetSelectedCount() == 1) && (GetSelectedItem() == nItem))
return TRUE;
CDWordArray aTaskIDs;
aTaskIDs.Add(GetTaskID(nItem));
return SelectTasks(aTaskIDs);
}
示例9: 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();
}
示例10: 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();
}
}
示例11: 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));
}
}
}
}
示例12: 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();
}
示例13: 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;
}
示例14: GetSelection
void CFileBrowserListCtrl::GetSelection(CDWordArray& SelIdx) const
{
int selcnt = GetSelectedCount();
SelIdx.SetSize(selcnt);
POSITION pos = GetFirstSelectedItemPosition();
for (int i = 0; i < selcnt; i++)
SelIdx[i] = GetNextSelectedItem(pos);
}
示例15: GetResultIDs
int CTDLFindResultsListCtrl::GetResultIDs(const CFilteredToDoCtrl* pTDC, CDWordArray& aTaskIDs) const
{
CFTDResultsArray aResults;
int nNumRes = GetResults(pTDC, aResults);
for (int nRes = 0; nRes < nNumRes; nRes++)
aTaskIDs.Add(aResults[nRes].dwTaskID);
return aResults.GetSize();
}