Click here to Skip to main content
15,911,646 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: How can check a file exist at purticular location? Pin
David Crow31-Jul-08 5:53
David Crow31-Jul-08 5:53 
QuestionHow to create address book using MFC?? Pin
nisha0000030-Jul-08 19:28
nisha0000030-Jul-08 19:28 
AnswerRe: How to create address book using MFC?? Pin
_AnsHUMAN_ 30-Jul-08 19:40
_AnsHUMAN_ 30-Jul-08 19:40 
AnswerRe: How to create address book using MFC?? Pin
CPallini30-Jul-08 21:09
mveCPallini30-Jul-08 21:09 
GeneralRe: How to create address book using MFC?? Pin
Iain Clarke, Warrior Programmer30-Jul-08 21:41
Iain Clarke, Warrior Programmer30-Jul-08 21:41 
GeneralRe: How to create address book using MFC?? Pin
CPallini30-Jul-08 21:48
mveCPallini30-Jul-08 21:48 
QuestionRe: How to create address book using MFC?? Pin
David Crow31-Jul-08 5:55
David Crow31-Jul-08 5:55 
Questionlist control exibiting 2 properties Pin
VCProgrammer30-Jul-08 19:14
VCProgrammer30-Jul-08 19:14 
Hi all,

I have a list control. Now i want that my list control should show two properties simultaneously :-

i) alternate row colour
ii) when i run my thread it should display green or red colour

i have code for exibiting both propertirs but they are not working simultaneously......

code for displaying alternate ro colour is as follows:
*void CColoredListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
	*pResult = 0;

	
  LPNMLVCUSTOMDRAW  lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
  int iRow = lplvcd->nmcd.dwItemSpec;

  switch(lplvcd->nmcd.dwDrawStage)
  {
    case CDDS_PREPAINT :
    {
      *pResult = CDRF_NOTIFYITEMDRAW;
      return;
    }

    // Modify item text and or background
    case CDDS_ITEMPREPAINT:
    {
      lplvcd->clrText = RGB(0,0,0);
      // If you want the sub items the same as the item,
      // set *pResult to CDRF_NEWFONT
      *pResult = CDRF_NOTIFYSUBITEMDRAW;
      return;
    }

    // Modify sub item text and/or background
    case CDDS_SUBITEM | CDDS_PREPAINT | CDDS_ITEM:
    {
		
        if(iRow %2){
         lplvcd->clrTextBk = m_colRow2;
        }
        else{
          lplvcd->clrTextBk = m_colRow1;
        }
		

        *pResult = CDRF_DODEFAULT;
        return;
    }
  }
}


and for displaying color at runtime is as follows
void CColoredListCtrl::OnCustomDraw ( NMHDR* pNMHDR, LRESULT* pResult )
{

	NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );

	*pResult = CDRF_DODEFAULT;

	if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
	{
		*pResult = CDRF_NOTIFYITEMDRAW;
	}
	else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
	{
		// This is the notification message for an item.  We'll request
		// notifications before each subitem's prepaint stage.
			
		*pResult = CDRF_NOTIFYSUBITEMDRAW;
	}
	else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )
	{
			
		COLORREF clrNewTextColor, clrNewBkColor;
        
		int    nItem = static_cast<int>( pLVCD->nmcd.dwItemSpec );

		CString strTemp;

		if(http_list == 1)
			strTemp = Obj_Http->m_Main_List.GetItemText(nItem,pLVCD->iSubItem);
		else if(smtp_list == 1)
			strTemp = obj_SmtpNew->m_SmtpList.GetItemText(nItem,pLVCD->iSubItem);
		else
			strTemp = Obj_SP->m_SP_List.GetItemText(nItem,pLVCD->iSubItem);
				
				

		if(strTemp == "OFFLINE")
		{
			clrNewTextColor = RGB(0,0,0);		//Set the text to red
			clrNewBkColor = RGB(255,0,0);		//Set the bkgrnd color to blue
		}  
		else if(strTemp == "ONLINE")
		{
			clrNewTextColor = RGB(0,0,0);		//Leave the text black
			clrNewBkColor = RGB(0,255,0);	//leave the bkgrnd color white
		}
		else 
		{
				
			clrNewTextColor = RGB(0,0,0);		//Leave the text black
			clrNewBkColor = RGB(255,255,255);	//leave the bkgrnd color white
		}

		pLVCD->clrText = clrNewTextColor;
		pLVCD->clrTextBk = clrNewBkColor;
			
        
		// Tell Windows to paint the control itself.
		*pResult = CDRF_DODEFAULT;
             
	}
}


i want to merge these two piece of code but not getting the way...

How can i do this....
AnswerRe: list control exibiting 2 properties Pin
Iain Clarke, Warrior Programmer30-Jul-08 22:11
Iain Clarke, Warrior Programmer30-Jul-08 22:11 
QuestionOnly copying done not replacing in SHFileOperation !!! Pin
Le@rner30-Jul-08 18:24
Le@rner30-Jul-08 18:24 
AnswerRe: Only copying done not replacing in SHFileOperation !!! Pin
_AnsHUMAN_ 30-Jul-08 18:47
_AnsHUMAN_ 30-Jul-08 18:47 
QuestionRe: Only copying done not replacing in SHFileOperation !!! Pin
David Crow31-Jul-08 5:59
David Crow31-Jul-08 5:59 
Questiondll error Pin
tom groezer30-Jul-08 5:03
tom groezer30-Jul-08 5:03 
AnswerRe: dll error Pin
Chris Losinger30-Jul-08 5:11
professionalChris Losinger30-Jul-08 5:11 
AnswerRe: dll error Pin
Iain Clarke, Warrior Programmer30-Jul-08 5:29
Iain Clarke, Warrior Programmer30-Jul-08 5:29 
GeneralRe: dll error Pin
led mike30-Jul-08 7:55
led mike30-Jul-08 7:55 
AnswerRe: dll error Pin
Mark Salsbery30-Jul-08 6:33
Mark Salsbery30-Jul-08 6:33 
QuestionTimer in AES code Pin
zc12330-Jul-08 3:51
zc12330-Jul-08 3:51 
AnswerRe: Timer in AES code Pin
Iain Clarke, Warrior Programmer30-Jul-08 4:23
Iain Clarke, Warrior Programmer30-Jul-08 4:23 
GeneralRe: Timer in AES code Pin
zc12330-Jul-08 5:08
zc12330-Jul-08 5:08 
GeneralRe: Timer in AES code Pin
Iain Clarke, Warrior Programmer30-Jul-08 5:26
Iain Clarke, Warrior Programmer30-Jul-08 5:26 
GeneralRe: Timer in AES code Pin
zc12330-Jul-08 5:34
zc12330-Jul-08 5:34 
QuestionVisual Studio 2005 project loading Pin
tom groezer30-Jul-08 3:39
tom groezer30-Jul-08 3:39 
AnswerRe: Visual Studio 2005 project loading Pin
KarstenK30-Jul-08 3:52
mveKarstenK30-Jul-08 3:52 
GeneralRe: Visual Studio 2005 project loading Pin
tom groezer30-Jul-08 5:06
tom groezer30-Jul-08 5:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.