I'm developing a addin for office word using vsto. I'm trying to bring the word window that is minisized rebringing it to the front.I try to use winapi function SwitchToThisWindow、SetForegroundWindow, SetWindowPos like this
if (handlePtr != IntPtr.Zero)
{
Win32API.SwitchToThisWindow(handlePtr, true);
//Win32API.ShowWindow(handlePtr, Win32API.SW_MAXIMIZE);
////Win32API.SetForegroundWindow(handlePtr);
//Win32API.SetWindowPos(handlePtr, Win32API.HWND_TOP, 0, 0, 0, 0, Win32API.SWP_NOMOVE | Win32API.SWP_NOSIZE | Win32API.SWP_SHOWWINDOW);
}
and Application.Activate(), it works how every other function like this does and only makes it flash in taskbar instead of bringing it to the front.
Is there anyway to fix this? I also try to sendkeys ‘alt+tab’ but i don't know how to direct the word process window.