我想实现这样的功能:按下按钮,打开一个记事本,并显示“Hello!world”。而并不是打开一个有“Hello!world”内容的文本文件。
请问如何实现?多谢!
请问如何实现?多谢!
解决方案 »
- 输入格式的限止
- Excel内数据导入datatable
- 【问】为什么 Effective C# 原则11:选择foreach循环 ?for的效率低?
- WinForms程序读取资源文件.resx时的变量声明问题
- 要死了,关于枚举网络打印机,在线等!!
- 什么样的软件最有发展?
- (agin)c#中如何实现两个程序之间的通信?
- XML的读取速度问题?=================
- 虽然我很菜,但我还是要问,一个简单的datatable问题。
- Transaction能不能用在CommandBuilder上?
- [WinForm]关于在构造函数中关闭当前窗口
- 如何把ComboBox绑定到SqlDataReader上?
System.Diagnostics.Process.Start("notepad","对记事本如何传参目前还不了解");
sw.WriteLine("Hello!world");
sw.Flush();
sw.Close();
System.Diagnostics.Process txt = System.Diagnostics.Process.Start ( @"notepad.exe", @"d:\text_test.txt" );
或
System.Diagnostics.Process txt = System.Diagnostics.Process.Start ( @"notepad.exe", @"d:\text_test.txt" );
txt.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
txt.WaitForInputIdle ( 1000 );
if ( txt.Responding )
{
SendKeys.SendWait ( "Hello!world\r\n" );
SendKeys.SendWait ( "{Enter}{Enter}" );
SendKeys.SendWait ( "文档创建时间:" );
SendKeys.SendWait ( "{F5}" );
SendKeys.SendWait ("{Enter}");
SendKeys.SendWait ( "^s" );
SendKeys.SendWait ( "%{F4}" );
MessageBox.Show ("文件已经保存成功!");
}
}