Ed
Thanks for the reply!
The plot thickens.
SetForegroundWindow() only works for Word if a document is open!
I'm going to < gasp > post the code...
Procedure MakeWordComeToTheFront
if type('pgHwndWord')="U"
DECLARE integer GetForegroundWindow in WIN32API
DECLARE integer SetForegroundWindow in WIN32API integer
DECLARE short IsWindow in WIN32API integer
public pgHwndWord,poWordApplication
endif
if empty(pgHwndWord) or ! iswindow(pgHwndWord)
** create WORD server
poWordApplication= createobject("word.application")
poWordApplication.visible = .t.
** maximize WORD
poWordApplication.windowstate = 1
poWordApplication.activate
pgHwndWord = GetForegroundWindow() && Save word window handle
else
SetForegroundWindow(pgHwndWord)
endif
Yeah, in "real life" all those publics are object properties.
If you try it, Word only comes to the front if you have a document open.
Looking at
http://msdn.microsoft.com/library/psdk/winui/windows_1eev.htm I see that this flashing business is the default behaviour- it calls SetActiveWindow() and FlashWindowEx() if the user is using another window which they are by default in an app. Apparently at application install time you can alter the behaviour using
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)0, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
I'm afraid this is much too complex for me, so can you tell me whether this is something I can do easily using the VFP install Wizard or is this something clever? Or can I run it somehow from my app?
Thanks for your assistance,
Regards
JR
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us."
-- Shakespeare: Coriolanus, Act 1, scene 1