M
morangolds
Hi,
I've been having a problem with C++ Windows Forms apps not "ending"
when you close the form window. I've searched about this problem all
over the place and most searches have lead me to believe that this has
to do with unreleased form component events or event handlers.
I'm comparatively new to .net and windows forms, in the sense that
though I've been using them for over 2 years now, it's been rather
sporadic. I work with computer-machine interfaces quite a bit, so I'm
mainly doing ANSI C++/STL so stuff can run on whatever OS the
implementer chooses, and the input is usually handled by an external
component that's hooked up to this code. Lately though, more and more
instances have risen where a proper user interface was needed, and
Windows Forms has been brilliant in providing an unbelievably fast
development process for even multi-form, parsed-input,
validation-requiring apps. That is, until I decided to get some of the
information processing code inside the app itself...
Up until now, I've been creating the input forms, which would then
(after the information was submitted) send this information elsewhere
to be processed. Sometimes this required some additional processing by
another program, and sometimes it just hooked up directly to the
interface which connected to the external element, often some sort of
embedded devide that would cache the data while feeding it to whatever
mechanism was using it.
Now, however, I've been presented with a situation where I know that
the client will be using windows-only, and connecting the computer
directly to the device, whichout buffering. So I thought I'd try
simplifying things for everyone and just place everything inside one
C++.net app. This, apparently, held some inherent issues I had no idea
about. Previously, the Forms apps I've created just took the data, did
very mild parsing, and output some XML file to be picked up by another
program. Now, the data needs to undergo mathematical manipulation, sent
back to the form to be displayed as a graph, and only then sent out to
the output element. I haven't even reached the output stage, and it's
already at a point where most of the time, running the program, working
with it a bit, and closing it, will not end the process. In debug mode,
the form just goes away, but the debugging goes on because the process
is still active.
To clarify, my background is rather "que-centric". Instructions stand
in line, get processed, and then the que moves ahead. This is how my
mind works because I've been doing mostly single-threaded C++/STL for
larger scale systems, and C/asm for embedded stuff. All pointer-related
stuff is placed in containers, and so are arrays. If it's embedded, use
macros to make sure that you don't leave "things hanging". This may
seem stone-age for windows programmers, but really, even with the
latest PicMicro dsPics, you don't usually thread. Thus, the whole
notion that you have a person running, throwing a ball up in the air,
keep running, and catching the ball when it falls so as to see what
stuck to it, is very new to me. Moreover, if I have this right, this
isn't really threading, or is it? Does it have to do with the managed
heap?
I should also mention that the app doesn't really "need" the user to do
anything in order to remain an open process when the form closes.
Sometimes I run it, and close it almost right away, and it still
remains active. I've narrowed down the controls so now there are only
one button, one trackbar, and a panel on which the graph is placed on.
It's the minimum required elements to have the mathmatical process be
called and then sent back.
So basically, any general information about the subject would be
useful. I suppose some means of tracking when something has been
removed from the managed heap would help, although I do delete every
gcnew object I create when I'm done with it (does that dispose of it?
Is there anything else that I should be doing/checking?). But then, if
this is a "floating even" problem, I don't even know how to access this
data... I mean, what *is* an unhandled event? An instruction waiting to
be finalized? How do I trace something like that?
Thanks in advance for any info or pointers,
-Moran
I've been having a problem with C++ Windows Forms apps not "ending"
when you close the form window. I've searched about this problem all
over the place and most searches have lead me to believe that this has
to do with unreleased form component events or event handlers.
I'm comparatively new to .net and windows forms, in the sense that
though I've been using them for over 2 years now, it's been rather
sporadic. I work with computer-machine interfaces quite a bit, so I'm
mainly doing ANSI C++/STL so stuff can run on whatever OS the
implementer chooses, and the input is usually handled by an external
component that's hooked up to this code. Lately though, more and more
instances have risen where a proper user interface was needed, and
Windows Forms has been brilliant in providing an unbelievably fast
development process for even multi-form, parsed-input,
validation-requiring apps. That is, until I decided to get some of the
information processing code inside the app itself...
Up until now, I've been creating the input forms, which would then
(after the information was submitted) send this information elsewhere
to be processed. Sometimes this required some additional processing by
another program, and sometimes it just hooked up directly to the
interface which connected to the external element, often some sort of
embedded devide that would cache the data while feeding it to whatever
mechanism was using it.
Now, however, I've been presented with a situation where I know that
the client will be using windows-only, and connecting the computer
directly to the device, whichout buffering. So I thought I'd try
simplifying things for everyone and just place everything inside one
C++.net app. This, apparently, held some inherent issues I had no idea
about. Previously, the Forms apps I've created just took the data, did
very mild parsing, and output some XML file to be picked up by another
program. Now, the data needs to undergo mathematical manipulation, sent
back to the form to be displayed as a graph, and only then sent out to
the output element. I haven't even reached the output stage, and it's
already at a point where most of the time, running the program, working
with it a bit, and closing it, will not end the process. In debug mode,
the form just goes away, but the debugging goes on because the process
is still active.
To clarify, my background is rather "que-centric". Instructions stand
in line, get processed, and then the que moves ahead. This is how my
mind works because I've been doing mostly single-threaded C++/STL for
larger scale systems, and C/asm for embedded stuff. All pointer-related
stuff is placed in containers, and so are arrays. If it's embedded, use
macros to make sure that you don't leave "things hanging". This may
seem stone-age for windows programmers, but really, even with the
latest PicMicro dsPics, you don't usually thread. Thus, the whole
notion that you have a person running, throwing a ball up in the air,
keep running, and catching the ball when it falls so as to see what
stuck to it, is very new to me. Moreover, if I have this right, this
isn't really threading, or is it? Does it have to do with the managed
heap?
I should also mention that the app doesn't really "need" the user to do
anything in order to remain an open process when the form closes.
Sometimes I run it, and close it almost right away, and it still
remains active. I've narrowed down the controls so now there are only
one button, one trackbar, and a panel on which the graph is placed on.
It's the minimum required elements to have the mathmatical process be
called and then sent back.
So basically, any general information about the subject would be
useful. I suppose some means of tracking when something has been
removed from the managed heap would help, although I do delete every
gcnew object I create when I'm done with it (does that dispose of it?
Is there anything else that I should be doing/checking?). But then, if
this is a "floating even" problem, I don't even know how to access this
data... I mean, what *is* an unhandled event? An instruction waiting to
be finalized? How do I trace something like that?
Thanks in advance for any info or pointers,
-Moran