을 알고 창을 다시 nor로 변경할 수 있습니다. 말 디스플레이 사용을 SetWindowPos : 예에서
[DllImport("user32.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
, 윈도우가 "앱 3"의 클래스 이름이있는 경우
...
IntPtr handle;
try
{
// Find the handle to the window with class name x
handle = FindWindowCE("App 3", null);
// If the handle is found then show the window
if (handle != IntPtr.Zero)
{
// show the window
SetWindowPos(handle, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE);
}
}
catch
{
MessageBox.Show("Could not find window.");
}
윈도우의 클래스와 제목을 찾으려면 CE 원격 도구를 시작 "CE 스파이 "(VS 설치의 일부) app 3이 시작될 때. 그런 다음 창 목록을 탐색하고 app 3 창을 봅니다. 두 목록의 항목을 클릭하면 클래스 이름과 3
대신 당신은 또한 간단한 ShowWindow API 사용할 수있는 여분을 SetWindowPos의 응용 프로그램의 제목을 얻을 것이다 :의 PInvoke를 대한 자세한 내용은
[DllImport("coredll.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool ShowWindow(IntPtr hWnd, ShowWindowCommands nCmdShow);
enum ShowWindowCommands
{
Hide = 0,
Normal = 1,
ShowMinimized = 2,
Maximize = 3, // is this the right value?
ShowMaximized = 3,
ShowNoActivate = 4,
Show = 5,
Minimize = 6,
ShowMinNoActive = 7,
ShowNA = 8,
Restore = 9,
ShowDefault = 10,
ForceMinimize = 11
}
...
IntPtr handle;
try
{
// Find the handle to the window with class name x
handle = FindWindowCE("App 3", null);
// If the handle is found then show the window
if (handle != IntPtr.Zero)
{
// show the window
ShowWindow(handle, ShowWindowCommands.Normal);
}
}
catch
{
MessageBox.Show("Could not find window.");
}
을 FindWindow 및 SetWindowPos는 pinvoke.net 및 MSDN을 참조하십시오. Win32 프로그래밍에 관한 가장 좋은 책은 Charles Petzold의 Programming Windows입니다.
프로세스를 시작할 때 창을 변경하기 전에 OS에서 응용 프로그램을 정리할 시간이 필요합니다 (1-3 초).
질문이 자세하지 않습니다. 세 번째 응용 프로그램 창은 어떻게됩니까? 최소화되었거나 숨겨져 있습니까? 그렇다면 FindWindow() 및 SetWindowPos (둘 다 pinvoke를 통해 사용할 수 있음)를 사용하여 세 번째 응용 프로그램의 창 (있는 경우)을 앞에 놓아야합니다. – josef
우리는 1 차 적용을 최소화하고 나타납니다. Windows Mobile에서는 FindWindow() 및 SetWindowPos가 어떻게됩니까? – user6018