using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenCvSharp;
using System.Diagnostics;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
[System.Runtime.InteropServices.DllImport("User32", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string IpClassName, string IpWindowName);
[System.Runtime.InteropServices.DllImport("user32.dll")]
internal static extern bool PrintWindow(IntPtr hWnd, IntPtr hdcBlt, int nFlags);
//프로그램창 대상
string AppPlayerName = "notepad";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
IntPtr findwindow = FindWindow(null, AppPlayerName);
if(findwindow != IntPtr.Zero)
{
Debug.WriteLine("창 확인");
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, 0x0);
g.ReleaseHdc(hdc);
}
pictureBox1.Image = bmp;
}
else
{
Debug.WriteLine("확인불가");
}
}
}
}
안타깝네요. 확인불가 입니다.
해당 댓글은 삭제되었습니다.
갓모장으로 쳐도 안됩니다 ㅠㅠㅠㅠㅠㅠㅠㅠㅠ 작업관리자 - 프로세스 에서 이름을 찾아 하는건줄알았는데 아닌가봅니다 살려주십시오 행님!!!
제발!!!!!!!!!!!!!!!!!!!!!!!!!!! 썸바리헬미!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
해당 댓글은 삭제되었습니다.
감사합니다.. 좀더 찾아보는 습관을 기르겠습니다..