안녕하세요 저는 한국 초보 개발자입니다.C# 양식 패널에서 다른 프로그램 열기
제작하고 있습니다. 프로그램. 이 프로그램은 3 개의 exe (C++, C#로 개발 됨)를 하나의 형식으로 실행하고 프로그램을 패널에 넣습니다.
이제 프로그램을 C++ 또는 다른 언어로 패널에 추가했습니다. 그러나 C#으로 작성된 Windows 프로그램은 패널에 계속 표시되지 않습니다. 여기 내 코드의 일부입니다 : 지금 두 개의 패널을 사용했다
[DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll")]
static extern bool MoveWindow(IntPtr Handle, int x, int y, int w, int h, bool repaint);
static readonly int GWL_STYLE = -16;
static readonly int WS_VISIBLE = 0x10000000;
private void Form1_Load(object sender, EventArgs e)
{
try
{
Process p = Process.Start("C:\\Users\\sonmi\\OneDrive\\Japan_Bunge_alpha\\Japan_Bunge_alpha\\bin\\Debug\\Japan_Bunge_alpha"); //C# program
Process p2 = Process.Start("C:\\Users\\sonmi\\Desktop\\astana_test\\astana\\Server\\Server_CES"); //C++ program
p.WaitForInputIdle();
Thread.Sleep(100);
SetParent(p.MainWindowHandle, this.Handle);
SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_VISIBLE);
MoveWindow(p.MainWindowHandle, 0, 0, panel1.Width, panel1.Height, true);
p2.WaitForInputIdle();
SetParent(p2.MainWindowHandle, panel2.Handle);
SetWindowLong(p2.MainWindowHandle, GWL_STYLE, WS_VISIBLE);
MoveWindow(p2.MainWindowHandle, 0, 0, panel2.Width, panel2.Height, true);
}
하지만,이 시험이 끝난 후 나는 더 추가됩니다. 어디에 문제가 있는지 알 수 없습니다.
'catch'블록에는 무엇이 있습니까? 어떤 오류가 있습니까? 관리자 권한으로 실행 해 보셨습니까? – derloopkat