|
This is in response to your email to me. I have not worked too much on threads, but will surely help you if I could. My suggestion is that you post it at CP, and you will get plenty of us. Moreover, threads are not something that I've mastered.
|
|
|
|
|
I have tried out my way but not getting the proper result.
string problem is as remain as but even dw never goes in the any of the cas like
case WAIT_OBJECT_0 + 1: +2 or +3.
what should I do ?
how can i manage it ?
<code>
unsigned __stdcall Thread(void* pArguments )
{
HRESULT hr=NULL;
struct argument_list *Lparam= (argument_list *)pArguments ;
Package pkg;
DWORD dw=WaitForMultipleObjects(ListBoxItemCount,hThread,TRUE,5000 );
switch (dw)
{
case WAIT_OBJECT_0 + 0:
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);
break;
case WAIT_OBJECT_0 + 1:
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);
break;
case WAIT_OBJECT_0 + 2:
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);
break;
case WAIT_FAILED:
break;
case WAIT_TIMEOUT:
break;
}
if(hr==S_OK)
{
MessageBox(0,L"thread gone finished" ,L"therad",0);
_endthreadex( 0 );
}
</code>
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Supposedly the case WAIT_FAILED works. Anyway ...
A couple of questions;
DWORD dw=WaitForMultipleObjects(ListBoxItemCount,hThread,TRUE,5000 );
What you want to do with this code? Where does LitBoxItemCount come from? Where does hThread come from?
How many threads do you have?
I need to know the answers of these questions before I can say the reasons of your problem.
--
=====
Arman
|
|
|
|
|
May I send you detail on your email?
because the proper format and written mail is ready.
May I ...?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Ok, do it.
--
=====
Arman
|
|
|
|
|
have you got any idea or do you need any feed back?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
This is a multithreading issue and to overcome one needs a proper level of detailed information. What you have posted as code didn't cover all the details and thus you should provide more details. I've already asked about the questions that are not clear [at least to me].
--
=====
Arman
|
|
|
|
|
would you need any thing more specific information?
I am ready to provide you.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
just one question.
I need your little help. when and how the thread manage?
Suppose
I have four thread
hThread[0] = (HANDLE)_beginthreadex(NULL, 0, &Thread ,&l,NULL, &threadID);
hThread[1] = (HANDLE)_beginthreadex(NULL, 0, &Thread ,&l,NULL, &threadID);
hThread[2] = (HANDLE)_beginthreadex(NULL, 0, &Thread ,&l,NULL, &threadID);
hThread[3] = (HANDLE)_beginthreadex(NULL, 0, &Thread ,&l,NULL, &threadID);
and the global function
unsigned __stdcall Thread(void* pArguments )
{
HRESULT hr=NULL;
struct argument_list *Lparam= (argument_list *)pArguments ;
Package pkg;
threadID++;
DWORD dw=WaitForMultipleObjects(ListBoxItemCount,<big>hThread[threadID]</big>,TRUE,5000 );
switch (dw)
{
case WAIT_OBJECT_0 + 0:
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);
break;
case WAIT_OBJECT_0 + 1:
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);
break;
case WAIT_OBJECT_0 + 2:
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);
break;
case WAIT_FAILED:
break;
case WAIT_TIMEOUT:
break;
}
if(hr==S_OK)
{
MessageBox(0,L"thread gone finished" ,L"therad",0);
_endthreadex( 0 );
}
threadID--;
return 0;
}
how can i decide the when which thread come at hThread[],
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Arman Z. Sahakyan wrote: What you want to do with this code? Where does LitBoxItemCount come from? Where does hThread come from?
How many threads do you have?
What you want to do with this code?
with this code i am tring to synchronize my threads.
Where does LitBoxItemCount come from?
this will come from the listview control (itemcount).I put in my code as global so Global function Thread can use it.
Where does hThread come from?
hThread is array of handle which assigne the thread.
How many threads do you have?
well ,for sample application have created the three worker thread (means if there are total three files in the listview control so itemcount will be three means LitBoxItemCount)
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Hi,
my requirement is need of physical font name. ie arial.ttf with path for Arial and one more problem in not from registry any other way.
Thanks in advance!
Murali.M
Have A Nice Day!
Murali.M
|
|
|
|
|
Is EnumFont* helpfuls for you (EnumFonts,EnumFontFamilies)
|
|
|
|
|
I got an Email not Reply of (amitmistry_petlad) but what was your question
|
|
|
|
|
hi,
from the font dialog i can select the font name. for my project i need font file name arial.ttf for arial. But it should be possible to read from registry HKEY_LOCAL_MACHINE. for this used need read permission(I think its an problem in vista OS).
Thanks in advance.
Have A Nice Day!
Murali.M
|
|
|
|
|
Have you seen 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
|
|
|
|
|
how this can help me for get font file name like arial.ttf from font name arial.
Have A Nice Day!
Murali.M
|
|
|
|
|
you asked for the exact path of a font, which is exactly what this API gives you
|
|
|
|
|
Hello all,
I want to make a checkbox in my header(of list control) and have select all and deselect All, facility inside it(as we have it in our mail boxes).
can anybody help me in this
thanks in advance
|
|
|
|
|
XListCtrl[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
What is the maximum size of a combo box. How many entries can i have in a combo box?
|
|
|
|
|
looking at the index types, i'd say the maximum an int can store...
why are you worry about ?
|
|
|
|
|
Can i add a thousand strings into a combo box? Is there a limit to the data that can be stored in the combo box?
|
|
|
|
|
even if you're on a 16 bits environment, an int can store (2^16)/2 == 32768...
so, think of what you can store on a 64 bits system...
but hey !! you didn't answered my questions !
|
|
|
|
|
I have a database for face recognition and speaker recognition. So i wanted to know the maximum number of people i can have in the database if i display all the names in the combo box
I added 65535 string into the combo box and it works fine.. Thank you
|
|
|
|
|
hey, hear me well. i didn't say the size limit was 65536 either !
but is it that good to put all that strings in a only combobox ? wouldn't it be better to use a CListCtrl for instance ?
|
|
|
|
|