-2

I normally click a button to initiate a process on the `vsto` add-in. when the process is done, feedback is received is received in form of a `MessageBox`. now here is the issue. If I remain inside Word while the process completes, the `MessageBox` doesn't show as an extra task/window in the task bar. If I initiate the process, then move to a different app or to a different document window, the message box shows up in the task bar and stays on its own so that i can still continue working on even the active document where the process was initiated without having the UI thread blocked which is supposed to be the usual case. How do I make it always belonging to the Word app even if it is not the active app?

1 Answer 1

1

Always set the Word window as the owner of the MessageBox.
In C# for a VSTO add-in, use:

var wordHandle = new IntPtr(Globals.ThisAddIn.Application.Hwnd);
MessageBox.Show(new WindowWrapper(wordHandle), "Process complete!");

This ensures the MessageBox is modal to Word (always belonging to it) and never appears as a separate taskbar item.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.