Opera Browser - GetClassName!

jesus4u

Well-known member
Joined
Feb 13, 2003
Messages
47
I am trying to get the ClassName of the Opera browser and then read the url from the address bar but I cant seem to get the name of the address bar. What is it? I am using Spy++ and no luck. Other browsers address bars are typically called "Edit" but not in Opera.

Code:
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
 
with your opera browser opened up try this :
Code:
    Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Private Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hwnd As Integer, ByVal lpClassName As System.Text.StringBuilder, ByVal nMaxCount As Integer) As Integer


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim x As Integer = FindWindow("OpWindow", vbNullString)
        Dim s As System.Text.StringBuilder = New System.Text.StringBuilder(255)
        GetClassName(x, s, s.Capacity)
        MessageBox.Show("the opera browsers hwnd is: " & x & Chr(13) _
        & "the window name is: " & s.ToString)
    End Sub
:)
 
It looks like the browser bit of Opera (browser itself, and the toolbar at the top of it with the addressbar etc) is all one class called FRAMES2. Even Spy++ couldnt see that it had child windows.

You might be able to enumerate the child windows with VB, but if Spy++ couldnt do it, you may be out of luck. Anyway, why do you need to read the addressbar of Opera?
 
Back
Top