?
Solved

PostMessage/SendMessage is not working on Button

Posted on 2005-03-22
4
Medium Priority
?
1,071 Views
Last Modified: 2013-11-20
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

0
Comment
Question by:sudhakar_koundinya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
williamcampbell earned 150 total points
ID: 13604566
Have you tried sending BM_CLICK?
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 13604964
You mean BN_CLICK??

Yes
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 13605071
Sorry it is BM_CLICK only. I Just confused. Let me try
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 13612962
Hi,
I was able to manage with  SendMessage itself. Actually it was pointing to wrong Window. It was my mistake

Thanks
Sudhakar
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question