|
figured it out. see the last two lines
void CListCtrlEx::OnNmCustomDraw(NMHDR *pNMHDR, LRESULT *pResult)
{
NMLVCUSTOMDRAW *lvcd = reinterpret_cast<nmlvcustomdraw *="">(pNMHDR);
// CDDS_PREPAINT is at the beginning of the paint cycle. we
// implement custom draw by returning the proper value. In
// this case, we are requesting item-specific notifications.
switch (lvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
// Request prepaint notifications for each item.
*pResult = CDRF_NOTIFYITEMDRAW;
break;
case(CDDS_ITEMPREPAINT|CDDS_SUBITEM):
if(m_DisableSelectedHighlight)
{
lvcd->nmcd.uItemState &= ~CDIS_SELECTED;
lvcd->nmcd.uItemState &= ~CDIS_FOCUS;
}
|
|
|
|
|
You've mixed up the return value of the function and the value returned through pResult . In MFC, WM_NOTIFY handlers return void . The pResult parameter is where you put the "return value" of the handler. In other words, you should do *pResult = TRUE; instead of return TRUE;
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
Hi, is there any function which tells me what ip has the machine ? (i dont mean 127.0.0.1 ).
Thanks
|
|
|
|
|
GetMyIp(void) const
{
// Don't forget to initialize the sockets and stuff!
char locn[255];
CString ip;
if (SOCKET_ERROR != gethostname(locn, 255))
ip = inet_ntoa(*(struct in_addr *)*gethostbyname(locn)->h_addr_list);
return ip;
}
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
That was pretty fast reply Thanks
|
|
|
|
|
Hi,
It is ever possible that nobody have met what I call the CR count problem of an Edit control ?
What I mean is that an Edit control of Microsoft is not able to count right the CRLF characters ! Yes, just the ones that Microsoft itself keeps alive !
What it does is just to ignore the '\r' characters in the count,
both when using EM_GETSEL and EM_SETSEL
I made a workaround, which is to count all the CR characters both before the beginning of a selection and inside the selection itself, and then make some adjust to the counts. But this code is CPU consuming and more orrible than here described.
Does anyone know a better workaround, or better a solution for this ... ?
Marcello
|
|
|
|
|
Hi everyone..
I would like to make a "Wireless signal strength meter" such as a small bar graphics which can be seen when you open the wireless connection status dialog from your wireless network icon.
I think there might be a way of getting this value regardless of brand of wireless network card..
If there's anyone who knows it, please share your know-how.
Thank you very much
Eddie
|
|
|
|
|
Hi.
I would like to be able to instantiate an object based on some attribute.
ie) I would like to be able to tell a function to create a object based on some value. I do not mean a simple switch trawling through a range of int or char values, but to be able to call a function with an argument that can be used to create an object of a specified type.
Is it possible to create an object based on an indirection, other than a pointer to an already exisiting object of the same kind.
Any advice would be very welcome.
James
|
|
|
|
|
Hi James, the technique you're after is oftenly called a virtual constructor or factory method; google for these terms to get some info. If you have trouble implmenting this, do not hesitate to come back for more help.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi.
Thanks very much.
I am after the type of effect that you can get using an array of pointers to functions.
I will check out the web, as you suggest.
Thanks.
James.
|
|
|
|
|
I am creating a DLL using the Visual C++ 6.0 appwizard(dll). I am building a vst(steinberg)plug-in using MFC. I would like to know if a dialog that I added to this DLL can support activeX controls.
I have tryed adding the function AfxEnableControlContainer( ) to the InitInstance() function, and registered the controls however that does not seem to work.
Can anyone help me?
Thanks in advance,
-Jeff Chandler
|
|
|
|
|
You made dll by MFC and used AfxEnableControlContainer() function to enable using ActiveX control, so the dll part is OK. Just to be sure, you can make a simple MFC exe file and load your dll.
I think this problem returns to the application which load your plug-in.
Reza
|
|
|
|
|
I'm building an app using MFC as a front end, with the majority of the app in C++ with heavy use of STL.
I've used Boost::shared_ptr to manage my new/delete calls for me. As far as I can tell, the only pointers I use are STL vector<> iterators.
My problem is this: when I run the app in the debugger, it works perfectly. When I run it as an EXE, it throws an exception and crashes after a few minutes - even though its the exact same build!
I've tried building with _DEBUG and NDEBUG, and both yield the same results. I've tried disabling inlining and optimization, and it makes no difference. The crashes are fairly random, so I suspect a bad pointer.
To check my memory, I've used:
afxMemDF |= checkAlwaysMemDF;
It didn't trip even once while debugging.
Can anyone help me?
|
|
|
|
|
A few random things to try... there is an article somewhere around here called "Surviving the Release Build", which has some good info.
Also, I've noticed that the Debug build often is "nice" and initializes variables to zero or to a known debug value. Release mode gives you no such luck. So perhaps you just have an uninitialized variable somewhere?
You can also try "Cave-man" debugging... put in message boxes at strategic locations in your program to narrow down the crash.
"I'd be up a piece if I hadn't swallowed my bishop." Mr. Ed, playing chess
|
|
|
|
|
I've read that article and everything I can find in MSDN.
I've tried the cave-man approach, and the problem seems to move. That's why I'm thinking its a pointer gone awry.
The problem exists even if I run a debug version executable as an EXE, without the debugger.
Also, if I run a release (NDEBUG, with inlining and optimizations) version in the debugger, I don't get any errors!
|
|
|
|
|
Without more info, it can be hard to try to help you.
Maybe you can set debug information for the release version (Keith Rule's Debugging Release Mode Problems[^] tells you how), if the error still pops up then you'll know where it is located.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That's just it - its not just a standard debug-to-release problem.
If I run a _release_ version executable in the debugger, it works fine. Its only when I run it as an EXE that it fails. It doesn't matter what my build settings are, its a question of if I'm running it in the debugger or double-clicking the EXE.
|
|
|
|
|
Can you include some poor-man traces (message boxes, for instance) to narrow down the point of error?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Probably you could try Numega Boundschecker to check for memory leak. No guarantee on solving your problem thou.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Thanks for your help.
It turns out I was doing something like this:
(In a member fn of a class based on std::list)
iterator it(begin()), en(end());
while(it!=en)
{
if(*****)
it=erase(it);
else
++it;
}
For some reason, the debugger let this slide, and it was only picked up by running the EXE, even though they were _exactly_ the same build!
|
|
|
|
|
In an MFC app I wrote, I wanted to display some normal text with an up arrow or down arrow inside a CStatic text control. The only font that contains those characters is the Symbols font. So I took one of the normal fonts, copied the arrows from Symbols into it and saved it with a new font name. Then in my MFC app I loaded that new font, and everything works great.
Now I'd like to send the text to a lazer printer. These arrows obviously don't print because the printer doesn't know about my new font.
Is there a standard way of loading fonts to a lazer printer so that it will use my new font?
Thanks
|
|
|
|
|
I have run into an issue with ExtCreateRegion on windows 9X machines. I use getregiondata to get the data and then use ExtCreateRegion data to recreate the region. Everything works fine on 2000/XP and on 9x machines when the region is less than 64K but on the 9x machines when the region is larger than 64K it fails. The MS documentation says 64K is not longer a limitation on 9x but my tests seem to elude to a different answer. The code is pretty simple:
int LastTestRgnSize = GetRegionData(TempRgn, 0, 0); // get the rgn size
unsigned char* LastTestRgn = new unsigned char[LastTestRgnSize];
memset( LastTestRgn, 0x00, LastTestRgnSize );
int size = GetRegionData(TempRgn, LastTestRgnSize, (RGNDATA*)LastTestRgn);
HRGN Rgn = ::ExtCreateRegion(NULL, RgnSize, (RGNDATA*)Temp);
The ::ExtCreateRegion function will fail when the region size is above 64K on 9x but not on 2000/XP. Does anyone have a work-around for this or any ideas on how to correct the problem.
Thanks in Advance
nemo
|
|
|
|
|
nemo wrote:
The MS documentation says 64K is not longer a limitation on 9x
I'd like to see where it says that. Everything in User and GDI on 9x has 16-bit limitations because much of that code is 16-bit code for Win16 compatibility. [Eg, list boxes can't hold more than 32K items, 32K is the max value of a 16-bit signed int; 9x can't handle more than 16K window handles, 16K*4 bytes = 64K bytes, 4 bytes being sizeof(HWND) ]
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
Can you suggest some software to create a help file for my application? I need my help file to have a look as in the VC++ Help such as Content, Index, Search. This help file should allow me to embed graphics/screen shots. I have looked into htmlhelp, but i am not sure this is the best tool.
Elizabeth
|
|
|
|
|
help workshop
hhc.exe from microsoft
includeh10
|
|
|
|