Solved

Webbrowser troubles

Posted on 2000-04-28
6
148 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Expert Comment

by:martingp
Comment Utility
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
Comment Utility
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
Comment Utility
Dim w As Object
Set w = WebBrowser1.Document.parentwindow
w.Scroll 0, 30000
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now