Hello All,

I intend to develope a console application in C# in which there should be 3 functionalities :-

  1. Open Wordpad.exe and automatically type something.
  2. Save the updated document.
  3. Close the Wordpad with changes saved.

Kindly guide me if anyone has some ideas. I have managed to open Wordpad but rest I am not so sure. So please tell me the exact approach or the needful.

Recommended Answers

All 2 Replies

It will probably have to be done along the same lines as this for starting and writing to Wordpad.

The Process Class, will do what you want, start the program, redirect the standard input then send text to the process. By sending the right key characters you should be able to save the file as well. The articles I linked to include sample code that should be able to guide you.

Personally I try to avoid API functions when there are .net functions that do the same thing. Less chance of the code breaking if the API changes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.