Click here to Skip to main content
15,906,081 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: RE: rewind the wmv file in direct show Pin
Mark Salsbery24-May-07 4:56
Mark Salsbery24-May-07 4:56 
GeneralRe: RE: rewind the wmv file in direct show Pin
rjkg24-May-07 19:31
rjkg24-May-07 19:31 
Questionrewind the wmv file in direct show Pin
rjkg29-May-07 0:02
rjkg29-May-07 0:02 
GeneralRe: RE: rewind the wmv file in direct show Pin
rjkg29-May-07 1:35
rjkg29-May-07 1:35 
QuestionPostMessage Pin
Kiran Pinjala22-May-07 0:44
Kiran Pinjala22-May-07 0:44 
AnswerRe: PostMessage Pin
Nibu babu thomas22-May-07 0:58
Nibu babu thomas22-May-07 0:58 
GeneralRe: PostMessage Pin
Kiran Pinjala22-May-07 1:19
Kiran Pinjala22-May-07 1:19 
GeneralRe: PostMessage Pin
Arman S.22-May-07 2:20
Arman S.22-May-07 2:20 
UINT SomeThreadFunc( LPVOID lpvParam_i )
{
   CString csSomeCString = _T( "Nibu" );
   // Don't use PostMessage since it won't wait for your message
   // to be processed, but if you are newing then it's 
   // ok, delete in the invoked function.
   ::SendMessage( AfxGetMainWnd()->GetSafeHwnd(), WM_PRINTLOG, reinterpret_cast< WPARAM >(&csSomeCString ), 0 );
}


Regarding to your comments. For user defined messages, people usually do Posting not Sending as PostMessage will return immedietly and thus lessen the thread delays. Use SendMessage if there is a reason for that.

Actually, your comment about newing and deleting is wrong. It is here we should either avoid of newing in a worker thread by posting it to UI thread or use SendMessage instead [opposed to what is said by comments]. The problem is the race condition [I'd say an obvious race condition]; if you PostMessage a newed object into another thread you may never be away whether that object has been deleted or not. A simple scenario is when the user closes the application jsut after the worker thread has done a PostMessage but before the UI thread ges informed about the message posted. Even with SendMessage you have to use some synchronization to avoid such unfavourable situations.

--
=====
Arman

GeneralRe: PostMessage Pin
David Crow22-May-07 3:05
David Crow22-May-07 3:05 
AnswerRe: PostMessage Pin
David Crow22-May-07 3:07
David Crow22-May-07 3:07 
Questionplace FlexGrid in ATL window(CWnd Inheritance). Pin
thatsravi21-May-07 23:55
thatsravi21-May-07 23:55 
QuestionDISP_FUNCTION Pin
tom groezer21-May-07 23:14
tom groezer21-May-07 23:14 
QuestionBmp Picture on DialogBox Pin
anilkrupakar21-May-07 23:08
anilkrupakar21-May-07 23:08 
AnswerRe: Bmp Picture on DialogBox Pin
josip cagalj21-May-07 23:49
josip cagalj21-May-07 23:49 
GeneralRe: Bmp Picture on DialogBox Pin
anilkrupakar21-May-07 23:59
anilkrupakar21-May-07 23:59 
AnswerRe: Bmp Picture on DialogBox Pin
KaЯl21-May-07 23:58
KaЯl21-May-07 23:58 
AnswerRe: Bmp Picture on DialogBox Pin
Hamid_RT22-May-07 0:27
Hamid_RT22-May-07 0:27 
QuestionCFile Pin
jannathali21-May-07 23:04
jannathali21-May-07 23:04 
AnswerRe: CFile Pin
Anurag Gandhi21-May-07 23:18
professionalAnurag Gandhi21-May-07 23:18 
AnswerRe: CFile Pin
Christian Graus21-May-07 23:42
protectorChristian Graus21-May-07 23:42 
AnswerRe: CFile Pin
Nibu babu thomas21-May-07 23:53
Nibu babu thomas21-May-07 23:53 
GeneralRe: CFile Pin
CPallini22-May-07 0:15
mveCPallini22-May-07 0:15 
AnswerRe: CFile Pin
Hamid_RT22-May-07 0:26
Hamid_RT22-May-07 0:26 
QuestionProgram do not execute Pin
kallol kumar21-May-07 22:42
kallol kumar21-May-07 22:42 
AnswerRe: Program do not execute Pin
Roger Stoltz21-May-07 23:10
Roger Stoltz21-May-07 23:10 

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.