private void btnImgsrch_Click(object sender, RoutedEventArgs e)
{
IntPtr findwindow = FindWindow(null, AppName);
if (findwindow != IntPtr.Zero)
{
//플레이어를 찾았을 경우
lblState.Content = "찾았습니다.";
//찾은 플레이어를 바탕으로 Graphics 정보를 가져옵니다.
Graphics Graphicsdata = Graphics.FromHwnd(findwindow);
//찾은 플레이어 창 크기 및 위치를 가져옵니다.
Rectangle rect = Rectangle.Round(Graphicsdata.VisibleClipBounds);
//플레이어 창 크기 만큼의 비트맵을 선언해줍니다.
Bitmap bmp = new Bitmap(rect.Width, rect.Height);
//비트맵을 바탕으로 그래픽스 함수로 선언해줍니다.
using (Graphics g = Graphics.FromImage(bmp))
{
//찾은 플레이어의 크기만큼 화면을 캡쳐합니다.
IntPtr hdc = g.GetHdc();
PrintWindow(findwindow, hdc, 0x2);
g.ReleaseHdc(hdc);
}
// pictureBox1 이미지를 표시해줍니다.
printImg(bmp, imgPrint);
printImg(srcImg, imgSrcPrint);
searchIMG(bmp, srcImg);
}
}