|
Well, since this drawing code is executed for every single item I think it's not neccessary to use a while()-loop.
Give this code a try, however, it is untested:
void CConsoleView::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast( pNMHDR );
*pResult = CDRF_DODEFAULT;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText;
if(!GetListCtrl().GetItemText(pLVCD->nmcd.dwItemSpec,7).Compare("Stopped"))
crText = RGB(255,0,0);
else
crText = RGB(0,0,0);
pLVCD->clrText = crText;
*pResult = CDRF_DODEFAULT;
}
regards
Gregor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Your code works fine.. It seems to do exactly the same thing as the loop.. I'd rather use your example vrs the loop, your example is much cleaner..
But the darn thing is still not drawing the correct color on the first 2 columns.. But if I click on the item and click off it draws correctly.. or if I scroll the first 2 columns out of the view of the list and scroll them back into view they are drawn correctly.
Weird..
Rob
|
|
|
|
|
really weird...
put the line
GetListCtrl().Invalidate();
after
*pResult = ...
This should redraw the listbox, but usually it needn't be called
Maybe it helps
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yeah, I tried that yesterday.. Unfortunatly because of how often I update the list it causes it to flicker so bad that I cant read anything..
I really do appreciate all your help
Rob
|
|
|
|
|
Thanks
Well, one more try:
You could Invalidate() your control, after all items have been added.
If you add the items via a loop you could call Invalidate() after the loop has finished
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Actually I put the Invalidate inside of my Populate function.. and this worked great!!
Thanks for all your help!
Rob
|
|
|
|
|
When I'm debugging a DLL that uses DirectShow, and I make a call to OleCreatePropertyFrame, the program produces an access violation (0x00000005) and all i get is a window with this:
00000000 ???
00000001 ???
00000002 ???
00000003 ???
00000004 ???
00000005 ???
00000006 ???
...
...
FFFFFFFF ???
One of the lines is highlighted, but it also reads "???".
What the heck have I done to get this? How do I find out what's really wrong?
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Seems like execution has jumped to the low area of virtual memory. Maybe some callback that has not been properly set?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Maybe, try to delete a object twice, or use the object had been deleted
|
|
|
|
|
Guys, Any body remember how I can get the cpu in C, Not in VC++... I'm sorry for this very old Question....
Best Regards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hola Carlos,
I've found this (seemingly abandoned) Intel's white paper: Intel Processor Identification and the CPUID Instruction. It comes with some asm and C code you can copy and paste.
I'm saying "seemingly abandoned" because it's in the Intel's Russian site (!) but nowhere on developer.intel.com, and the files it refers to are not downloadable anymore (though you can copy & paste from the paper, as I said above).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín...
Very Helpful...
Thanks a LOT...
Un Abrazo....
Buen Fin de semana....
Carlos
If your computer says, "Printer out of Paper," this problem cannot be resolved by continuously clicking the "OK" button.
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Forget about "seemingly abandoned". Here's the latest version of the doc (at developer.intel.com).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín. Gracias Nuevamente...
APATHY ERROR: Don't bother striking any key. Application has reported a "Not My Fault" in module KRNL.EXE in line 0200:103F
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hello,
I'd like to know if you know how to get the y coordinate of PolyBezier spline (giving the x one).
Thanks
|
|
|
|
|
I need to know how do i write a method that should add one objetc to some array everytime it is called.
thanks
|
|
|
|
|
If you're using MFC, then you could use CObArray. Or one of it's derived classes ( CStringArray, CPtrArray, CByteArray, CWordArray, CDWordArray).
They're pretty funky and already do exactly what you want.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I have an ActiveX control which fires an event. In the event handling code in the containing app, I create and display a pop-up menu. If I click anywhere outside of the menu, it gets dismissed as expected, but the application stays stuck in the menu modal loop until I get the menu to display again by again firing the event from the control (by clicking the control again).
Whats going on?
And more importantly, do you have any idea on how to fix it?
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge
|
|
|
|
|
This is just guessing, but could it be that you haven't specified correctly the parent window in TrackPopupMenu ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for the tip, but the correct window is the parent.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge
|
|
|
|
|
Another guess: maybe your event handler is being called from a different thread than your main window belongs. A possible fix could be that the event handler sends a user message to the main window (say WM_HANDLE_EVENT ) and then doing the popup menu stuff in OnHandleEvent (which executes in the right thread). Maybe it's worth a try.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I need to export C++ objects out of a DLL. The objects don't have to be used outside of the DLL, they just have to be able to be passed back in to the DLL for use inside - essentially, they are containers for the DLL's state.
These objects would never be shared between threads or processes.
I was thinking this might be a way to do it:
typedef HGLOBAL HMYOBJ;
HMYOBJ GetDLLObject()
{
HGLOBAL hObj = GlobalAlloc(GPTR, sizeof(CMyClass));
CMyClass *pClass = (CMyClass *)hObj;
pClass->Init();
return (HMYOBJ)hObj;
}
...
BOOL UseDLLObject(HMYOBJ hObj)
{
CMyClass *pClass = (CMyClass *)hObj;
return pClass->DoSomething();
}
void DestroyDLLObject(HMYOBJ hObj)
{
CMyClass *pClass = (CMyClass *)hObj;
pClass->CleanUp();
GlobalFree(hObj);
}
...
HMYOBJ hObj = GetDLLObject();
BOOL ok = UseDLLObject(hObj);
DestroyDLLObject(hObj);
Does that seem reasonable? It does seem to work, I just wanted someone else to look at it.
-c
Smaller Animals Software, Inc.
|
|
|
|
|
Does that seem reasonable?
It looks very reasonable to me except for one thing. IMHO instead of
HGLOBAL hObj = GlobalAlloc(GPTR, sizeof(CMyClass));
CMyClass *pClass = (CMyClass *)hObj;
pClass->Init();
return (HMYOBJ)hObj;
it's simpler to write
CMyClass *pClass = new CMyClass();
return (HMYOBJ)pClass;
which works just the same.
If you want to take extra precautions to make sure that the object passed back from the user app is a valid pointer, you can have an internal table of pointers and pass an index to that table, instead of the actual pointer --that's how Win32 does it most of the time.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Dear all,
Would you please help me with subj. I want to send defenite packet by means of Winsock2, and destination is MAC address not IP address. But I haven't found how I can do that by using WS2. Is it possible to resolve this prolem?
And if it possible to do in this way, could you ask to me, how I can create packet with required to me structure.
Thanx in advance
RomaDo
|
|
|
|
|
I don't think you can do that.
The IP network that you are transmitting traffic, uses the IP address to route the traffic. If there's no IP address, it won't know where to go.
Regards
-p
|
|
|
|