|
I just wanted that at last, you understood my needs
and now, I have memory leaks,
There is no spoon.
|
|
|
|
|
Memory leaks because you called TerminateThread(), who would have thought.... Just kidding.
But of COURSE you have memory leaks, since your thread did not terminate 'normally'.
You really ARE dealing with a poorly designed driver, aren't you? They should have provided at least a 'is data available' call for you or something. Is there truly no way to set any kind of timeout in case there is no data? Most device drivers will just return that there are no bytes to read instead of hanging your thread up.
Part of your leak might be from the CWinThread object returned from the AfxBeginThread call. When you assssinate your thread, you might want to at least delete the CWinThread object data.
I truly encourage you to seek another driver, or at least a design option that does not force you to continually start and kill threads in this manner.
Good luck!
|
|
|
|
|
Hi,
When I delete the thread from the m_pThread (CWinThread*) it crashes. So, I am using the simple Win32 API function CreateThread and TerminateThread and there is no memory leaks. Why doing complex as we can do simple?
Indeed, the driver is poorly implemented. It's a USB driver for HP calculators (shipped by HP) and it does not handle correctly the overlapped IO (the system crashes when I use overlapped IOs), if it would have handle them correctly, of course, overlapped IO would have been much more simple. But now, with this brutal algorithm of calling ReadFile in a thread and kill the thread after an amount of time and repeat the operation until something comes works fine now But I'm agree that overlapped IO should be the best choice. Of course, using overlapped IOs, is the first idea that came in mind.
There is no spoon.
|
|
|
|
|
Hi,
When I delete the thread from the m_pThread (CWinThread*) it crashes. So, I am using the simple Win32 API function CreateThread and TerminateThread and there is no memory leaks. Why doing complex as we can do simple?
Indeed, the driver is poorly implemented. It's a USB driver for HP calculators (shipped by HP) and it does not handle correctly the overlapped IO (the system crashes when I use overlapped IOs), if it would have handle them correctly, of course, overlapped IO would have been much more simple. But now, with this brutal algorithm of calling ReadFile in a thread and kill the thread after an amount of time and repeat the operation until something comes works fine now But I'm agree that overlapped IO should be the best choice. Of course, using overlapped IOs, is the first idea that came in mind.
Thanks to all of you for the help
Best regards.
There is no spoon.
|
|
|
|
|
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi
I am trying to add a dialog to an existing project.
I add the resource file .rc then add the dialog and double click on it an the class creator/wizard thing appears so I enter the class name.
Now I try to add a button and test it by adding a show message to it's event handler.
The problem is, it doesn't compile and the error is:
IDD_DIALOG1 = undefined
enum {IDD = IDD_DIALOG1};
Help!
|
|
|
|
|
why did you copy the .RC file ???
as far as i know, when you create a dialog, you set its ID. the same when you add a button to the dialog... then, you can associate an event handler to that ID...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
why did you copy the .RC file ???
I created the .rc file i.e. added it to the project
then the dialog is added as a child of the .rc file
Am I doing this all wrong?
Can you step me through what you would do to add a dialog with a button?
Cheers
|
|
|
|
|
|
TheProffessor wrote:
I am trying to add a dialog to an existing project.
Exactly how did you do this?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
#include"resource.h" didn't work
still get the same error
error C2065: 'IDD_SHUTDOWN' : undeclared identifier
|
|
|
|
|
|
ThatsAlok wrote:
Then Check wheather IDD_SHUTDOWN is defined in Resource.h or not!
It wasn't defined! But now I get lots of errors saying that everything is already defined in a .obj file.
????
|
|
|
|
|
Hi,
How can implement Windows Explorer-style folder tree view?
Would any one give me a hint?
Regards.
|
|
|
|
|
|
Thank you!
And would you let me know how can implement Explorer-style file list view?
Regards.
|
|
|
|
|
Sorry, I'm not your personal teacher and I'm not doing your homework for you.
If you're too lazy to search an article yourself, then I can't help you anymore.
Don't try it, just do it!
|
|
|
|
|
HI ,
I was just trying to create a tool box application but suddenly realised that i have no ideahow to go about doing it.
If somebody could guide me how i can go about implementing it I would be very happy to learn and try it out.
thanks
U get wht u Give
|
|
|
|
|
What's a toolbox ?
something part of an existing application you are building or something new ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I have to build my own tool box.
U get wht u Give
|
|
|
|
|
I am new to C++ and I am trying to write a small program that would backup an access database file from the hard drive to a zip drive.
I would appreciate any help.
Thank you.
|
|
|
|
|
Sounds very much like "do my homework for me please".
But I don't care....
Get a library for creating zip files from the internet, and use it.. that is the rough description of what you have to do.
Don't try it, just do it!
|
|
|
|
|
Sorry I have not been in school for a long time....., I have not used C++ for a few years and was trying to relearn it. I have been trying to figure out how to use the ifstream and ofstream with no luck.
|
|
|
|
|
Can't you use CopyFile() or SHFileOperation() ? If not, then I guess I don't understand the question. Is there something special about a Zip drive (I've never used one)? Don't you just copy files to it like any other drive?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Nothing special about ZIP drive, except you might (more like probably) get error if no disk is in it. Otherwise, pretty much just like a floppy or any other read/rite drive. I also suspect the CopyFile or SHFileOperation will work just fine.
|
|
|
|