Clicking button in program B by coding in program A

I have two program (A and B).Program B have 2 buttons. How can Iwrite a code from program A to click the button in Program B. I try to use API function (findwindow,findwindowex and sendmessgae) but I cannot focus the button that I wanted. Give me some suggestions?
wbuakleeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bhagyeshtCommented:
in vb use appactivate and then use the sendkeys "{tab}" till you get focus then sendkeys "{Enter}"

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mem_famCommented:
After you have found the window of B, you can enumerate its buttons as child windows using EnumChildWindows API.
0
DeerBearCommented:
Hi,

The previous answers cover a nice range of
possibilities. But after you've found the right window using
EnumChildWindows, in most cases you can just send it the
appropriate message(s).

In case of a left mouse button click, just send:

WM_LBUTTONDOWN
WM_LBUTTONUP

In that sequence.

HTH,

Andrew
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

guynumber5764Commented:
Depending on your needs, you may be able just call "OnClick...." directly.
0
mem_famCommented:
wbuaklee,

What is the status of this question?

mem.f
0
bhagyeshtCommented:
mem_fam: doing the cleanup thing?

Bhagyesh Trivedi
0
mem_famCommented:
More or less
0
bhagyeshtCommented:
I would recommend a split between bhagyesht, mem_fam and DeerBear


Regards,
Bhagyesh
0
wbuakleeAuthor Commented:
Please delete this topic
0
wbuakleeAuthor Commented:
Thank you for all of you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.