Solved

Webbrowser troubles

Posted on 2000-04-28
6
149 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSON Response and request in VB6 application 11 230
How to debug this code 7 56
Exit a vb6 apps when a calling it apps closes 15 41
vb6 - Transfer from MSHFlexgrid1 to xls issue 8 45
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

943 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