I wrote an application in C# that brings another application to the foreground.
This function so far. However, there is a problem.
If you set the focus, the application is opened and brought to the foreground, but the Windows docking function does not work. The application is only ever opened in its last window size.
EDIT: I forgot to mention that the docking should be seen on the Windows desktop (monitor edge).
Does anyone have any idea how to get the docking feature on?
[DllImport("../user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("../user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public void SetWindowToForeground(List<string> formattedPartList)
{
string windowTitle = formattedPartList[4];
int activeResize = 5; //
IntPtr mainWindowHandle = GetProcessIdByName(windowTitle);
SetForegroundWindow(mainWindowHandle);
ShowWindow(mainWindowHandle, activeResize);
}