>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