>The following code, when it is compiled as an exe, does not work unless the line "wait '' timeout .1" is included. I am content that I am able to get this to work but my anal coworker insists that we need to know why...
>
>_screen.windowstate=2 && max
>_screen.caption=' Get New Patriot Files'
>set sysmenu off
>_SCREEN.VISIBLE=.T.
>
>wait '' timeout .1
>
>set safety off
>set talk off
>
>ini=NEWOBJECT('writeextendini','c:\vfpcomm\myextend')
>release myarr
>dimension myarr[1]
>
>=adir(myarr,'c:\homeland\sdnfiles\*.ff')
>
>ini.retrievesdnfiles(@myarr)
> * this launches a Delphi app that compares the timestamps on certain
> * files on an ftp server. This does not run if the wait line is not included.
>IF ini.ok=.t.
> cf=JUSTPATH(SYS(2019))
> torun=ADDBS(cf)+'ftpengine.exe'
> runin=cf
> SET PROCEDURE TO runwait additive
> =launchappandwait(torun,runin)
> RELEASE PROCEDURE runwait
>endif
>
>ini=.null.
> * other stuff happens
>declare integer FindWindow in Win32api string cClass, string Cwindow
>nHwd=FindWindow(0,' Get New Patriot Files')
>if nHwd <> 0
> wParam=''
> lParam=0
> Msg=18 && quit
> DECLARE SHORT PostMessage IN user32;
> INTEGER hWnd,;
> INTEGER Msg,;
> STRING @ wParam,;
> INTEGER lParam
> PostMessage (nHwd,Msg,@wParam,lParam)
>ENDIF
>* if the wait line is not included and the _screen is not set to visible the hour glass comes up for about 5 seconds and then disappears without the delphi app running. The exe file is still running as a process but not as an application. If _screen.visible=.t. the app will start but will always show up in the task manager as not responding. Thanks for any help...
What happens if:
-you use _screen.hWnd instead of FindWindow() or
-use FindWindow with class parameter instead of caption.
Cetin