Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
I noticed that there is 2 verision of sendMessage()
 
one under the CWnd class, and another uder the WINAPI
 
I found the prototype of the 2 sendMesage on MSDN.
 
LRESULT WINAPI SendMessage(
	HWND hWnd,
	UINT Msg,
	WPARAM wParam,
	LPARAM lParam
);
 
CWnd::LRESULT SendMessage(
	UINT message,
	WPARAM wParam = 0,
	LPARAM lParam = 0 
);
 
Question:
1.What is the difference between these two?
2.Which verision is used under what situation?( an example would be nice)
3.For the CWnd class verision, that is the hWnd send? ( does it default to the hWnd of the object that sends the message?)
 
Thanks ~
Posted 3-Dec-12 9:43am
Comments
CPallini at 3-Dec-12 17:08pm
   
That's the peculiarity of (the original?) MFC: a thin wrapper around the Windows API.
Mohibur Rashid at 3-Dec-12 22:04pm
   
I believe you need to understand both how windows work, how mfc work under windows and also C++ to understand how mfc work in this situation
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

chronoseraph wrote:
1.What is the difference between these two?

One belongs to the Windows API and the other is the MFC version.
 
chronoseraph wrote:
2.Which verision is used under what situation?( an example would be nice)

If you're using MFC, you might as well use the MFC version... it's usually easier to use when you're in that context anyway.
 
chronoseraph wrote:
3.For the CWnd class verision, that is the hWnd send? ( does it default to the hWnd of the object that sends the message?)

It uses the hwnd that corresponds to the particular cwnd object. If you don't know the difference between hwnd and cwnd, that's a whole-nother bag-o-worms.
 
Hope that helps a bit.
  Permalink  
v2
Comments
CPallini at 3-Dec-12 17:05pm
   
My 5.
Albert Holguin at 3-Dec-12 17:33pm
   
Thank you
Albert Holguin at 4-Dec-12 13:46pm
   
Thank you Sajeesh
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 BillWoodruff 309
1 CPallini 300
2 Sergey Alexandrovich Kryukov 290
3 George Jonsson 274
4 Gihan Liyanage 230
0 OriginalGriff 4,895
1 CPallini 4,010
2 Sergey Alexandrovich Kryukov 3,514
3 George Jonsson 2,826
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 3 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100