Zugriff auf Microsoft WebBrowser

Zugriff auf Microsoft WebBrowser

Hi @all.
Ich hoffe, ich bin hier richtig. Als Newbie im Bereich Zenon stehe ich gerade vor einem Problem.
Ich habe ein Bild, welches als einziges Object einen VBerweis auf ein Microsoft-Browser Control besitzt.
Unter VBA benötige ich Zugriff auf dieses Control.
Derzeit habe ich eine Methode Init_BrowserInit() welche als Paramter "objElem" vom Typ Element mitbringt. Abgesehen davon, dass mich interessieren würde wie hier der Zusammenhang oder die œbergabe dieses Elements realisiert wurde (scheint eine automatische œbergabe von Zenon als Instanz von Microsoft WebBrowser zu sein?) benötige ich eine Referenz auf dieses Objekt.
Hintergrund: Ich muss aus der VBA-Umgebung heraus reagieren, wenn irgendwo die Language gewechselt wurde und diesem Object dann entsprechend navigieren.
Ich hoffe, es ist zu verstehen, wo mein Problem liegt.
Derzeit funktiert das Navigieren zwar - aber ich bekomme im Laufe der Zeit ein Problem mit dem Speicher.
Nachfolgen die Codesequenzen:
Public Sub Init_BrwoserInit(obELem as Element)
' m_objElem wurde als globale Variable vom Typ Element deklariert
If cInitBrowser Is Nothing Then
Set cInitBrowser = New clsInitBrowser
End If
If Not obElem Is Nothing Then
Set m_objElem = obElem
End If
cInitBrowser.RefreshBrowserControl

' Hier würde ich gerne wieder "zerstören"
' Set m_objElem = Nothing
End Sub

' in der Class clsBrwoserInit
Public Sub RefreshBrowserControl()
Dim objVar As Variable
Dim objControl As Object
Dim navPath As String
Dim iniPath As String
Dim strLangSuffix As String
On Error GoTo ErrorHandling

' Nachfolgend erfolgt zwar ein Sprung in die If-Abfrage, die anschließende
' Zuweisung funktioniert jedoch nicht mehr. objControl bleibt "Nothing"
If Not m_objElem Is Nothing Then
Set objControl = m_objElem.AktiveX
End If
Set objVar =
thisProject.Parent.Parent.Projects.Item("BAS").Variables.Item("LOCAL_LngExt")

If Not objVar Is Nothing Then
If objVar.value = "de" Then
strLangSuffix = "?languageId=de-DE"
ElseIf objVar.value = "en" Then
strLangSuffix = "?languageId=en-GB"
Else
' derzeit nicht definiert - Standart ist englisch
strLangSuffix = "?languageId=en-GB"
End If
Set objVar = Nothing
Else
strLangSuffix = "?languageId=en-GB"
End If

iniPath = thisProject.Path & "RT\FILES\zenOn\custom\additional\Settings\" & INI_FILE
navPath = Read_INI("LDS_CLIENT", "Path", iniPath)
Dim lngPos As Integer
lngPos = InStr(1, navPath, "?LanguageId", vbTextCompare)
If lngPos > 0 Then
navPath = Mid(navPath, 1, lngPos - 1)
End If
If navPath <> "" Then
navPath = navPath + strLangSuffix
If Not objControl Is Nothing Then
objControl.Navigate navPath
Else
Debug.Print "Kein Browserobject vorhanden!"
End If
End If
' Set objControl = Nothing

Exit Sub
ErrorHandling:
Call ErrorHandler(MODULE_NAME & "::RefreshBrowserControl")
End Sub

Diese Methode wird angestoßen, wenn ich einen "langauge-Wechsel-Event" erhalte.
Public Sub RefreshBrowserLanguage()
If Not cInitBrowser Is Nothing Then
cInitBrowser.RefreshBrowserControl
Debug.Print "refresh browser language - mdlextroutines"
End If

End Sub


This is a migrated post! Originally posted on 29.06.2009 by user henrykm. Please be aware that information can be outdated.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com