Can a WorkerThread do a SendMessage to a CDialog
-
Hi, I have a Worker thread started in my main thread CWinAPP and I am trying to do a SendMessage to a CDIalog seems I can only do a Send/PostMessage to the CMainFrame Main Window can someone corrabrate or dispute this and if so is there a way to get a Message to the CDialog thanks
-
Hi, I have a Worker thread started in my main thread CWinAPP and I am trying to do a SendMessage to a CDIalog seems I can only do a Send/PostMessage to the CMainFrame Main Window can someone corrabrate or dispute this and if so is there a way to get a Message to the CDialog thanks
What kind of communication you want to make with the dialog? Is that dialog is alive when you send the message? Note that the Post message will not block your thread, and sendmessage will.
-
Hi, I have a Worker thread started in my main thread CWinAPP and I am trying to do a SendMessage to a CDIalog seems I can only do a Send/PostMessage to the CMainFrame Main Window can someone corrabrate or dispute this and if so is there a way to get a Message to the CDialog thanks
-
What kind of communication you want to make with the dialog? Is that dialog is alive when you send the message? Note that the Post message will not block your thread, and sendmessage will.
-
Hi, I have a Worker thread started in my main thread CWinAPP and I am trying to do a SendMessage to a CDIalog seems I can only do a Send/PostMessage to the CMainFrame Main Window can someone corrabrate or dispute this and if so is there a way to get a Message to the CDialog thanks
Please answer :) : - Whereby does the secondory thread know the dialog ? - When will the first message be sent ?
They sought it with thimbles, they sought it with care; They pursued it with forks and hope; They threatened its life with a railway-share; They charmed it with smiles and soap. :)
-
Please answer :) : - Whereby does the secondory thread know the dialog ? - When will the first message be sent ?
They sought it with thimbles, they sought it with care; They pursued it with forks and hope; They threatened its life with a railway-share; They charmed it with smiles and soap. :)
-
I save a CWnd * or Cialog * pointer in a global object on the heap The thread retervies that pointer However it seems that the Send/PostMessage can only send messages to the CMainFrame
Do you have such an "if" statement ? :) :
{
//..HWND hDlg = g_pcDialog->GetSafeHwnd();
if (hDlg) {
::SendMessage(hDlg, WM_COMMAND, IDOK, 0);
}//..
}They sought it with thimbles, they sought it with care; They pursued it with forks and hope; They threatened its life with a railway-share; They charmed it with smiles and soap. :)
-
I save a CWnd * or Cialog * pointer in a global object on the heap The thread retervies that pointer However it seems that the Send/PostMessage can only send messages to the CMainFrame
ForNow wrote:
However it seems that the Send/PostMessage can only send messages to the CMainFrame
That's not true... you can post messages to any HWND[^] (which is the appropriate method versus saving a CWnd or CDialog). In another words, you can send messages to anything that has a window associated with it (not the only way, but it's a good generic statement), which sort of leads to a common way of messaging to classes that don't have other framework characteristics, make an invisible window for them that others can use as messaging targets.
-
Hi, I have a Worker thread started in my main thread CWinAPP and I am trying to do a SendMessage to a CDIalog seems I can only do a Send/PostMessage to the CMainFrame Main Window can someone corrabrate or dispute this and if so is there a way to get a Message to the CDialog thanks
Note that SendMessage() cannot be used to send messages to controls that were *not* created by the thread sending the message. See my answer to This Question[^]