2014/09/04 3

C#: 주기, 시간마다 같은행동 반복하기

/* * http://sosal.kr/ * made by so_Sal */ System 안에있는 타이머를 사용하면 된다.using System.Timers; class Program{ private static Timer aTimer; static void Main(string[] args) { // 2초의 interval을 둔 timer 만들기 aTimer = new System.Timers.Timer(2000); // Hook up the Elapsed event for the timer. aTimer.Elapsed += OnTimedEvent; aTimer.Enabled = true; Console.WriteLine("Press the Enter key to exit the program... ")..

C# 에서 win32 API 사용하기

/* * http://sosal.kr/ * made by so_Sal */ system32 안의 DLL 파일에서 함수를 import하여 사용하면 된다. 다음의 사이트에서 많은 정보를 얻을 수 있다.http://www.pinvoke.net/index.aspx 예를들면, user32.dll 파일 안에 있는 Sendmessage(~) 함수를 사용하고 싶을 때,http://www.pinvoke.net/default.aspx/user32.sendmessage 에서 정보를 얻을 수 있다. C# Signature:[DllImport("user32.dll", CharSet = CharSet.Auto)] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr ..

C# 키보드 후킹 예제

/* * http://sosal.kr/ * made by so_Sal */ https://gist.github.com/Stasonix/3181083 github에서 그대로 퍼왔습니다.아래 코드는 후킹한 후에 원래 목적지로 가지 않는다는점...원한다면 hookProc 함수에서 return (IntPtr)1; 을CallNextHookEx(hhook, code, (int)wParam, lParam);로 고쳐주시면 됩니다. using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.W..