We have included a spell check feature in our windows application and here's the issue we are facing.
Steps in replicating the issue:
- Clicked on the spell check feature.
- Tabbed to another application before the spell check prompt appeared.
- On coming back, the application is unresponsive as the spell check window has gone out of focus.
The only way to access the application after which is to use Alt + Tab, go to the window and close it. My question is how can the prompt window be fixed over the application window that when the application is selected from the Taskbar the application comes with the prompt window? (Like how it happens when I close a Word application, and it prompts me to save and when I tab to another application and back to the word the prompt is still accessible)
How do I make the prompt that comes out of Document.CheckSpelling()- a method that returns void, a modal prompt.
Here's the code:
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
app.Visible = false;
object template = Missing.Value;
object newTemplate = Missing.Value;
object documentType = Missing.Value;
object visible = false;
object optional = Missing.Value;
Microsoft.Office.Interop.Word.Document doc = app.Documents.Add(ref template, ref newTemplate, ref documentType, ref visible);
doc.Words.First.InsertBefore(s);// s is the string containing the text
doc.CheckSpelling(ref optional, ref optional, ref optional,
ref optional, ref optional, ref optional, ref optional,
ref optional, ref optional, ref optional,
ref optional, ref optional);//This method gives the prompt window with the suggestions.