X-Centric said:
changed code to this:
char Buffer[10000];
BytesRead = Registry->ReadBinaryData("ListViewSpeed", &Buffer,
sizeof(Buffer));
maybe this is more correct, but my main problem is still this error i
get.
I just can't figure out how it happens.
I don't think &Buffer is correct. Either just Buffer, or &Buffer[0].
Did you remove the "delete Buffer" code?
Why are you using "new" and "delete" on MS (new twice, deletes commented
out), and on Registry? Also, why are yuo calling delete on item (once)? It
looks like the code you're using grants ownership to ListViewSpeed2. If
it's your job to delete those items, this surely isn't the place to do it
(that belongs in a destructor or simlar cleanup code), and you'd need to do
it for all items previously added, not just once.
Once you get these items fixed, the error *might* go away. The symptoms
look to me like you've trashed memory previously (during the processing of
the first button click).
Before you try getting GUI code to work right, you should really get a good
book on C++ and read up on how to use arrays and pointers. Then write some
simple console apps, using std::cin and std::cout to do simple text I/O.
And avoid using pointers unless and until you need them. In your code,
there's no reason for Registry or MS to be pointers, when they can just as
well be objects (e.g., "TRegistry Registry;").
-Howard