I'm fighting with windows and screens a lot in WPF but using WinApi low level interfaces. I wrote some snipped that with success move offscreen wacup to main screen. Maybe can you add this method or adapt and add to main menu of wacup? If you will share me access to some control version I can try to help with this.
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
class Program
{
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter,
int X, int Y, int cx, int cy, uint uFlags);
private const uint SWP_NOZORDER = 0x0004;
private const uint SWP_NOSIZE = 0x0001;
private static readonly IntPtr HWND_TOP = IntPtr.Zero;
static void Main(string[] args)
{
string exeName = "wacup";
Process[] processes = Process.GetProcessesByName(exeName);
if (processes.Length == 0)
{
Console.WriteLine($"Process: {exeName} not found.");
return;
}
foreach (Process proc in processes)
{
IntPtr hWnd = proc.MainWindowHandle;
if (hWnd == IntPtr.Zero)
{
Console.WriteLine("Missing main window");
continue;
}
Screen primaryScreen = Screen.PrimaryScreen;
int x = primaryScreen.WorkingArea.X;
int y = primaryScreen.WorkingArea.Y;
bool result = SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
Console.WriteLine(result
? $"'{exeName}' window moved."
: "Move window failed.");
}
}
}