the handle is invalid
i am getting this message intermittently during runtime with a new control i developed. the control is pretty straightforward. i don't understand what's causing this at all.
i haven't come across this before. i know it's something from windows, but from googling, this appears to happen in such a broad variety of situations that i can't find anything that's actually helping me narrow down the possible causes, let alone a solution.
If you expect us to figure it out from that description, you're probably dreaming.
Do you know how to use your debugger?
i know that's not a lot of information, but i don't have anything more myself. i can't isolate it to a particular line, only somewhere in the control...
and yes, i tried stepping through it over and over again, but i could never get it to occur when i was doing that.
Can't you break execution when the error occurs? What debugger are you using?
i use borland C++ builder.
anyway, i changed the control to use different (non-COM) subcomponents and now the error isn't happening anymore.
i'd still like to know a lot more about using the debugger tools more effectively, and how to ensure that i obtain handles safely and allocating on the stack/heap/etc...
Practice using the debugger on a program you know works.
Add known "errors" to your program, say stepping off the end of an array, and use the debugger to "find" the problem.
Like anything else, actual practical experience is how you learn this stuff. And trying to learn it in the middle of a crisis doesn't help.
Amen! However, being in the middle of a crisis tends to focus my concentration like nothing else. :o
Originally Posted by Salem
ok, well it's not as resolved as i thought.
the problem here is that when this error occurs, the debugger doesn't resolve to any line. it just brings me to wherever i was in the IDE, but doesn't highlight any line or anything.
Did you compile the program with debugging information enabled?
Look in the call stack, is there anything there? Can you find some part of your code and go to that?
never used that before. i'll give it a try!
thanks! i'm totally open to any and all suggestions. i have a rather nice system message system worked out now, i'd hate to replace it with a stupid, featureless memo.
the only thing that sticks out is that i did the following:
is it unsafe to invoke the this pointer in a constructor list like this?
__fastcall systemMessage::systemMessage(TSystemMessageScreen *Owner,String msg) :
>> is it unsafe to invoke the this pointer in a constructor list like this?
Potentially. If the systemMessage object is used in the TLabel constructor (or indirectly in the memo constructor) then it would be a problem.