コード例 #1
0
void CReportCtrl::RemoveEditOptions(CXTPReportRecordItem *pItem,DWORD_PTR dwData)
{
	CXTPReportRecordItemEditOptions *pEditOptions = pItem->GetEditOptions(NULL);
	ASSERT(pEditOptions != NULL);

	CXTPReportRecordItemConstraints *pConstraints = pEditOptions->GetConstraints();
	ASSERT(pConstraints != NULL);

	CXTPReportRecordItemConstraint *pConstraint = pEditOptions->FindConstraint(dwData);
	ASSERT (pConstraint != NULL);

	CDWordArray dwDatas;
	CStringArray strConstraints;

	for (int i=0; i<pConstraints->GetCount(); ++i)
	{
		CXTPReportRecordItemConstraint *pConstraint = pConstraints->GetAt(i);
		if (pConstraint->m_dwData != dwData)
		{
			dwDatas.Add(pConstraint->m_dwData);
			strConstraints.Add(pConstraint->m_strConstraint);
		}
	}

	pConstraints->RemoveAll();
	for (int i=0; i<dwDatas.GetCount(); ++i)
		pEditOptions->AddConstraint(strConstraints[i],dwDatas[i]);
}
コード例 #2
0
ファイル: Monitor.cpp プロジェクト: JaeJoonLee/Common
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
0
ファイル: Monitor.cpp プロジェクト: JaeJoonLee/Common
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
0
ファイル: Monitor.cpp プロジェクト: JaeJoonLee/Common
BOOL CALLBACK EnumMonitorProc(HMONITOR hMonitor, HDC hdc, LPRECT prc, LPARAM lParam)
{
    CDWordArray *parrHMonitor = (CDWordArray *)lParam;

	parrHMonitor->Add((DWORD)hMonitor);

    return TRUE;
}
コード例 #5
0
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;
}
コード例 #6
0
ファイル: Monitor.cpp プロジェクト: JaeJoonLee/Common
int	CMonitor::GetMonitorCount()
{
	int			nMonitorCount = 1;
	CDWordArray arrHMonitor;

	::EnumDisplayMonitors(NULL, NULL, EnumMonitorProc, (LPARAM)&arrHMonitor);
	nMonitorCount = arrHMonitor.GetSize();

	return nMonitorCount;
}
コード例 #7
0
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;
    }
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);
	}
}
コード例 #9
0
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);
}
コード例 #10
0
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;
}
コード例 #11
0
ファイル: CalendarDlg.cpp プロジェクト: malpharo/AiPI
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();
}
コード例 #12
0
ファイル: RRECRuler.cpp プロジェクト: Fox-Heracles/TodoList
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();
	}
}
コード例 #13
0
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));
			}
		}

	}
}
コード例 #14
0
ファイル: CalendarDlg.cpp プロジェクト: malpharo/AiPI
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();
}
コード例 #15
0
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;

    }
コード例 #16
0
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);
}
コード例 #17
0
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();
}
コード例 #18
0
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;
}
コード例 #19
0
BOOL CRegistry::Read (LPCTSTR pszKey, CDWordArray& dwcArray)
{
	ASSERT(m_hKey);
	const int iMaxChars = 4096;
	DWORD dwType;
	DWORD dwData = iMaxChars;
	BYTE* byData = (BYTE*)::calloc(iMaxChars, sizeof(TCHAR));
	ASSERT(byData);

	LONG lReturn = RegQueryValueEx(m_hKey, pszKey, NULL, &dwType,
		byData, &dwData);

	m_Info.lMessage = lReturn;
	m_Info.dwType = dwType;
	m_Info.dwSize = dwData;

	if(lReturn == ERROR_SUCCESS && dwType == REG_BINARY)
	{
		ASSERT(dwData < iMaxChars);
		CMemFile file(byData, dwData);
		CArchive ar(&file, CArchive::load);
		ar.m_bForceFlat = FALSE;
		ASSERT(ar.IsLoading());
		ASSERT(dwcArray.IsSerializable());
		dwcArray.RemoveAll();
		dwcArray.SetSize(0);
		dwcArray.Serialize(ar);
		ar.Close();
		file.Close();
	}

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

	if(lReturn == ERROR_SUCCESS)
		return TRUE;

	return FALSE;
}
コード例 #20
0
CDWordArray *CGhostTextBuffer::			/* virtual override */
CopyRevisionNumbers(int nStartLine, int nEndLine) const
{
	CDWordArray *paSavedRevisionNumbers = CCrystalTextBuffer::CopyRevisionNumbers(nStartLine, nEndLine);
	for (int nLine = nEndLine; nLine >= nStartLine; --nLine)
	{
		if ((GetLineFlags(nLine) & LF_GHOST) != 0)
			paSavedRevisionNumbers->RemoveAt(nLine - nStartLine);
	}
	if ((GetLineFlags(nEndLine) & LF_GHOST) != 0)
	{
		for (int nLine = nEndLine + 1; nLine < GetLineCount(); ++nLine)
			if ((GetLineFlags(nLine) & LF_GHOST) == 0)
			{
				paSavedRevisionNumbers->Add(GetLineFlags(nLine));
				break;
			}
	}
	return paSavedRevisionNumbers;
}
コード例 #21
0
ファイル: DlxiaoDllDlg.cpp プロジェクト: fhaoquan/zxwg
//加HP,MP
void addHpMp(bool isheordz)
{
	//wgdebug("====================加HP MP=======================%d\n",0);
    int hp, mp;
	int addHpValue,addMpValue;
	DWORD jnID;
	ReadProcessMemory(PID, (LPCVOID)(rwBaseAddr + 0x254), &hp, 4, 0);
	ReadProcessMemory(PID, (LPCVOID)(rwBaseAddr + 0x258), &mp, 4, 0);
    if (dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_JH))
    {
		addHpValue =  dlxiaoDllDlg->GetDlgItemInt(IDC_EDIT_HONG);
        if (hp <= addHpValue)
        {
			if(isheordz){
				if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISJNADDHP) && mp > 10 ){ 
					if( addhpjnidx > -1 ){
						ReadProcessMemory(PID, (LPCVOID)(jnPointerArray.GetAt(addhpjnidx) + 0x8), &jnID, 4, 0);
						if(jnID){
							CallUserSkill(jnID,rwId);
							Sleep(300);
						}else{
							if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISDZ)){
								dazuo();
							}
						}
					}else{
						if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISDZ)){
							dazuo();
						}
					}	
				}else if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISDZ)){
					dazuo();
				}
			}else{
				AddRed();
			}
        }
    }
	
    if (dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_JL))
    {
		addMpValue =  dlxiaoDllDlg->GetDlgItemInt(IDC_EDIT_LANG);
        if (mp <= addMpValue)
        {
			if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISDZ) && isheordz){
				dazuo();
			}else{
				AddBlue();
			}
		}
    }
	
	//wgdebug("====================END 加HP MP=======================%d\n",0);
}
コード例 #22
0
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();
}
コード例 #23
0
ファイル: CLLKDlg.cpp プロジェクト: LDreamer/LLK
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);
}
コード例 #24
0
ファイル: HexEdit.cpp プロジェクト: tornadocean/DM
void CHexEdit :: GetNumbers ( CDWordArray & cArray )
{
    // Get the array into shape.
    cArray.RemoveAll ( ) ;

    CString strRaw ;
    GetWindowText ( strRaw ) ;

    TCHAR * szBuff = (TCHAR*)new TCHAR[ strRaw.GetLength ( ) +
                                        1 * sizeof ( TCHAR )   ] ;

    _tcscpy ( szBuff , (LPCTSTR)strRaw ) ;

    // Use good ol' strtok to do the deed.
    TCHAR * pCurr = _tcstok ( szBuff , k_DELIMS ) ;
    while ( NULL != pCurr )
    {

        // Try and convert it to an value.  I'm taking the easy way out.
        DWORD dwAddr ;
        int iRet = _stscanf ( pCurr       ,
                              _T ( "%x" ) ,
                              &dwAddr       ) ;

        if ( 1 != iRet )
        {
            CString sMsg ;
            sMsg.FormatMessage ( IDS_LOADADDRBADCONVERSION ,
                                 pCurr                      ) ;
            AfxMessageBox ( sMsg ) ;
        }
        else
        {
            cArray.Add (  dwAddr ) ;
        }

        pCurr = _tcstok ( NULL , k_DELIMS ) ;
    }
    delete [] szBuff ;
}
コード例 #25
0
void CTDCTaskListCtrl::RestoreSelection(const TDCSELECTIONCACHE& cache)
{
	if (cache.aSelTaskIDs.GetSize() == 0)
	{
		DeselectAll();
		return;
	}

	DWORD dwFocusedTaskID = cache.dwFocusedTaskID;
	ASSERT(dwFocusedTaskID);
	
	if (FindTaskItem(dwFocusedTaskID) == -1)
	{
		dwFocusedTaskID = 0;
		int nID = cache.aBreadcrumbs.GetSize();
		
		while (nID--)
		{
			dwFocusedTaskID = cache.aBreadcrumbs[nID];
			
			if (FindTaskItem(dwFocusedTaskID) != -1)
				break;
			else
				dwFocusedTaskID = 0;
		}
	}
	
	// add focused task if it isn't already
	CDWordArray aTaskIDs;
	aTaskIDs.Copy(cache.aSelTaskIDs);

	if (Misc::FindT(aTaskIDs, dwFocusedTaskID) == -1)
		aTaskIDs.Add(dwFocusedTaskID);

	SetSelectedTasks(aTaskIDs, dwFocusedTaskID);
	
	// restore pos
	if (cache.dwFirstVisibleTaskID)
		SetTopIndex(FindTaskItem(cache.dwFirstVisibleTaskID));
}
コード例 #26
0
ファイル: MSTreeCtrl.cpp プロジェクト: danieljennings/p4win
// When starting a mouse-key select, the anchor point, and all contiguous 
// selections that are not in the path of the current item can remain 
// selected.  All other selections are tossed, like Exploder does.
void CMultiSelTreeCtrl::DoKeyedDeselect( BOOL scrollingDown )
{
	CDWordArray keepSet;
	HTREEITEM currentItem= m_AnchorItem;
	
	// Record the contiguous selection's we're keeping
	keepSet.Add( (DWORD) m_AnchorItem );
	while(1)
	{
		if( scrollingDown )
			currentItem= GetPrevSiblingItem( currentItem);
		else
			currentItem= GetNextSiblingItem( currentItem);

		if( currentItem == NULL || !IsSelected( currentItem ) )
			break;

		keepSet.Add( (DWORD) currentItem );
	}

	// Unselect everything
	//
	int i;
	for( i= m_SelectionSet.GetSize()-1; i >= 0; i-- )
	{
		currentItem= (HTREEITEM) m_SelectionSet.GetAt(i);	
		// Undo any display atts
		SetItemState(currentItem, 0, TVIS_CUT | TVIS_BOLD | TVIS_SELECTED);
	}

	// Then select everything in the keepset
	//
	m_SelectionSet.RemoveAll();
	for( i= keepSet.GetSize()-1; i>=0; i-- )
		SetSelectState( (HTREEITEM) keepSet.GetAt(i), TRUE );

	m_PendingKeyedDeselect= FALSE;
	ShowNbrSelected();
}
コード例 #27
0
//***************************************************************************************
BOOL CBCGPXMLSettings::Read(LPCTSTR pszKey, LPPOINT& lpPoint)
{
	BOOL	bSucess = FALSE;
	BYTE*	pData = NULL;
	UINT	uDataSize;

	if (!Read (pszKey, &pData, &uDataSize))
	{
		ASSERT (pData == NULL);
		return FALSE;
	}

	ASSERT (pData != NULL);

	try
	{
		CMemFile file (pData, uDataSize);
		CArchive ar (&file, CArchive::load);

		CDWordArray dwcArray;
		dwcArray.SetSize(5);
		dwcArray.Serialize (ar);
		lpPoint->x = dwcArray.GetAt(0);
		lpPoint->y = dwcArray.GetAt(1);
		bSucess = TRUE;
	}
	catch (CMemoryException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Memory exception in CBCGPXMLSettings::Read ()!\n"));
	}
	catch (CArchiveException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("CArchiveException exception in CBCGPXMLSettings::Read ()!\n"));
	}

	return TRUE;
}
コード例 #28
0
ファイル: CalendarDlg.cpp プロジェクト: malpharo/AiPI
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();
	}	
}
コード例 #29
0
//***************************************************************************************
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;
}
コード例 #30
0
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;
}