Hello World

S

Sourcerer

I'm making a "hello world" program in C#, though a bit more complex one.

When I click on a button in my program, it is supposed to open a program (say,
Notepad) - that I did, by opening Notepad as another process. using Process
class.

Clicking another button, my program should make "Hello World!" appear in notepad
it's previously opened.

How can I do that?

--
"It is easy in the world to live after the world's opinion; it easy in solitude
to live after our own; but the great man is he who in the midst of the crowd
keeps with perfect sweetness the independence of solitude."
Ralph Waldo Emerson, Self-reliance 1841
http://pinpoint.wordpress.com/
 
R

rossum

I'm making a "hello world" program in C#, though a bit more complex one.

When I click on a button in my program, it is supposed to open a program (say,
Notepad) - that I did, by opening Notepad as another process. using Process
class.

Clicking another button, my program should make "Hello World!" appear in notepad
it's previously opened.

How can I do that?
You probably can't. What you can do is to open a new copy of Notepad
with a selected textfile loaded by including the name of the textfile
as an argument when you fire up Notepad:

ProcessStartInfo PSI = new ProcessStartInfo();
PSI.FileName = "notepad.exe";
PSI.Arguments = "hello.txt";
Process.Start(PSI);

rossum
 
R

rh

It's not the easiest thing to do. You could probably do it by using the
SendMessage windows API and send keystrokes to notepad.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top