Using C# - Visual Studio 2005
The documentation for OpenIcon says that it will restore a window to its previous size
and location. This isn't happening - it is restoring the window, but It only restores it to its previous size/location if it was not maximized. I want it to go back to however it was displayed before the user sent it to the taskbar. Is there something extra that needs to be done when calling it from C#?
The ReturnValue indicates success.
My original code:
static extern bool OpenIcon(IntPtr hwnd);
IntPtr wHandle = process.MainWindowHandle;
bool ReturnValue = OpenIcon (wHandle);
On suggestion, I modified the code to:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern bool OpenIcon(HandleRef hwnd);
HandleRef HandleReference = new HandleRef(new Object(), process.MainWindowHandle);
This behaves the same way, which was not that surprising to me since it doesn't appear to be a
problem with the garbage collector/object not being found.