Click here to Skip to main content
15,902,112 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 7:20
Anonymous11-Jun-04 7:20 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 7:30
Anonymous11-Jun-04 7:30 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 7:48
Anonymous11-Jun-04 7:48 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 8:00
David Crow11-Jun-04 8:00 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 8:32
Anonymous11-Jun-04 8:32 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 8:40
David Crow11-Jun-04 8:40 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 8:57
Anonymous11-Jun-04 8:57 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 9:36
David Crow11-Jun-04 9:36 
Anonymous wrote:
So how can application send the message to itself using the same 3 steps?

It matters not to SendMessage() and PostMessage() of the origin of the message (i.e., registered or some arbitrary number like WM_APP + 5). Consider:

BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
    ON_REGISTERED_MESSAGE(BlackIcePrintMessage, OnPrinterMsg)
END_MESSAGE_MAP()
 
LRESULT CMyDialog::OnPrinterMsg( WPARAM, LPARAM )
{
    AfxMessageBox("The printer has finished doing whatever it was doing!");
}
 
UINT ThreadProc( LPVOID pParam )
{
    HWND hWnd = *((HWND *) pParam);
 
    // do some stuff here
 
    PostMessage(hWnd, BlackIcePrintMessage, 0, 0);
 
    return 0;
}
 
void CMyDialog::OnPrint()
{
    HWND hWnd = GetSafeHwnd();
 
    // send the thread a handle to our window.  we could also send it the 'this'
    // pointer but it would be overkill for this example
    AfxBeginThread(ThreadProc, &hWnd);
}




"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen


GeneralRe: sending messages within an application. Pin
Anonymous14-Jun-04 3:51
Anonymous14-Jun-04 3:51 
GeneralPassing cdc across threads Pin
Member 51425211-Jun-04 5:35
Member 51425211-Jun-04 5:35 
GeneralRe: Passing cdc across threads Pin
palbano11-Jun-04 5:41
palbano11-Jun-04 5:41 
GeneralRe: Passing cdc across threads Pin
suiram4011-Jun-04 7:48
suiram4011-Jun-04 7:48 
GeneralRe: Passing cdc across threads Pin
Anonymous11-Jun-04 23:57
Anonymous11-Jun-04 23:57 
GeneralRe: Passing cdc across threads Pin
Member 51425212-Jun-04 0:00
Member 51425212-Jun-04 0:00 
Questionhow do i load a dll made in C#? Pin
FASTian11-Jun-04 5:17
FASTian11-Jun-04 5:17 
AnswerRe: how do i load a dll made in C#? Pin
Alexander M.,11-Jun-04 5:43
Alexander M.,11-Jun-04 5:43 
GeneralRe: how do i load a dll made in C#? Pin
palbano11-Jun-04 6:47
palbano11-Jun-04 6:47 
AnswerRe: how do i load a dll made in C#? Pin
Andy Brummer11-Jun-04 9:25
sitebuilderAndy Brummer11-Jun-04 9:25 
AnswerRe: how do i load a dll made in C#? Pin
krisko11-Jun-04 9:59
krisko11-Jun-04 9:59 
AnswerRe: how do i load a dll made in C#? Pin
Joel Lucsy12-Jun-04 14:12
Joel Lucsy12-Jun-04 14:12 
GeneralHelp Wanted to display dlg box frm the Service Pin
ThatsAlok11-Jun-04 5:16
ThatsAlok11-Jun-04 5:16 
GeneralRe: Help Wanted to display dlg box frm the Service Pin
David Crow11-Jun-04 5:17
David Crow11-Jun-04 5:17 
GeneralRe: Help Wanted to display dlg box frm the Service Pin
ThatsAlok11-Jun-04 23:38
ThatsAlok11-Jun-04 23:38 
GeneralRe: Help Wanted to display dlg box frm the Service Pin
David Crow14-Jun-04 2:27
David Crow14-Jun-04 2:27 
GeneralRe: Help Wanted to display dlg box frm the Service Pin
ThatsAlok15-Jun-04 0:58
ThatsAlok15-Jun-04 0:58 

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.