Click here to Skip to main content
15,892,697 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionVC++ Tutorial? Pin
Pr0f17-Feb-07 15:41
Pr0f17-Feb-07 15:41 
AnswerRe: VC++ Tutorial? Pin
David Crow17-Feb-07 16:03
David Crow17-Feb-07 16:03 
AnswerRe: VC++ Tutorial? Pin
Ravi Bhavnani17-Feb-07 16:26
professionalRavi Bhavnani17-Feb-07 16:26 
AnswerRe: VC++ Tutorial? Pin
Hamid_RT18-Feb-07 4:45
Hamid_RT18-Feb-07 4:45 
AnswerRe: VC++ Tutorial? Pin
Pr0f19-Feb-07 10:06
Pr0f19-Feb-07 10:06 
QuestionUser message Pin
Oliver12317-Feb-07 12:16
Oliver12317-Feb-07 12:16 
AnswerRe: User message Pin
Ravi Bhavnani17-Feb-07 15:06
professionalRavi Bhavnani17-Feb-07 15:06 
AnswerRe: User message Pin
Gary R. Wheeler18-Feb-07 2:37
Gary R. Wheeler18-Feb-07 2:37 
Here's a quick, general introduction to user-defined messages. I'm assuming you're using MFC here.

1. Define a message identifier. You can base it off of WM_USER or WM_APP:
#define WM_MY_MESSAGE (WM_APP + 1)

2. Declare a message handler in your dialog class:
afx_msg LRESULT OnMyMessage(WPARAM wParam,LPARAM lParam);

3. Add an entry to the message map for your dialog class:
BEGIN_MESSAGE_MAP(...)
// ...
ON_MESSAGE(WM_MY_MESSAGE,OnMyMessage)
// ...
END_MESSAGE_MAP()

4. Define your message handler:
LRESULT MyDialogClass::OnMyMessage(WPARAM wParam,LPARAM lParam)
{
  // ...
}

5. Finally, send the message when needed:
my_dialog->SendMessage(WM_MY_MESSAGE,
                       (WPARAM)first_parameter,
                       (LPARAM)second_parameter);

where first_parameter and second_parameter are whatever values you want to send with the message.


Software Zen: delete this;

QuestionChanging Shapes of Windows Pin
AprNgp17-Feb-07 8:31
AprNgp17-Feb-07 8:31 
AnswerRe: Changing Shapes of Windows Pin
Waldermort17-Feb-07 8:33
Waldermort17-Feb-07 8:33 
GeneralRe: Changing Shapes of Windows Pin
AprNgp17-Feb-07 8:43
AprNgp17-Feb-07 8:43 
GeneralRe: Changing Shapes of Windows Pin
Hamid_RT18-Feb-07 5:26
Hamid_RT18-Feb-07 5:26 
GeneralRe: Changing Shapes of Windows Pin
Waldermort18-Feb-07 5:53
Waldermort18-Feb-07 5:53 
GeneralRe: Changing Shapes of Windows Pin
Hamid_RT18-Feb-07 5:31
Hamid_RT18-Feb-07 5:31 
AnswerRe: Changing Shapes of Windows Pin
Newbie0017-Feb-07 10:56
Newbie0017-Feb-07 10:56 
GeneralRe: Changing Shapes of Windows Pin
Hamid_RT18-Feb-07 5:23
Hamid_RT18-Feb-07 5:23 
QuestionRe: Changing Shapes of Windows Pin
Newbie0018-Feb-07 6:10
Newbie0018-Feb-07 6:10 
AnswerRe: Changing Shapes of Windows Pin
Hamid_RT18-Feb-07 5:23
Hamid_RT18-Feb-07 5:23 
QuestionHow to change IWebBrowser2->LocationName ? Pin
amsdev17-Feb-07 7:48
amsdev17-Feb-07 7:48 
AnswerRe: How to change IWebBrowser2->LocationName ? Pin
Michael Dunn17-Feb-07 9:13
sitebuilderMichael Dunn17-Feb-07 9:13 
AnswerRe: How to change IWebBrowser2->LocationName ? Pin
prasad_som17-Feb-07 15:50
prasad_som17-Feb-07 15:50 
QuestionDirect X 9.0 and Visual C++ 6.0 Pin
Dosin17-Feb-07 5:39
Dosin17-Feb-07 5:39 
AnswerRe: Direct X 9.0 and Visual C++ 6.0 Pin
Waldermort17-Feb-07 6:40
Waldermort17-Feb-07 6:40 
QuestionPalettes and HDC?? Pin
dSolariuM17-Feb-07 3:01
dSolariuM17-Feb-07 3:01 
AnswerRe: Palettes and HDC?? Pin
Waldermort17-Feb-07 3:20
Waldermort17-Feb-07 3:20 

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.