본문 바로가기

Category

(302)
Cursor.Position, SetCursorPos, mouse_event 샘플코드 Cursor.Position, SetCursorPos, mouse_event 를 이용해서 마우스를 컨트롤하는 샘플코드이다. 원하는 위치로 이동할 수도 있고, 마우스 클릭도 조절할 수 있다. using System; using System.Drawing; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; namespace MouseSample { class Program { static void Main(string[] args) { Point myPoint = new Point(); myPoint.X = 10; myPoint.Y = 10; Cursor.Position = myPoint; Thre..
Process : Thread를 이용한 메모장에 키 입력하기 메모장이 실행되기를 기다렸다가, 메모장에 문장을 입력하는 샘플코드이다. Thread를 이용한 것이다. 이것은 AutoIt, AutoHotKey 같은 Task Automation 프로그램 대용으로 활용할 수 있다. 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) { ThreadStart myThreadStart = new ThreadStart(DoWork); Thread myThread = new ..
Process : 메모장에 키 입력하기 메모장에 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(..
Process : Notepad 종료 샘플코드 현재 실행중인 메모장을 모두 종료시키는 샘플코드이다. using System; using System.Diagnostics; namespace ProcessTest { class Program { static void Main(string[] args) { Process[] myProcesses = Process.GetProcessesByName("notepad"); foreach (Process item in myProcesses) { // Close process by sending a close message to its main window. item.CloseMainWindow(); // Free resources associated with process. item.Close(); } } } }
Process 목록 출력 샘플코드 현재 컴퓨터에서 작동 중인 process 목록을 출력해주는 샘플코드이다. using System; using System.Diagnostics; namespace ProcessTest { class Program { static void Main(string[] args) { Process[] processes = Process.GetProcesses(); foreach (Process item in processes) { Console.WriteLine(item.ToString()); } } } }
AxWebBrowser.ReadyState 샘플코드 AxWebBrowser.ReadyState 상태를 체크해서, AxWebBrowser Navigate 완료 여부를 판단한다. 아래 코드와 같이 해주면 된다. while (this.axWebBrowser1.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE) { Thread.Sleep(100); Application.DoEvents(); }
[C/C++] Hello World 샘플코드 #pragma once #include #include #include #include using namespace std; int main(int argc, char* argv[]); #include "Program.h" int main(int argc, char* argv[]) { cout
WebBrowser.ReadyState 샘플코드 WebBrowser.Navigate 명령 이후, 웹페이지가 완전히 로딩 될 때까지 기다리게하는 예제이다. WebBrowser.ReadyState를 이용해서 완료상태를 체크한다. using System.Threading; using System.Windows.Forms; namespace MyBrowser { public partial class Form1 : Form { public Form1() { InitializeComponent(); this.webBrowser1.Navigate("http://www.tistory.com"); while (webBrowser1.ReadyState != WebBrowserReadyState.Complete) { Thread.Sleep(100); Application..