HaPpY hApPy
FindWindow , 캡션명을 이용해서 열린 윈도우 창 핸들 가져오기. 본문
using System;
using System.Runtime.InteropServices;//DllImport
namespace ConsoleApplication2
{
class Program
{
//윈도우 캡션 명칭으로 프로세스 찾기
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
static void Main(string[] args)
{
IntPtr pNotepad = FindWindow(null, "notepad");//찾고자하는 윈도우 캡션을 넣어주면됨
IntPtr pCalculate = FindWindow(null, "Calculrate"); //
}
}
}