'How to override other windows application's elements? [closed]

Can you please point me into the right direction?

I want to edit other application textbox or click, programmatically. For example, in a web sites, I can edit elements and invoke button clicks.

I have no idea how to do this, but I can move mouse and use keyboard run time is it possible to edit other application's textbox ?

I have C++, VB.NET, and C# knowledge - any suggestions or sample code?

Thanks.



Solution 1:[1]

There is no easy way to do this, but it is possible. You will dig through the Win32 Api to get what you need. There will be a lot code needed for this, too much to put in sample here.

You will need to start with finding the window you want. This could be accomplished with FindWindowEx. When you have the window, you can enumerate the child controls using EnumChildWindows.

When you finally get the handle to the control you need, you can hook up to the windows message subsystem and send a WM_SETTEXT message using the SendMessage function. There is a wrapper function available: SetWindowText but the documentation clearly states that it will NOT work for windows of other applications.

Be prepared for a lot of digging around in the Win Api. You will probably run into issues regarding security in newer windows OS's. When you get it to run the functionality will be highly depending on the OS, UAC settings etc.

I remember doing this once, 15 years ago in Windows 98, even then it was problematic! So good luck!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ric .Net