sudhakar_koundinya
asked on
PostMessage/SendMessage is not working on Button
Hi All,
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);
}
Thanks
Sudhakar
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
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);
}
Thanks
Sudhakar
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry it is BM_CLICK only. I Just confused. Let me try
ASKER
Hi,
I was able to manage with SendMessage itself. Actually it was pointing to wrong Window. It was my mistake
Thanks
Sudhakar
I was able to manage with SendMessage itself. Actually it was pointing to wrong Window. It was my mistake
Thanks
Sudhakar
ASKER
Yes