Click here to Skip to main content
15,903,388 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionthread confusions Pin
anilaabc28-Nov-08 22:07
anilaabc28-Nov-08 22:07 
AnswerRe: thread confusions Pin
sashoalm29-Nov-08 0:12
sashoalm29-Nov-08 0:12 
AnswerRe: thread confusions Pin
Code-o-mat29-Nov-08 0:20
Code-o-mat29-Nov-08 0:20 
AnswerRe: thread confusions Pin
Mark Salsbery29-Nov-08 7:20
Mark Salsbery29-Nov-08 7:20 
GeneralRe: thread confusions Pin
anilaabc30-Nov-08 22:20
anilaabc30-Nov-08 22:20 
GeneralRe: thread confusions Pin
Mark Salsbery1-Dec-08 5:43
Mark Salsbery1-Dec-08 5:43 
GeneralRe: thread confusions Pin
anilaabc1-Dec-08 22:08
anilaabc1-Dec-08 22:08 
QuestionI want to run thread at regular interval in multimedia timer,how should i do?please tell me the better approch Pin
anilaabc28-Nov-08 21:29
anilaabc28-Nov-08 21:29 
I want to do two to three tasks at the same time at regular interval ,time is important so i m using multimedia timer .
problem is ....timer run the thread only once .code is below
when I click button thread is created and multimedia timer is set.
count is an integer initialized with 0.
I suspend thread to resume at regular interval .
void CTimerDlg::Onbtnstart()
{

Thread=AfxBeginThread(ThreadDisplay, this, THREAD_PRIORITY_TIME_CRITICAL,0 ,CREATE_SUSPENDED);
handle=Thread->m_hThread;
Thread->m_bAutoDelete=false;
timeSetEvent(100, 0, TimeProcVideo, (DWORD)this, TIME_PERIODIC);

}

//thread analyzing data
UINT ThreadDisplay(LPVOID lParam)
{
CTimerDlg *obj=(CTimerDlg*) lParam;
obj->abc();
return 1;
}

void CTimerDlg::abc()
{


count++;
char a[20];
GetDlgItem(IDC_STATIC)->SetWindowText("");
CString s=itoa(count,a,10);
GetDlgItem(IDC_STATIC)->SetWindowText(s);

SuspendThread(handle);

}
void CALLBACK TimeProcVideo(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
CTimerDlg* timer=(CTimerDlg*) dwUser;

timer->ControlThreads();



}
void CTimerDlg::ControlThreads()
{




ResumeThread(handle);
}
AnswerRe: I want to run thread at regular interval in multimedia timer,how should i do?please tell me the better approch Pin
Garth J Lancaster28-Nov-08 23:43
professionalGarth J Lancaster28-Nov-08 23:43 
GeneralRe: I want to run thread at regular interval in multimedia timer,how should i do?please tell me the better approch Pin
anilaabc30-Nov-08 22:15
anilaabc30-Nov-08 22:15 
QuestionHow to use delete for CStringList Pin
Max++28-Nov-08 19:04
Max++28-Nov-08 19:04 
AnswerRe: How to use delete for CStringList Pin
Mark Salsbery28-Nov-08 19:16
Mark Salsbery28-Nov-08 19:16 
QuestionTerminating threads cleanly in a DLL when it is unloaded Pin
Code-o-mat28-Nov-08 11:19
Code-o-mat28-Nov-08 11:19 
AnswerRe: Terminating threads cleanly in a DLL when it is unloaded Pin
Mark Salsbery28-Nov-08 11:57
Mark Salsbery28-Nov-08 11:57 
GeneralRe: Terminating threads cleanly in a DLL when it is unloaded Pin
Code-o-mat28-Nov-08 12:20
Code-o-mat28-Nov-08 12:20 
GeneralRe: Terminating threads cleanly in a DLL when it is unloaded Pin
Randor 28-Nov-08 12:37
professional Randor 28-Nov-08 12:37 
GeneralRe: Terminating threads cleanly in a DLL when it is unloaded Pin
Code-o-mat29-Nov-08 0:23
Code-o-mat29-Nov-08 0:23 
GeneralRe: Terminating threads cleanly in a DLL when it is unloaded Pin
Randor 29-Nov-08 17:24
professional Randor 29-Nov-08 17:24 
AnswerRe: Terminating threads cleanly in a DLL when it is unloaded Pin
Richard Andrew x6428-Nov-08 12:40
professionalRichard Andrew x6428-Nov-08 12:40 
GeneralRe: Terminating threads cleanly in a DLL when it is unloaded Pin
Code-o-mat28-Nov-08 23:39
Code-o-mat28-Nov-08 23:39 
AnswerRe: Terminating threads cleanly in a DLL when it is unloaded Pin
Jijo.Raj28-Nov-08 12:41
Jijo.Raj28-Nov-08 12:41 
GeneralRe: Terminating threads cleanly in a DLL when it is unloaded Pin
Code-o-mat28-Nov-08 23:56
Code-o-mat28-Nov-08 23:56 
QuestionGDI+ MeasureString - optional codepointsFitted function parameter Pin
bob1697228-Nov-08 10:16
bob1697228-Nov-08 10:16 
AnswerRe: GDI+ MeasureString - optional codepointsFitted function parameter Pin
Randor 28-Nov-08 13:27
professional Randor 28-Nov-08 13:27 
GeneralRe: GDI+ MeasureString - optional codepointsFitted function parameter Pin
bob1697228-Nov-08 14:34
bob1697228-Nov-08 14:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.