Using the next answer I am trying to programmatically reposition a citrix window, somehow the window does not move.
I assume the process name that holds the Citrix window is one of the next processes that were added in Process.GetProcesses()
after I started Citrix: Receiver, wfica32, pnamain, concentr, wfcrun32.
any help why the window does not move?
IntPtr hWnd = IntPtr.Zero;
var p1 = Process.GetProcesses().Where(p => p.Id != 0 && p.ProcessName == _processToRepositionWindowName).FirstOrDefault();
if (p1 != null && p1.MainWindowHandle != IntPtr.Zero)
{
hWnd = p1.MainWindowHandle;
//tried both options
//hWnd = p1.Handle;
}
else
{
hWnd = FindWindow(_processToRepositionWindowName, null);
if(hWnd == IntPtr.Zero)
{
hWnd = FindWindow(null, _processToRepositionWindowName);
}
}
if (hWnd != IntPtr.Zero)
{
var i = SetWindowPos(hWnd, IntPtr.Zero, windowXLocation, windowYLocation, 0, 0, SWP_NOSIZE | SWP_NOZORDER | 0x0040);
}