>>I'd like to write a VFP program that controls a browser to:
>>
>>1) Open a specific web page using a URL from 'the database'
>>2) Read the source to extract all the links and add all the (unique) URLs to the database
>>3) Go to the next URL in the database and start over at step (1).
>>
>>Any ideas?
>>
>>Thanks in advance
>
>You can invoke Intenet Explorer as an Active-X server. Microsoft's site has a paper listing the properties and methods of the server. I don't know if you can read the source or not but you can navigate the web under VFP's control.
>
>To invoke the server
>oIE = createobject("internetwxplorer.application")
>oIE.visble=.T.
>
>To open a URL
>oIE.navigate(URLname)
Cool! I knew you could do this, but I didn't realize it was so easy. We store e-mail and web addresses of members and companies in our database, so I have created a textbox subclass called webtext and made it the default class for all of these fields. In the dblclick event of the textbox is this code:
if !empty(alltrim(this.value)) and upper(left(alltrim(this.value), 4)) = "WWW.) then
oIE = createobject("internetwxplorer.application")
oIE.navigate(this.value)
oIE.visible=.T.
endif
tooltiptext = "Double click to visit this website"
forecolor = RGB(0,0,255) && make it look like a hyperlink
Works like a charm. Now any place you view a web address in my apps, you can doubleclick to visit that website. I plan to add in some more code to first check if IE is available on the machine, but since it is on all of ours here, it works fine for now. Next on the list is a similar class for e-mail addresses. Thanks for the push, Stephen!
Erik Moore
Erik Moore
Clientelligence