Set focus back to host

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

Set focus back to host
 
Uwe


Guest


Hi, I have a toolbar-add-in which opens a TForm. I select something which is pasted in the current document.

Is it possible to set the focues back to the MS Word then automatically (after the paste-operation)?

Thanks,
Uwe
Posted 22 Apr, 2005 08:12:11 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Uwe,

Does your form show up as a modal? If yes, it is not possible to set focus back to the MS Word until the form is closed.

Posted 22 Apr, 2005 08:43:57 Top
Uwe


Guest


No, I use .Show to display it.
Posted 22 Apr, 2005 09:35:54 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Uwe,

In this case you can try to use Windows API functions. For example SetActiveWindow(HWND).

Posted 22 Apr, 2005 11:54:25 Top
Uwe


Guest


Maybe some else may also need it:

h := FindWindow('OpusApp',nil) ;
if h = 0 then
exit ;
SetActiveWindow(H);
SetForegroundWindow(H);

Don't ask me why MS Word is called "OpusApp"...

--Uwe
Posted 23 Apr, 2005 04:52:35 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Uwe,

Thank you for the code snippet.

Posted 23 Apr, 2005 13:41:43 Top