Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I force an OK
Message
From
04/04/2009 07:28:16
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/04/2009 03:51:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01393235
Message ID:
01393244
Views:
105
This message has been marked as the solution to the initial question of the thread.
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform