|
no, I tried passing iRow first and that didn't work either (iRow presumably is the right parameter)
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:
{
// ACCESS errTable here, and change font accordingly
CWnd* mainDlg = GetParent();
// CTestFolderBrowseDlg* myDlg = (CTestFolderBrowseDlg*)mainDlg;
////////////
LVITEM lvi;
memset(&lvi, 0, sizeof(lvi));
lvi.mask = LVIF_TEXT;
lvi.state = 0;
lvi.stateMask = 0;
unsigned char LVtext[16];
lvi.cchTextMax = 15;
// Length of string to be copied into pszText member
lvi.pszText = (LPTSTR)LVtext;
// String buffer for pszText member
// Nota bene : starts at zero (item) and ends at 'lCols' (last subitem) :
lvi.iSubItem = 5;
// Retrieve the text in an item or a subitem of line 'i' :
mainDlg->SendMessage(LVM_GETITEMTEXT, (WPARAM) iRow, (LPARAM) &lvi);
CString resultText(LVtext);
if(!strcmp((LPCSTR)LVtext, "Failed"))
{
do something here...
}
///////////
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;
}
}
}
|
|
|
|
|
>>lvi.iSubItem = 5; // 6 columns in total, I assume that means 5 is the last one, also tried 4
Also. subitems are 1 based. If you have 6 columns, subitem 6 is the last column.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
I am making one application in VC++.NET. I want to pass one integer parameter to one thread function. How can I pass parameter to thread functions? My code is as below.
Thread function
public class TestThread
{
public:
static void ThreadProc()
{
...
}
};
Thread function call
Thread* myThread = new Thread(new ThreadStart(&TestThread::ThreadProc));
myThread->Start();
I want to pass one integer parameter in ThreadProc() .
Thanks in Advance
Priyank Raval
|
|
|
|
|
a global variable could to the job. Or has the ThreatStart-class overloaded constructors?
Greetings from Germany
|
|
|
|
|
Global variable?? NO! This is C++! Derive a class from Thread and you can make whatever
constructor and add whatever member variables you want
*EDIT ack it's sealed
Mark
-- modified at 13:05 Monday 11th June, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I still stand by my "this is C++ response
I thought Nish would have this covered...
How to pass data to worker threads[^]
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hi priyank please ask vc.net related question here[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
If you have a standard dialog control and you've done some code for it, but then find a custom control that's based on that, is there an easy way to make the control be of that new class, eg I've done something with a listview but if i wanted to try the alternate shaded row control, can I quickly/easily do that, or is it going to get so messy it's best to start with a new custom control?
http://www.codeproject.com/listctrl/coloredlistctrl.asp[^]
|
|
|
|
|
In fact I just changed the class type in the dialog header file in one line and it worked just fine. I suppose that's because in this case, the class is just the base class with an overridden draw/erase method
|
|
|
|
|
I have a timer handle which does some idle checking. Based on the idleness of the user, I want to do certain updates in the GUI. However, I do not wish to do certain GUI updates IF there is a modal loop active (typically a dialog box open).
Is there a good and generic way to detect this condition using MFC?
|
|
|
|
|
hi...
I am using IOCP technology for my project. in some of the sites i have seen, that in windows 98, this wont be work...,If its so,
then which are technology is available for supporting(chat) in win 98
also....
Is any one knows in GOOGLE TALK and YAHOO messanger which technolgy they are using for communication........?
-- modified at 9:32 Monday 11th June, 2007
|
|
|
|
|
If you're referring to IO Completion ports then I can confirm they're only available as part of the Operating System on NT based Windows, NT, 2000, XP, Vista.
This doesn't stop you implementing something similar yourself with a thread pool and synchronisation objects, It won't be as fast or efficient but lets face it, neither is Win98
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
|
How does one convert SYSTEMTIME to char *
Many Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: How does one convert SYSTEMTIME to char *
Use <code>COleDateTime .
SYSTEMTIME sysTime = { 0 };
GetLocalTime( &sysTime );
COleDateTime odtDtTime( sysTime );
CString csTime = odtDtTime.<code>Format</code>(_T("%A, %B %d, %Y"));
|
|
|
|
|
|
Programm3r wrote: How does one convert SYSTEMTIME to char *
Outside of MFC, sprintf() will work just fine.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
|
Programm3r wrote: if (CompareFileTime((FILETIME*)dateCreated, &ftCreate)==0)
The first argument should be a pointer to a FILETIME structure. You have a char that has been cast to such.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This will work:
wsprintf(lpszString, "%02d/%02d/%d %02d:%02d:%02d",stCreate.wYear, stCreate.wMonth,
stCreate.wDay,stCreate.wHour, stCreate.wMinute, stCreate.wSecond);
if (strcmp(dateCreated, lpszString)==0)
{
...
}
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
If you are simply wanting to know if two SYSTEMTIME structures are equal, why not just use memcmp() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: why not just use memcmp()?
Don't know ... haven't though of that, but the strcmp is working fine, unless you for see a problem?
Thanks David
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: ...unless you for see a problem?
No problem, other than an unnecessary call to wsprintf() .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
GetTimeFormat() and GetDateFormat()
|
|
|
|