Solved

Webbrowser troubles

Posted on 2000-04-28
6
151 Views
Last Modified: 2010-05-02
I'm using a Webbrowser control (IE 5) in my application, from time to time I tell the browser it has to refresh the page (can be updated by another application) and go to the end of the page.
Refreshing works well, but positioning at the end doesn't work.  I'm using SendKeys "^{END}", but this works only when I first click once on the webbrowser control.  Then it positions itself at the end, otherwise it doesn't do anything.

Could someone please help me or does anyone know a good 3rd party webbrowser control (support of HTML 4) with more functionality, like hiding scrollbars, ...  

Thanks
Gunther
0
Comment
Question by:guntherds
6 Comments
 
LVL 7

Expert Comment

by:Vbmaster
ID: 2758791
Have you tried with the mouse_event API, clicking on the browser area before attempting the ^{END} sendkey thingie?

Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4


(use mouse_event with leftdown, add a doevents and then another mouse_event now with leftup - this will emulate a click with the mouse)
0
 

Expert Comment

by:martingp
ID: 2767275
Hi guntherds

I would approch the problem from a different angle than using send keys. Take advantage of the HTML language by using the 'bookmark' tag.

Place this code at the end of your document:
<A NAME="end"></A>

When you refresh don't use the refresh method just the navigate method like this:
webbrowser.navigate "yourpage.html#end"

This will tell the webbrowser control to show yourpage.html and scroll down to the 'end' tag.

PS.
The IE browser control provide everything you need for browser development :-)
0
 

Author Comment

by:guntherds
ID: 2796572
Sorry, I don't have time right now to test it, but if it works you certainly will get the points
But how can I solve this: I'm appending lines to this HTML-file and tell my 'browser'-component to refresh.
I could do it the way you tell me, but then after each line line I would have to put this tag, which tag will the browser then take for positioning at the end?
Or do you have another solution?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Expert Comment

by:martingp
ID: 2797424
Hi gunther

First of all the method I desribed above does work.

Here is the answer to your second problem:

You say that you append lines to the end of the file, possibly from different applications. All you have to do is add the 'bookmark' code to the last line in the file. Everytime you update it's just a matter of deleting the last line (bookmark) append the new data and then add the bookmark line again...

If you have enough control over your data you could also re-create the html file everytime you do an update (if you have a limited amount of data).

If there are any conflicts please provide more details.

Good luck...
0
 

Author Comment

by:guntherds
ID: 2797823
I don't doubt it will work :-)
I'll test it asap
Keep you informed
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 100 total points
ID: 2895842
Dim w As Object
Set w = WebBrowser1.Document.parentwindow
w.Scroll 0, 30000
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question