I am opening a couple of external windows (remote app windows) from my .NET application. However, after the two windows are open, and after I get their respective window handles, I loop through them to set them as TopMost and also to move them to a specific location. But after that, both windows cannot be moved. When I click on the window title to drag the windows, they do not want to move. Maybe I am not setting the proper parameters in the SetWindowPos method?
windwos = FindRemoteDesktop();
foreach (var window in windwos)
{
//UnsafeNativeMethods.SetParent(window, windowHandle);
UnsafeNativeMethods.BringWindowToTop(window);
//UnsafeNativeMethods.SetForegroundWindow(window);
UnsafeNativeMethods.SetFocus(window);
UnsafeNativeMethods.SetWindowPos(window, UnsafeNativeMethods.HWND_TOPMOST, x, y, width, height,
(UnsafeNativeMethods.SetWindowPosFlags)(UnsafeNativeMethods.SC_MOVE | UnsafeNativeMethods.SWP_NOSIZE)); // UnsafeNativeMethods.SWP_NOMOVE |
UnsafeNativeMethods.MoveWindow(window, x, y, width, height, true);
}