PostMessage/SendMessage is not working on Button
Posted on 2005-03-22
I wanted to send/post the WM_LBUTTONDOWN and WM_LBUTTONUP messages to button of my other application.
When I tested this with Check box (which is from same button class), it is working fine with the above messages(i.e checkbox is getting clicked and unclicked). But when Tested with Button ("Yes" button), it is not getting fired through above messages.
What is the problem??
Below is the code
if (checkWnd != 0)
// AfxMessageBox("Check Wnd");
h = checkWnd;
PostMessage(h, WM_LBUTTONDOWN, 0, 0);
PostMessage(h, WM_LBUTTONUP, 0, 0);
if( YesWnd != 0)
//contorl is coming here.
// but Post and Send Messages are not working
// AfxMessageBox("Yes Wnd");
h = YesWnd;
//PostMessage(h, WM_LBUTTONDOWN, 0, 0);
//PostMessage(h, WM_LBUTTONUP, 0, 0);
SendMessage(h, WM_LBUTTONDOWN, 0, 0);
SendMessage(h, WM_LBUTTONUP, 0, 0);
P.S :- I tested the same in VB using Win API calls and it is working fine. But I don't want to do this in VB