Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirect screen to a file

Status
Not open for further replies.

peterd51

Technical User
Feb 22, 2005
109
GB
Hi,

we have a database that outputs in html and starts IE to display...

I'd like to send the output to a file so that I can read it in to a VB5 program to extract bits of the data.

Any ideas about how I can redirect from the screen to a file in Windows XP?

Regards
Peter
 
Have you thought about using a WebBrowser control rather than firing IE? It would give you full control within VB.
 
Or save the HTML file and parse it?

HarleyQuinn
---------------------------------
Help us to help you,
read FAQ222-2244 before posting.
 
Hi,

it's not my database, it's been written some time ago by someone who no longer works here.

Unfortunatley I can't get access to the information in any way other then by displaying the data on the screen and I need to pick out various parts to present in a different format...

Regards
Peter
 
Do you know the path to the document that is being displayed in IE?

HarleyQuinn
---------------------------------
Help us to help you,
read FAQ222-2244 before posting.
 
Hi,

no, sorry.

It's hidden somewhere on a server in the UK (I'm in Amsterdam) which is why I wanted to copy the screen output.

Regards
Peter
 
You can't exactly redirect it. However, if you do happen to know the caption of the Internet Explorer window, then something like the following will allow you to grab the entire source HTML of the page displayed in that window. You will need to add a reference to the Microsoft Internet Controls library:

Code:
[blue]Private Function GetHTML(strBrowserCaption As String) As String
    Dim ExplorerWindows As ShellWindows
    Dim BrowserWindow As WebBrowser
    
    Set ExplorerWindows = New ShellWindows
    
    For Each BrowserWindow In ExplorerWindows
        If BrowserWindow.LocationName = strBrowserCaption Then
            GetHTML = BrowserWindow.Document.body.parentNode.outerhtml
        End If
    Next
End Function[/blue]
 
I don't suppose an image of the screen would be sufficient - if so you could trigger a screen dump.
 
Hi,

Glasgow...the data will spread over more than one page at times and I'll need to grab all of it.

Strongm...this is probably what I was trying to think of but couldn't put it into words...Thanks!

I've been toying with various output screens during lunch and I can probably piece together the actual location of the data. It's on the intranet and I have a stating point for that, then in the HTML text all links should be relative to the starting screen. Or something!

I'm not exactly sure how to use Microsoft Internet Controls Library as I've not used any library files before, but hopefully a bit of reading will show me what to do...

Regards
Peter
 
Hi,

I found the Microsoft Internet Control and added it, put a control on the form, it came in as WebBrowser1.

I'm getting a type mismatch error on the for each line...

any ideas please?

Regards
Peter
 
Not the control, the library. Add it as a reference, not as a component.
 
Hi Peter,

Not trying to hijack this thread from strongm (I'm just going to try and help you use his code).

Rather than adding a component, if you add a reference to Microsoft Internet Controls. You can then call the function, passing in the caption of your browser (not including the " - Microsoft Internet Explorer" part if you are hardcoding it), that should allow you (as it stands now, you will obviously have to work with the function's return value to extract what you are after) to achieve most of what you want.

Hope this helps

HarleyQuinn
---------------------------------
Help us to help you,
read FAQ222-2244 before posting.
 
And he beat me to it... [smile]

HarleyQuinn
---------------------------------
Help us to help you,
read FAQ222-2244 before posting.
 
Hi,

erm, sorry but I have no idea what you mean by 'add it as a reference, not as a component'.

I've done some searching around the internet from work this morning (I don't have access from my apartment and my VB books and CD's are back in the UK!). I've found some bits and pieces to read tonight...hopefully I'll start to understand it all after that.

Thanks
Peter
 
1. Click the 'Project' menu
2. Select 'References', which will result in a dialog box
3. Scroll down until you find 'Microsoft Internet Controls'*, and tick it
4. Click 'OK'

All done



* The Microsoft Internet Controls library sometimes is not registered as a reference. If this is the case, then you'll need a replace step 3 with

3 (alternative) Click the 'Browse' button
3a Browse to C:\WINNT\SYSTEM32
3b Locate and select shdocvw.dll
3c Click 'Open'
 
Hi,

I'll try that tonight, thanks.

I did a google search on 'add a reference to Microsoft Internet Controls' and found an interesting bit on the MS site, coveres all sorts of things. Too much to read in full now so I've printed out a copy to read through later when I have access to my PC and I can tweak controls and things as I read.

Regards
Peter



 
One thing you do NOT want to do is have both a project reference and a component reference for the same control lib. That causes strange errors.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Hi,

thanks...I'd have just set up the second point without removing the first part!

Regards
Peter
 
Hi,

slight change of plan...

I'd forgotten that today is the 14th - Bastile day in France and we have about 30 French people working here...

and when we have a special day I bake cakes the evening before.

These are very nice cakes - baked in red, white and blue stripes with a little French flag planted in the top of each one...

and I got a kiss from each of the French girls...

so, sorry, but I didn't get time to play with the PC last night.

Tonight's the night!

Regards
Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top