Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Waiting for execution of another software
Message
De
06/10/1996 16:18:45
 
 
À
02/10/1996 20:27:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00009202
Message ID:
00009505
Vues:
31
>In a method I launch R&R report writer with run command and I want to be able to stop VFP until R&R job is over. After the run commmand there is some code I want to execute only after R&R is closed
>
>Any idea!
Hi, I have a similar issue with lauching QModem and waiting until the remote BBS session is complete. In the Win32api you will find a findWindow call. The code is short as follows:
FUNCTION findWindowHandle()
lparameter tcWinTitle

DECLARE integer FindWindow in WIN32API string cNull, string cWinName
return FindWindow(0,tcWintitle)

ENDFUNC
If you know the exact window caption you can loop on the name until gone i.e.
do while findWindowHandle(tcWaitWindowTitle)<>0
=inkey(1)
enddo

inkey or any other wait will do and you can set the delay to match the lauched task. There may be more elegant ways but this works fine. If the user activates the fox app no mouse or keyboard activitities are honored since the method/prg that is loop is trashing the inkey buffer. When the lauched window goes away the loop breaks and we're back in business.

YOu could also add a call to
FUNCTION setWindowFocus()
lparameters thWinHandle
local llWinNT, llWin31, llWin95, lhOldHandle

llWinNT=iif(file(getenv('WINDIR')+'\SYSTEM32\USER32.DLL'),.T.,.F.)
llWin31=iif(file(getenv('WINDIR')+'\SYSTEM\WIN32s\W32SCOMB.DLL'),.T.,.F.)
llWin95=iif(!llWinNT and file(getenv('WINDIR')+'\SYSTEM\USER32.DLL'),.T.,.F.)

if llWin31
DECLARE integer SetFocus in WIN32API integer hWinHandle
lhOldHandle=SetFocus(thWinHandle)
else
DECLARE integer SetForegroundWindow in WIN32API integer hWinHandle
lhOldHandle=SetForegroundWindow(thWinHandle)
endif

return lhOldHandle
ENDFUNC
to set focus to you. I found templates for these a while back on another board and tried to generic them. Hope this helps
Gary
Helping Make Ideas Reality
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform