My MFC program only runs on XP!

My MFC program only runs on XP!

Post by Richard We » Thu, 03 Mar 2005 05:40:27


Hi all,
I've written an MFC app (I used Visual Studio .Net 2003). I developed my
program on a Windows XP machine. In my application I've used objects of
CListCtrl in a few places. If I try and run my program on any Windows XP
machine it runs fine, but if I try and run it on a machine with Win98 -
Win2000 any dialog containing a CListCtrl object simply crashes the program
and I get a message box appear saying the my program caused an unknown
exception error.

I'm at a total loss to try and understand why this should be the case, I've
checked to make sure that the latest COMCTRL32.dll is on all target machine
to no avail. Can anyone suggest a reason why this is happening so I can
solve the problem?!

Thanks,
Rich.
 
 
 

My MFC program only runs on XP!

Post by Richard We » Thu, 03 Mar 2005 06:18:24


my
program
I've
machine

I forgot to say that I've checked the #defs in stdafx.h and WINVER is set to
0x0400 and _WIN32_WINNT is set to 0x0400 which I think is correct to target
Win98 and later.

Thanks,
Rich.

 
 
 

My MFC program only runs on XP!

Post by Richard We » Thu, 03 Mar 2005 07:16:52


developed
to
target

Sorry to keep answering my own posts but if it helps someone give me an
answer it's worth it!

I've managed to find a Win2k machine with Visual Studio .Net 2002 on it. I
converted my project to compile, and i've traced the exact point in all my
dialog where the code falls over. It's nothing to do with CListCtrl it's all
to do with my CEdit boxes. In a few edit boxes I have methods to handle
EN_CHANGE for the edit boxes. In the handler I read in the string from the
edit box using GetWindowText() and I then strip out a specific character if
it happens to be there and then I write the text back to the edit box using
SetWindowText.

Now on my Win XP machine this debugs and runs absolutely fine, but on any
other OS it falls over ... and it kinda makes sense now. If I use
SetWindowText the edit box is thinking it's been changed and an EN_CHANGE
message must get fired. I think my code enters a loop going round and round
which in turn is causing the stack to overflow which is giving me my error.
Even more strangely, if I have Spy++ running to try and look for these
messages the messages simply don't happen and the edit box goes dead! you
can't type in it and get and SetWindowText do nothing!!

HELP!

Thanks,
Rich.
 
 
 

My MFC program only runs on XP!

Post by David Chin » Mon, 07 Mar 2005 10:35:50


Nothing wrong immediately jumps out. Why don't you try tracing the program
with a de *** and narrow down where it crashes. For example, set a
breakpoint in InitInstance(). Does it get there? How about in the
CMainFrame::OnCreate()? etc.

-- David
http://www.yqcomputer.com/