Solved

Webbrowser troubles

Posted on 2000-04-28
6
150 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

777 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