티스토리 뷰
메모장에 Hello World 문장을 입력하는 샘플코드이다.
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
namespace ProcessTest
{
class Program
{
static void Main(string[] args)
{
Process[] myProcesses = Process.GetProcessesByName("notepad");
foreach (Process item in myProcesses)
{
SetForegroundWindow(item.MainWindowHandle);
Thread.Sleep(1000);
SendKeys.SendWait("Hello World");
}
}
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
}
}
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
namespace ProcessTest
{
class Program
{
static void Main(string[] args)
{
Process[] myProcesses = Process.GetProcessesByName("notepad");
foreach (Process item in myProcesses)
{
SetForegroundWindow(item.MainWindowHandle);
Thread.Sleep(1000);
SendKeys.SendWait("Hello World");
}
}
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
}
}
'Code > C#' 카테고리의 다른 글
| Cursor.Position, SetCursorPos, mouse_event 샘플코드 (0) | 2008.04.18 |
|---|---|
| Process : Thread를 이용한 메모장에 키 입력하기 (0) | 2008.04.18 |
| Process : Notepad 종료 샘플코드 (0) | 2008.04.17 |
| Process 목록 출력 샘플코드 (0) | 2008.04.17 |
| AxWebBrowser.ReadyState 샘플코드 (0) | 2008.04.16 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- autohotkey
- Phalanger
- 유틸리티
- AxWebBrowser
- jre
- Automation
- .net framework
- c#
- 스크린캡쳐
- tagREADYSTATE
- download.com
- windows
- 애드센스숨기기
- registry
- Microsoft
- java
- iText
- READYSTATE_COMPLETE
- Rollback Rx
- ScreenHunter
- Sample Code
- 애드센스감추기
- DotNetMagic
- AdSense감추기
- Regular Expressions
- WinAutomation
- AdSense숨기기
- iTextSharp
- Service pack
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
글 보관함