PDA

View Full Version : سوال: مشکل در ایجاد کد در Console



drsina
شنبه 11 خرداد 1392, 02:38 صبح
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication4
{

class Program
{
static void Main(string[] args)
{

System.Diagnostics.Process aProcess = new System.Diagnostics.Process();
aProcess.StartInfo = new System.Diagnostics.ProcessStartInfo(@"notepad.exe");
aProcess.Start();
aProcess.WaitForExit();//Optional, waits for you to exit notepad (synchronous execution)
SendKeys.Send("^c");

}
}
}






سلام .... دوستان من این کد رو می زنم !!!
این ارورر رو میده :
Error 1 The name 'SendKeys' does not exist in the current context

mousa1992
شنبه 11 خرداد 1392, 04:09 صبح
add system.windows.forms name space to references 1

2 از متد Send برا کنسول نمیشه استفاده کرد - از SendWait استفاده کن

System.Windows.Forms.SendKeys.SendWait("^c");