|
OK, I'm no specialist for WaitObject.
And I still do not understand what the code is intended for.
But lets start from the beginning.
You are creating 3 threads (thread 0 to thread 2)
While you have hardcoded the three in the loop index you use the variable ListBoxItemCount in the thread.
Looking at your previous answer you say hThread[0] ... hThread[3].
How much is ListBoxItemCount?
Because hThread[3] is never initialized.
In the way the code is now, it could happen that a task switch occurs in the thread starting loop, after one or two threads where created. In this case the Wait function must fail because not all thread handles in the list are initialized.
I understand that this is only a sample code to demonstrate your problem. But I have also doubts that you are going in the right direction. It is very likely, that if you change your design, the code that troubles you will disappear.
Greets
Leo
|
|
|
|
|
Amit, please do not email me or anyone else directly asking for help.
I saw you've previously done so at least to brahmma earlier and twice to me today.
Chris Maunder wrote:
Everyone here helps because they enjoy helping others, not because it's their job.
in this[^] valuable post.
Regarding your threading problem, I have the following opinion:
amitmistry_petlad wrote:
1)I have to wait/stop the main thread until the work threads finished his task.
This implies that you've misunderstood the concept of multithreading since you're still doing things in serial. Spawning other threads is for doing things in parallel.
You have to re-evaluate your design.
I also suggest you read Joe Newcomer's article about worker threads here[^] before asking more questions. The article will help you understand the basics, asking the "right" questions in this forum and the answers you get will also make more sense to you.
The article refers to how to use MFC classes, but the concept of multithreading is still the same. You don't seem to be using MFC, but you haven't stated that clearly in any of your posts so I'm not really sure whether you use MFC or not.
I also advise you to read the other articles Joe refers to in his article about multithreading to get a more complete picture of the concept.
In my opinion, Newcomer's article explains the basics of multithreading better than any article I've found.
I really hope this helps you.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Extremely Sorry !
In future, I will take care .
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
i have to sense the finger print from a sensor and to generate a key for it. how to do this with mfc. pls help me
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Did you check out the CFingerPrint class?
Provide enough information, or nobody will be able to help you.
|
|
|
|
|
i searche for CFingerPrint class. but there is no result
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
You searched for CFingerPrint ? That was a joke! You need to split this task before you can get some help. You can't ask a question like "How do I get this application developed?". Read the sticky post at the top of this page, which says "How to get an answer to your question". How far have you succeeded in developing this application? Do you have a problem reading data from the finger print device or do you not know how to generate a key from the data you receive from the device?
|
|
|
|
|
i dont know how to read the data from finger print and to genrate key for it. i didnt ask for the code. just an idea. since iam new to this concept
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Do you have any APIs or libraries for the device? (From the manufacturer of the device)
|
|
|
|
|
Griaule fingerprint recognition - They have an SDK. Download it here[^]. Additionally, google for download+fingerprint+sdk.
|
|
|
|
|
i am having the sensor in a usb drive
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: i am having the sensor in a usb drive
You can keep that.
By the way, did you download and try the SDK that I pointed out in my previous post?
"The difficulty lies, not in the new ideas, but in escaping from the old ones."
-- John Maynard Keyes, 1936
|
|
|
|
|
The CFingerPrint class? That's old-skool.
I use the CSwissArmyKnife and CDuctTape classes - they fix EVERYTHING!
Thanks for the reply about WM_KEYDOWN handling the other day. I couldn't find the original post
to thank you
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: Thanks for the reply about WM_KEYDOWN handling the other day. I couldn't find the original post
to thank you
You're welcome. Here it is[^]
Mark Salsbery wrote: I use the CSwissArmyKnife and CDuctTape classes - they fix EVERYTHING!
Hey, CDuctTape is obsolete. You need to use the CDuctTapeEx class, which is the latest.
Shog on learning VB6: Ah, that would have been VB6. Kicked my ass anyway. So easy to learn, just like falling down a flight of stairs...
|
|
|
|
|
brahmma wrote: Hey, CDuctTape is obsolete. You need to use the CDuctTapeEx class, which is the latest.
Excellent! Thanks for the heads-up!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hi deeps_cute
if u know about finger print sensor then please give me some idea about this
thanks
hi
|
|
|
|
|
yes sure
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
hi
please give me idea then
thanks
hi
|
|
|
|
|
deeps_cute wrote: how to do this with mfc.
How would you do it without MFC?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I am developing my application in VS2005 MFC. I have selected multi-byte charater set in project settings, now i need to save/copy japanese string from TCHAR array into CString variable without changing multi-byte charater encoding to unicode encoding in project settings.
Sachin P.
|
|
|
|
|
A CString holds TCHAR s, so you don't need to do anything special. Just assign your TCHAR array to a CString variable.
|
|
|
|
|
To add to Michael's reply...
If the Japanese string is Unicode then you don't want to store it in a TCHAR array. It should be
in a wchar_t array. Then use a CStringW instead of a generic CString.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Can somebody help me on how to change the caption in StringTable programmatically. Like i will select an ID and change it's caption through code.
|
|
|
|
|
Look up the APIs BeginUpdateResource, UpdateResource, EndUpdateResource. For a description of the in-memory format of string tables, see here[^].
|
|
|
|
|
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|