title: c# Programmatically move Citrix window
body: <p>Using the next <a href="https://stackoverflow.com/a/42306412/1331825">answer</a> I am trying to programmatically reposition a citrix window, somehow the window does not move.</p>
  
  <p>I assume the process name that holds the Citrix window is one of the next processes that were added in <code>Process.GetProcesses()</code> after I started Citrix: Receiver, wfica32, pnamain, concentr, wfcrun32.</p>
  
  <p>any help why the window does not move?</p>
  
  <pre><code>IntPtr hWnd = IntPtr.Zero;
  var p1 = Process.GetProcesses().Where(p =&gt; p.Id != 0 &amp;&amp; p.ProcessName == _processToRepositionWindowName).FirstOrDefault();
  if (p1 != null &amp;&amp; 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);
  }
  </code></pre>