• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

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?
0
wbuaklee
Asked:
wbuaklee
  • 3
  • 3
  • 2
  • +2
3 Solutions
 
bhagyeshtCommented:
in vb use appactivate and then use the sendkeys "{tab}" till you get focus then sendkeys "{Enter}"

0
 
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now