Visual Studio
(1)
CreateWindow
(1)
Window
(1)
HWND
(1)

Zero length literal string is not zero length

Asked By David Liebtag
19-Nov-09 11:25 PM
I have a program that does this:

HWND Edit =
CreateWindow("Edit","",WS_VISIBLE,0,0,100,100,Parent,0,Instance,0) ;

When the window appears, it is not empty.  Instead, it contains the numeric
digit 0.

The problem only happens when I compile with debug.

I have had this kind of thing happen before where empty literal strings are
not empty.  It seems to be related to the stack.  Sometimes when I have the
problem, I can work around it by moving local variables.

Does anyone know exactly what causes this and/or what I can do about it?

Thanks in advance.

David Liebtag

PS I am using Visual Studio .Net 2003 C++.  I know, I know.  VS .Net 2003 is
old, but it is what I am using.  After all, Microsoft still offers extended
support for it,,,

David,This is not the best group for this question, however...

David Lowndes replied to David Liebtag
20-Nov-09 04:37 AM
David,

This is not the best group for this question, however...


What else do you do with the Edit window handle? Nothing in creating
the window would result in it displaying a '0'.


You've probably got a bug somewhere - not where you think it is.
Enable the compiler run-time checking settings and see if they show
anything.

Dave

Can you suggest a better group?

David Liebtag replied to David Lowndes
20-Nov-09 10:08 AM
Can you suggest a better group?

I have already enabled all the run-time checking and no errors are reported.

David Liebtag

You were correct.

David Liebtag replied to David Lowndes
20-Nov-09 11:00 AM
You were correct.  I found that the code to initialize a global array was
running off the end and corrupting the storage for literal strings.

Thanks.

David Liebtag
The vc.language group may have been better - given the outcome.Dave
David Lowndes replied to David Liebtag
20-Nov-09 01:30 PM
The vc.language group may have been better - given the outcome.

Dave
Post Question To EggHeadCafe