Getting WebBrowser controls history

Posted on 2004-09-08
Last Modified: 2008-02-01

Im using a WebBrowser control within VB6...I have back and forward buttons just like in IE..however, i want to disable the back, or forward buttons within the menu if the WebBrowsers history is javascript it is obviously history.length there anyway i can either return this value to my vb app, or use my own VB call to get the windows history????

Also, anyone any idea how to disable an item in a VB 6 menu, i dont see that the menu has any object name i can refer to???


Question by:higgsy
  • 6
  • 3
LVL 32

Accepted Solution

Erick37 earned 500 total points
ID: 12009763
From MS:

"The WebBrowser control supports a CommandStateChange event, which is fired whenever the Forward or Back buttons need to be enabled or disabled. ";EN-US;163282

' A Visual Basic application can also implement this
' functionality in this manner:  

Private Sub WebBrowser_CommandStateChange(ByVal Command As Long,ByVal Enable As Boolean)

       Select Case Command
           Case CSC_NAVIGATEBACK
               Back.Enabled = Enable
               Forward.Enabled = Enable
       End Select

End Sub
LVL 32

Expert Comment

ID: 12009806

Here are the constants:

Private Const CSC_NAVIGATEFORWARD As Long = 1
Private Const CSC_NAVIGATEBACK As Long = 2

Author Comment

ID: 12009865
Hi Erick,

That seems to work great, however what does Back.Enabled and Forward.Enabled refer to .... i just ran this code and it crashes due to the fact that there are no objects called Back or Forward in my App...

Should this refer to the menu item name??

Author Comment

ID: 12009881
Hi Erick,

Ive tried changing it o the name of my menu item and it works great....thanks...

Do u know how to add an icon into any menu item???
IT, Stop Being Called Into Every Meeting

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!

LVL 32

Expert Comment

ID: 12009980
Right, replace Back.Enabled to [the name of your back button].enabled

>>Do u know how to add an icon into any menu item???
Some links for you:
LVL 32

Expert Comment

ID: 12010051
And another good one which uses an ImageList control to store the bitmaps:

Author Comment

ID: 12010068
Top stuff Erick....

Thanks mate
LVL 32

Expert Comment

ID: 12058457
You're welcome, glad it worked out for you.
LVL 32

Expert Comment

ID: 12123686
Looking forward to an "A" when you get the chance.


Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VB6 convert MSHFlexgrid1 cells 7 52
Help in WHSCRIPT 9 41
using Access 8 52
Added a column screws up code 5 0
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.
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…

757 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

21 Experts available now in Live!

Get 1:1 Help Now