Cursor control

Add-in Express™ Support Service
That's what is more important than anything else

Cursor control
How to get back cursor control to word document from dialog box 
Subscribe
Ishaat Zahidi




Posts: 8
Joined: 2017-04-04
In the plugin we developed,

After text changes were made in a document, a dialog box is popped to get some user information.
After entering the details,Ok button is clicked. On clicking Ok button, dialog box is closed, but cursor control does not come back to the active document. Could you please help me in achieving the same.
Posted 02 Nov, 2017 12:00:39 Top
Andrei Smolin


Add-in Express team


Posts: 14123
Joined: 2006-05-11
Hello Ishaat,

I suggest that you try to call Window.Activate() for the window containing that document. If this doesn't help, consider using SetFocus() Windows API method; see http://pinvoke.net/default.aspx/user32/SetFocus.html. The function accepts a parameter, which is the HWND of the winfdow to activate; use https://msdn.microsoft.com/en-us/VBA/Word-VBA/articles/window-hwnd-property-word to get the value to pass to that method.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Nov, 2017 05:06:57 Top