Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI Guys,
In my application i am using two thread one to transmit voice and another to receive voice. Now i need to find how bytes of voice data send/receive.to update it regularly i am using UpdateData(False) inside the thread loop but i am getting an error . So pls let me know how to overcome this problem .I used windows Thread.


I tried cnewDlg* ptr=(CnewDlg*)lpParam;
ptr->UpdateData(FALSE); this but i am getting Assertion Failure


Thanks in Advance for ur Valuable comments...
Posted
Updated 3-Jul-12 23:41pm
v2
Comments
Jochen Arndt 4-Jul-12 5:59am    
Are your threads worker threads and you want to update data in a dialog created by your main thread?
Richard MacCutchan 4-Jul-12 6:33am    
What is the value of lpParam, i.e. does it point to a properly created dialog? Also what is the exact detail of the assertion?
Member 9102753 4-Jul-12 6:48am    
LpParam contain Recorded buffer Value and it will do processing in thread

1 solution

Call UpdateData only from the same thread that created the dialog and its controls (the GUI thread), not from any worker threads. If you want to update your dialog regularly, either use a timer (SetTimer[^]/CWnd::SetTimer[^]) or send/post (SendMessage[^]/PostMessage[^]) messages towards your dialog from the worker thread. Also, if sending/posting messages, try using the handles of the windows you are trying to send/post messages to rather then handing the pointers to any CWnd-descendants (like CDialog) over to the thread and calling its methods.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900