Click here to Skip to main content
15,886,019 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Code structure Pin
CPallini7-Dec-07 1:18
mveCPallini7-Dec-07 1:18 
GeneralRe: Code structure Pin
KarstenK7-Dec-07 2:54
mveKarstenK7-Dec-07 2:54 
GeneralRe: Code structure Pin
James R. Twine7-Dec-07 4:13
James R. Twine7-Dec-07 4:13 
GeneralRe: Code structure Pin
Eytukan7-Dec-07 5:27
Eytukan7-Dec-07 5:27 
GeneralNot Able to Get Message Pin
paresh_joe7-Dec-07 0:27
paresh_joe7-Dec-07 0:27 
GeneralRe: Not Able to Get Message Pin
Hamed Musavi7-Dec-07 1:19
Hamed Musavi7-Dec-07 1:19 
GeneralRe: Not Able to Get Message Pin
paresh_joe7-Dec-07 2:24
paresh_joe7-Dec-07 2:24 
GeneralRe: Not Able to Get Message [modified] Pin
Hamed Musavi7-Dec-07 3:20
Hamed Musavi7-Dec-07 3:20 
paresh_joe wrote:
anything that we have to do while handling messages

If it's a CUSTOM message, then we shall follow the instruction:
1. Event handler MUST return LRESULT
2. Message variable should be defined in a right way, easiest: #define MyTestMessage WM_USER+1
3. Function declaration in the header file should should be written before DECLARE_MESSAGE_MAP() (e.g LRESULT OnSomething(WPARAM wParam, LPARAM lParam); )
4. In .cpp it should be declared in a MESSAGE_MAP block: (e.g.ON_MESSAGE(MyTestMessage, OnSomthing))
5. ALWAYS return 0 in the message handler function.
6. Only a window can accept messages, unless you create a custom message mapping, sending, dispatching, ... mechanism. So a CWnd object or derived classes can handle a message.

// In .h file
...
//}}AFX_MSG
  LRESULT OnSomething(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()



// In .Cpp file
...
BEGIN_MESSAGE_MAP(CMyClass, CDialog)
...
  ON_MESSAGE(MyTestMessage, OnSomething)
END_MESSAGE_MAP()

.
.
.

LRESULT CMyClass::OnSometing(WPARAM wParam, LPARAM lParam)
{
  // Do Something
  return 0;
}



// "In the end it's a little boy expressing himself." Yanni


while (I'm_alive)
{
cout<<"I love programming.";
}

modified on Friday, December 07, 2007 9:29:01 AM

GeneralRe: Not Able to Get Message Pin
paresh_joe9-Dec-07 18:00
paresh_joe9-Dec-07 18:00 
GeneralBig Project with many resources distributed over many dll's [modified] Pin
Tomerland7-Dec-07 0:07
Tomerland7-Dec-07 0:07 
GeneralRe: Big Project with many resources distributed over many dll's Pin
Hamed Musavi7-Dec-07 1:30
Hamed Musavi7-Dec-07 1:30 
GeneralRe: Big Project with many resources distributed over many dll's Pin
Tomerland7-Dec-07 1:56
Tomerland7-Dec-07 1:56 
QuestionHow to attach a Dialog to a SDI Application Pin
msr_codeproject6-Dec-07 23:47
msr_codeproject6-Dec-07 23:47 
AnswerRe: How to attach a Dialog to a SDI Application Pin
toxcct7-Dec-07 0:18
toxcct7-Dec-07 0:18 
GeneralUnmanaged Memory Profiler Pin
Jeffrey Walton6-Dec-07 23:36
Jeffrey Walton6-Dec-07 23:36 
GeneralRe: Unmanaged Memory Profiler Pin
James R. Twine7-Dec-07 4:14
James R. Twine7-Dec-07 4:14 
GeneralRe: Unmanaged Memory Profiler Pin
Bram van Kampen7-Dec-07 11:23
Bram van Kampen7-Dec-07 11:23 
GeneralRe: Unmanaged Memory Profiler Pin
Bram van Kampen7-Dec-07 11:25
Bram van Kampen7-Dec-07 11:25 
GeneralRe: Unmanaged Memory Profiler Pin
Jeffrey Walton7-Dec-07 15:45
Jeffrey Walton7-Dec-07 15:45 
GeneralRe: Unmanaged Memory Profiler Pin
Mike Dimmick7-Dec-07 16:38
Mike Dimmick7-Dec-07 16:38 
GeneralRe: Unmanaged Memory Profiler Pin
Jeffrey Walton7-Dec-07 18:28
Jeffrey Walton7-Dec-07 18:28 
GeneralRe: Unmanaged Memory Profiler Pin
Bram van Kampen8-Dec-07 16:07
Bram van Kampen8-Dec-07 16:07 
GeneralRe: Unmanaged Memory Profiler Pin
Jeffrey Walton8-Dec-07 18:31
Jeffrey Walton8-Dec-07 18:31 
GeneralRe: Unmanaged Memory Profiler Pin
Bram van Kampen9-Dec-07 14:13
Bram van Kampen9-Dec-07 14:13 
QuestionHow to Access CStringArray object from one class to other Pin
Atul236-Dec-07 23:13
Atul236-Dec-07 23:13 

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.