Click here to Skip to main content
15,899,313 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Disable an Item in CListBox By Double Clicking on it Pin
Hamid_RT7-Aug-06 20:47
Hamid_RT7-Aug-06 20:47 
AnswerRe: Disable an Item in CListBox By Double Clicking on it Pin
georgekjolly7-Aug-06 21:16
georgekjolly7-Aug-06 21:16 
AnswerRe: Disable an Item in CListBox By Double Clicking on it Pin
Viorel.7-Aug-06 21:36
Viorel.7-Aug-06 21:36 
Questionactive xcontrol Pin
With_problem7-Aug-06 20:16
With_problem7-Aug-06 20:16 
QuestionSendMessage Function .... Pin
sach!!7-Aug-06 20:10
sach!!7-Aug-06 20:10 
AnswerRe: SendMessage Function .... Pin
Parthi_Appu7-Aug-06 20:27
Parthi_Appu7-Aug-06 20:27 
GeneralRe: SendMessage Function .... Pin
sach!!7-Aug-06 20:43
sach!!7-Aug-06 20:43 
GeneralRe: SendMessage Function .... Pin
Naren Neelamegam7-Aug-06 20:57
Naren Neelamegam7-Aug-06 20:57 
Hi...

Windows have message driven architecture basically. Messages are nothing but events (in VB). For every action a window will get a message like, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEMOVE, WM_MOUSEWHEEL etc., The above said messages are mouse click events that will be sent to a window if user clicks on it. Say, if a user clicks on a window... that window will get WM_LBUTTONDOWN message first and WM_LBUTTONUP when he release it. With this message additional information like X,Y positions where the user clicked also will be sent to that window.

Ok... now come to SendMessage() function. SendMessage function is having as u said four parameters,
LRESULT SendMessage(HWND hWnd,UINT Msg,WPARAM wParam, LPARAM lParam);

here hWnd is the handle to the window where you want to send the message
Msg is the Message as above said WM_LBUTTONDOWN or WM_LBUTTONUP (see msdn for all messages starting with WM_XXXXXXX)
wParam additional information
lParam additional information

for example, let us send a message to a window like user ctrl+clicks on it...

::SendMessage(hWnd,WM_LBUTTONDOWN,MK_CONTROL,MAKELPARAM(x,y));
::SendMessage(hWnd,WM_LBUTTONUP,MK_CONTROL,MAKELPARAM(x,y));

wParam and lParam will vary depends on the message you send. For WM_CLOSE, no need for wParam and lParam, so ::SendMessage(hWnd,WM_CLOSE,0,0); will close the window.

As our Friend Parthi said, difference between SendMessage and PostMessage is, SendMessage will send message and wait till the window process the message. PostMessage will post the message in the message queue and wont wait anymore.

I think the reply is pretty long, but clear enough. Smile | :)





with regards,
Naren Neelamegam

GeneralRe: SendMessage Function .... Pin
sach!!7-Aug-06 21:07
sach!!7-Aug-06 21:07 
GeneralRe: SendMessage Function .... Pin
sach!!7-Aug-06 20:58
sach!!7-Aug-06 20:58 
GeneralRe: SendMessage Function .... Pin
Parthi_Appu8-Aug-06 0:51
Parthi_Appu8-Aug-06 0:51 
AnswerRe: SendMessage Function .... Pin
Hamid_RT7-Aug-06 21:21
Hamid_RT7-Aug-06 21:21 
GeneralRe: SendMessage Function .... Pin
sach!!7-Aug-06 21:31
sach!!7-Aug-06 21:31 
QuestionMoving Ellipse Problem [modified] Pin
uday kiran janaswamy7-Aug-06 20:08
uday kiran janaswamy7-Aug-06 20:08 
AnswerRe: Moving Ellipse Problem Pin
Hamid_RT7-Aug-06 21:44
Hamid_RT7-Aug-06 21:44 
GeneralRe: Moving Ellipse Problem Pin
uday kiran janaswamy7-Aug-06 23:16
uday kiran janaswamy7-Aug-06 23:16 
GeneralRe: Moving Ellipse Problem Pin
Hamid_RT8-Aug-06 1:05
Hamid_RT8-Aug-06 1:05 
GeneralRe: Moving Ellipse Problem [modified] Pin
uday kiran janaswamy8-Aug-06 1:42
uday kiran janaswamy8-Aug-06 1:42 
GeneralRe: Moving Ellipse Problem Pin
Hamid_RT8-Aug-06 4:37
Hamid_RT8-Aug-06 4:37 
QuestionHow to resize application acoording to system resolution set? Pin
jadhav1237-Aug-06 19:02
jadhav1237-Aug-06 19:02 
AnswerRe: How to resize application acoording to system resolution set? Pin
mails2dhana7-Aug-06 19:33
mails2dhana7-Aug-06 19:33 
GeneralRe: How to resize application acoording to system resolution set? Pin
Naveen7-Aug-06 19:43
Naveen7-Aug-06 19:43 
GeneralRe: How to resize application acoording to system resolution set? Pin
Hamid_RT7-Aug-06 20:34
Hamid_RT7-Aug-06 20:34 
AnswerRe: How to resize application acoording to system resolution set? Pin
Naren Neelamegam7-Aug-06 21:05
Naren Neelamegam7-Aug-06 21:05 
QuestionDisable tab control Pin
see me7-Aug-06 17:50
see me7-Aug-06 17:50 

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.