>The code i am using below does not require the operator to press OK or close the window BEFORE returning to foxpro operations. in consequence FP window pops up with the message "switch to or re-try" - neither of which access the problem - namely the activated window running behind the main program.
>
>Can anyone provide me with a handy piece of code that i can add to force the user to click OK before returning to FP operations. Appreciate your help. thanks
>
>ystr=filetostr('sample.txt')
>
>apIE=createobject("internetexplorer.application")
>
>apIE.navigate("about:blank")
>
>do while apIE.busy or apiE.readystate#4
>
>ENDDO
>
>&&always on top
>
>declare integer BringWindowToTop in Win32API integer lnWnd
>
>= BringWindowToTop(apIE.hwnd )
>
>apIE.document.ParentWindow.alert(ystr)
>
>apIE.quit
Why are you using jscript alert to show the message? Simply use messagebox. i.e:
messagebox(m.ystr, 4096)
If you want alert() anyway then instead of createobject(..), create the web browser in the form:
ystr = "My alert box."
oForm = Createobject('myForm',m.ystr)
Define Class myForm As Form
Add Object myBrowser As OleControl ;
With OleClass='Shell.Explorer'
Procedure myBrowser.Refresh
Nodefault
Endproc
Procedure Init(tcStr)
This.myBrowser.Navigate2("about:blank")
Do While This.myBrowser.readystate # 4
Enddo
This.myBrowser.Object.Document.ParentWindow.alert(m.tcStr)
Return .F.
Endproc
Enddefine
Cetin