I know this has been reported by others, but...
With the code below, Process.MainWindowHandle always returns IntPtr.Zero. I thought it might be a "dev time" issue, so I added the write to the event log and ran the app directly from the .exe. And the event log entry confirms that MainWindowHandle
is always zero.
The code is in the click event handler of a menu item. The app is looking for all instances of itself, to arrange them them across the screen by calling Windows API MoveWindow. But obviously, MoveWindow doesn't work because the window handle is
thisProcess = Process