반응형
public partial class Form1 : Form
{
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string lpClassName,string lpWindowName);
[DllImport("user32.dll")]
private static extern IntPtr GetWindow(IntPtr hWnd, int uCmd);
[DllImport("User32.dll")]
private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
private const int GW_CHILD = 5;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
IntPtr Progmanhwnd = IntPtr.Zero;
IntPtr hwd1, hwd2, hwd3;
Progmanhwnd = (IntPtr)FindWindow("Progman", "Program Manager");
hwd1 = GetWindow(Progmanhwnd, GW_CHILD);
hwd2 = GetWindow(hwd1, GW_CHILD);
hwd3 = GetWindow(hwd2, GW_CHILD);
SetParent(this.Handle, hwd2);
}
}
{
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string lpClassName,string lpWindowName);
[DllImport("user32.dll")]
private static extern IntPtr GetWindow(IntPtr hWnd, int uCmd);
[DllImport("User32.dll")]
private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
private const int GW_CHILD = 5;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
IntPtr Progmanhwnd = IntPtr.Zero;
IntPtr hwd1, hwd2, hwd3;
Progmanhwnd = (IntPtr)FindWindow("Progman", "Program Manager");
hwd1 = GetWindow(Progmanhwnd, GW_CHILD);
hwd2 = GetWindow(hwd1, GW_CHILD);
hwd3 = GetWindow(hwd2, GW_CHILD);
SetParent(this.Handle, hwd2);
}
}
반응형
'프로그래밍 > C#.net' 카테고리의 다른 글
클래스 (0) | 2009.08.24 |
---|---|
작업표시줄에 App 숨기는 꽁수 (0) | 2009.03.24 |
FormBorder.None 에 간단하게 드래그이벤트 추가 코드 (0) | 2009.03.24 |
WinService구동시 installutil문제 (2) | 2009.02.17 |
[C#] AutoResetEvent 와 ManualResetEvnet 예제 (0) | 2009.01.15 |
댓글