Re: Best way to reactivate application? by trw7at
trw7at
Tue Jun 21 14:17:17 CDT 2005
Tim Witort seemed to utter in news:Xns967C723B156D1timwitortwrotethis@
207.217.125.201:
>> "Tim Witort" <trw7at@ixdot.netcomdotcom> wrote in message
>> news:Xns967BAE687ACFDtimwitortwrotethis@207.217.125.201...
>>> VFP6 SP5 on XP Pro SP1
>>>
>>> I have a long routine that, at one point produces some PDFs using
>>> the PDFWriter printer. When the PDF is produced, a little
>>> "Printing.." dialog pops up and tallies the pages as they are printed,
>>> then disappears. After it goes away, my application no longer is the
>>> active window. As a result, if the user presses any keys, they
>>> are not visible to my app (I allow the user to interrupt the process
>>> by pressing ESC). I'm sure there must be a reliable way to
>>> automatically make my app the active window again after printing
>>> to PDF. I just haven't found it yet. Any ideas?
>
> Neil Waterworth seemed to utter in
> news:#eSjvmfdFHA.3452@tk2msftngp13.phx.gbl:
>
>> Not my best idea, but the first one that springs to mind. Have you
>> tried a timer and:
>>
>> ox = createobject("WScript.Shell")
>> ox.AppActivate("MyAppsWindowCaption")
>
> Thanks, Neil, I'll give it a shot.
This works for me:
LOCAL whnd, x
*
* Get window handle:
*
SET LIBRARY TO foxtools.fll
whnd = mainhwnd()
SET LIBRARY TO
* Stuff that might make another application active here...
*
* Restore me to the foreground, active window:
*
DECLARE Integer SetForegroundWindow in WIN32API long whnd
x = SetForegroundWindow(whnd)
-- TRW
_______________________________________
t r w 7
at
i x dot n e t c o m dot c o m
_______________________________________