Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to click on a button in another application from my C# application ,
and I don't have the source code for the application that contains the button

let us say as an example ...can I use windows calculator from my application by clicking its buttons Programmatically
I am using c# and .NET
I think I must use windows api to do this
does anybody have any idea????

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
366 views
Welcome To Ask or Share your Answers For Others

1 Answer

Yes, it's not too complicated. You can use FindWindowEx to get the window handle, then iterate through the windows elements and use sendmessage or postmessage to send the WM_Click message.

Here's a codeproject project that does exactly what you want.

Code project


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...