Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using the web browser control in a form
Message
From
30/10/2001 11:35:26
 
 
To
30/10/2001 11:13:30
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00575116
Message ID:
00575136
Views:
30
Fernando,

Take a look at Thread #573402 for examples of how to use the web browser control for loading an HTML. From there you can use the document.body.innerText to obtain only the text for the HTML document and save it to a file with StrToFile(). Be aware that this works ok with relatively static pages. If you have a page with say a combobox with values each value is written to the file also. For example once you have navigated to a url:
lcText = Thisform.Web1.document.body.innerText
StrToFile(lcText, "c:\myfile.txt")
HTH

>Hi folks,
>
>I have an application where the user will inform me a .html file name to load (he'll choose it in a getfile()), and then I'll have load it and show it in a form, like in a browser. In that form there will be some buttons that he will tell the app what he wants to do. One of these buttons tell the app to save the loaded html file as plain text, in order to parse the text contained in it, for some information.
>
>To do that I must:
>
>1) show a form with the browser control (or automathe IE (?))
>2) user presses the "Load" button
>3) I show a getfile () dialog
>4) user selects the desired file and tell getfile () to open it
>5) I load the html file
>6) save its contents as text only
>7) load (into a string or such) the text only file and parse it
>8) save parsed information in an appropriate dbf table
>
>I've found two examples in MSDN files. The first one uses automation, and the second one uses an OLE object.
>
>Question: What example should I choose as the best one to implement what I'm trying?
>There is another one, best suited form my case?
>
>Below are the listing of the samples I've found.
>
>Thanks in advance,
>
>Fernando
>
>Example #1
>
>Explorer = CreateObject ("InternetExplorer.Application")
>Explorer.Navigate ("http://www.microsoft.com")
>Explorer.Visible = .t.
>
>
>Example #2
>
>PUBLIC oMyHelpViewer
>
>   oMyHelpViewer = NewObject("myhtmlhelpviewer")
>   oMyHelpViewer.Show
>
>   DEFINE CLASS myhtmlhelpviewer AS form
>      Top = 0
>      Left = 0
>      Height = 454
>      Width = 633
>      DoCreate = .T.
>      BorderStyle = 2
>      Caption = "Custom HTML Help Viewer"
>      MaxButton = .F.
>      WindowState = 0
>      Name = "Form1"
>
>      ADD OBJECT olecontrol1 AS olecontrol WITH ;
>         Top = 10, ;
>         Left = 16, ;
>         Height = 433, ;
>         Width = 601, ;
>         Name = "Olecontrol1", ;
>         OLEClass = "Shell.Explorer.2"
>
>      PROCEDURE olecontrol1.Refresh
>         NODEFAULT
>      ENDPROC
>
>      PROCEDURE olecontrol1.Init
>         cVFPHelpTopicPath = "mk:@MSITStore:" + "D:\Arquivos de Programas\Microsoft Visual Studio\MSDN\2000JAN\1033\FOXHELP.CHM" + "::/html/vfpstartpage.htm"
>         This.Navigate(cVFPHelpTopicPath)
>      ENDPROC
>   ENDDEFINE
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform