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

C / C++ / MFC

 
GeneralRe: AfxBeginThread() with a function in the main class Pin
led mike3-Aug-07 8:09
led mike3-Aug-07 8:09 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 8:14
Mark Salsbery3-Aug-07 8:14 
QuestionRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 8:27
Johpoke3-Aug-07 8:27 
AnswerRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 8:34
Mark Salsbery3-Aug-07 8:34 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 8:40
Johpoke3-Aug-07 8:40 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 8:57
Mark Salsbery3-Aug-07 8:57 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 8:13
Mark Salsbery3-Aug-07 8:13 
QuestionPostThreadMessages lost in DLL Pin
PaulCammy3-Aug-07 5:54
PaulCammy3-Aug-07 5:54 
I have a DLL that has a class derived from CWinApp.

I have another class in the DLL that needs to trigger an asynchronous process within that same DLL. Since the DLL has no window I use PostThreadMessage to trigger the process as follows:

<code>void CMyClass::TriggerAsyncProc() const
{
AfxGetApp()->PostThreadMessage(WMU_MYMSG, 0, 0L) ;
}</code>

In my class derived from CWinApp, I have tried two different methods to trap WMU_MYMSG. The first was to override PreTranslateMessage, and the second was to try to use the CWinApp message map (via ON_THREAD_MESSAGE).

The DLL is being used by a dialog application, and the TriggerAsyncProc is definately sending the message because PostThreadMessage(WMU_MYMSG, 0, 0L) returns non-zero.

The only thing I can think of is that my message is going through the message map of the dialog application instead of my class derived from CWinApp in the DLL.

Please can someone tell me why I'm losing the message, and suggest either how I correct this or an alternative method?

Thanks.
Confused | :confused:
AnswerRe: PostThreadMessages lost in DLL Pin
Mark Salsbery3-Aug-07 6:07
Mark Salsbery3-Aug-07 6:07 
QuestionRe: PostThreadMessages lost in DLL Pin
PaulCammy4-Aug-07 1:52
PaulCammy4-Aug-07 1:52 
AnswerRe: PostThreadMessages lost in DLL Pin
Mark Salsbery4-Aug-07 6:42
Mark Salsbery4-Aug-07 6:42 
GeneralRe: PostThreadMessages lost in DLL Pin
PaulCammy5-Aug-07 22:23
PaulCammy5-Aug-07 22:23 
GeneralRe: PostThreadMessages lost in DLL Pin
Blake Miller6-Aug-07 5:06
Blake Miller6-Aug-07 5:06 
GeneralRe: PostThreadMessages lost in DLL Pin
Mark Salsbery6-Aug-07 5:06
Mark Salsbery6-Aug-07 5:06 
Questiondifferentiating between literal strings and char pointers [modified] Pin
dburns3-Aug-07 4:48
dburns3-Aug-07 4:48 
AnswerRe: differentiating between literal strings and char pointers Pin
CPallini3-Aug-07 4:59
mveCPallini3-Aug-07 4:59 
GeneralRe: differentiating between literal strings and char pointers Pin
dburns3-Aug-07 5:03
dburns3-Aug-07 5:03 
GeneralRe: differentiating between literal strings and char pointers Pin
CPallini3-Aug-07 5:07
mveCPallini3-Aug-07 5:07 
GeneralRe: differentiating between literal strings and char pointers Pin
dburns3-Aug-07 5:13
dburns3-Aug-07 5:13 
GeneralRe: differentiating between literal strings and char pointers Pin
CPallini3-Aug-07 5:19
mveCPallini3-Aug-07 5:19 
GeneralRe: differentiating between literal strings and char pointers Pin
dburns3-Aug-07 5:48
dburns3-Aug-07 5:48 
GeneralRe: differentiating between literal strings and char pointers Pin
David Crow3-Aug-07 6:11
David Crow3-Aug-07 6:11 
GeneralRe: differentiating between literal strings and char pointers Pin
dburns3-Aug-07 6:22
dburns3-Aug-07 6:22 
GeneralRe: differentiating between literal strings and char pointers Pin
led mike3-Aug-07 7:16
led mike3-Aug-07 7:16 
GeneralRe: differentiating between literal strings and char pointers Pin
David Crow3-Aug-07 7:18
David Crow3-Aug-07 7:18 

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.