Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using C# code to simulate textbox filling and button pressing

Tags:

c#

windows

I'm working on a C# program which automates tasks. For example, my program opens an external application (specifically mstsc.exe) and uses the application. I want to write code which fills textboxes with certain values and presses certain buttons. What is the right and most elegant way to implement such operations in a C# 4 code?

like image 665
snakile Avatar asked Jul 17 '12 06:07

snakile


People also ask

What is C in used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

How do I use C on my computer?

It is a bit more cryptic in its style than some other languages, but you get beyond that fairly quickly. C is what is called a compiled language. This means that once you write your C program, you must run it through a C compiler to turn your program into an executable that the computer can run (execute).

Is C used nowadays?

C exists everywhere in the modern world. A lot of applications, including Microsoft Windows, run on C. Even Python, one of the most popular languages, was built on C. Modern applications add new features implemented using high-level languages, but a lot of their existing functionalities use C.

Why do people use C?

The biggest advantage of using C is that it forms the basis for all other programming languages. The mid-level language provides the building blocks of Python, Java, and C++. It's a fundamental programming language that will make it easier for you to learn all other programming languages.


1 Answers

if your special target is mstsc.exe use its parameters:

mstsc.exe [<Connection File>] [/v:<Server>[:<Port>]] [/admin] [/f] [/w:<Width> /h:<Height>] [/public] [/span]

mstsc.exe /edit <Connection File>

mstsc.exe /migrate 

else Windows Input Simulator (C# SendInput Wrapper - Simulate Keyboard and Mouse) is a reliable and open-source library on CodePlex for your issue.

like image 94
Ria Avatar answered Oct 06 '22 12:10

Ria