vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Blitzschnelles Erstellen von grafischen Diagrammen!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Fortgeschrittene
>> ES FUNKTIONIERT! << Für alle, die wissen wollen, wie: 
Autor: Dartrax
Datum: 05.04.05 11:39

Hallo!

Nach einigem suchen, ausprobieren und experimentieren habe ich einen Weg gefunden, der auf diesem Artikel basiert:
http://codeproject.com/csharp/advhost.asp?df=100&forumid=4164&exp=0

Zunächst die "Source files" herunterladen, daraus die "Interop.SHDocVw.dll" in das bin-Verzeichnis eines neuen Projektes verschieben und als Verweis einbinden. Dann einen WebBrowser auf die Form ziehen und folgenden Code einfügen:

    ' API-Fubktion zum Ermitteln des STRG-Tastenstatus
    <Runtime.InteropServices.DllImport("User32.dll")> _
    Public Shared Function GetAsyncKeyState(ByVal vKey As Integer) As Short
    End Function
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
      System.EventArgs) Handles MyBase.Load
        AxWebBrowser1.Navigate("search.msn.de")
    End Sub
 
    Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e _
      As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles _
      AxWebBrowser1.DocumentComplete
        Dim MyCustomDoc As MsHtmHstInterop.ICustomDoc = CType( _
        AxWebBrowser1.Document, MsHtmHstInterop.ICustomDoc)
        MyCustomDoc.SetUIHandler(CType(Me, MsHtmHstInterop.IDocHostUIHandler))
    End Sub
 
    ' Implementierung von IDocHostUIHandler
    Public Sub EnableModeless(ByVal fEnable As Integer) Implements _
      MsHtmHstInterop.IDocHostUIHandler.EnableModeless
    End Sub
    Public Sub FilterDataObject(ByVal pDO As MsHtmHstInterop.IDataObject, ByRef _
      ppDORet As MsHtmHstInterop.IDataObject) Implements _
      MsHtmHstInterop.IDocHostUIHandler.FilterDataObject
        ppDORet = Nothing
    End Sub
    Public Sub GetDropTarget(ByVal pDropTarget As MsHtmHstInterop.IDropTarget, _
      ByRef ppDropTarget As MsHtmHstInterop.IDropTarget) Implements _
      MsHtmHstInterop.IDocHostUIHandler.GetDropTarget
        ppDropTarget = Nothing
    End Sub
    Public Sub GetExternal(ByRef ppDispatch As Object) Implements _
      MsHtmHstInterop.IDocHostUIHandler.GetExternal
        ppDispatch = Nothing
    End Sub
    Public Sub GetHostInfo(ByRef pInfo As MsHtmHstInterop._DOCHOSTUIINFO) _
      Implements MsHtmHstInterop.IDocHostUIHandler.GetHostInfo
    End Sub
    Public Sub GetOptionKeyPath(ByRef pchKey As String, ByVal dw As _
      System.UInt32) Implements _
      MsHtmHstInterop.IDocHostUIHandler.GetOptionKeyPath
        pchKey = Nothing
    End Sub
    Public Sub HideUI() Implements MsHtmHstInterop.IDocHostUIHandler.HideUI
    End Sub
    Public Sub OnDocWindowActivate(ByVal fActivate As Integer) Implements _
      MsHtmHstInterop.IDocHostUIHandler.OnDocWindowActivate
    End Sub
    Public Sub OnFrameWindowActivate(ByVal fActivate As Integer) Implements _
      MsHtmHstInterop.IDocHostUIHandler.OnFrameWindowActivate
    End Sub
    Public Sub ResizeBorder(ByRef prcBorder As MsHtmHstInterop.tagRECT, ByVal _
      pUIWindow As MsHtmHstInterop.IOleInPlaceUIWindow, ByVal fRameWindow As _
      Integer) Implements MsHtmHstInterop.IDocHostUIHandler.ResizeBorder
    End Sub
    Public Sub ShowContextMenu(ByVal dwID As System.UInt32, ByRef ppt As _
      MsHtmHstInterop.tagPOINT, ByVal pcmdtReserved As Object, ByVal _
      pdispReserved As Object) Implements _
      MsHtmHstInterop.IDocHostUIHandler.ShowContextMenu
        ' ContextMenü erlauben
        Throw New Runtime.InteropServices.COMException("", 1)
    End Sub
    Public Sub ShowUI(ByVal dwID As System.UInt32, ByVal pActiveObject As _
      MsHtmHstInterop.IOleInPlaceActiveObject, ByVal pCommandTarget As _
      MsHtmHstInterop.IOleCommandTarget, ByVal pFrame As _
      MsHtmHstInterop.IOleInPlaceFrame, ByVal pDoc As _
      MsHtmHstInterop.IOleInPlaceUIWindow) Implements _
      MsHtmHstInterop.IDocHostUIHandler.ShowUI
    End Sub
Fortsetzung im nächsten Post...

Meine Homepage: www.dartrax.de


Posting wie es leibt und lebt
. . . und voll daneben geht!
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
WebBrowser Control Shortcuts/Tastenkombinationen verhindern ...3.712Dartrax08.03.05 17:39
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...3.038Maywood08.03.05 20:41
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.864Dartrax08.03.05 21:28
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.952Dartrax08.03.05 21:43
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.896Maywood08.03.05 21:50
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...3.052Dartrax08.03.05 22:10
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.934ModeratorFZelle09.03.05 09:02
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.893Dartrax09.03.05 10:08
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.929Maywood09.03.05 15:55
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.830Dartrax09.03.05 17:23
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.898Maywood10.03.05 09:30
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...3.000Dartrax23.03.05 23:28
>> HIER GEHT'S WEITER << In VB5 habe ich es hinb...3.078Dartrax24.03.05 15:53
>> ES FUNKTIONIERT! << Für alle, die wissen woll...4.107Dartrax05.04.05 11:39
(Fortsetzung)2.980Dartrax05.04.05 11:40
(Korrektur) <-- BEACHTEN!2.974Dartrax05.04.05 11:43
Re: (Korrektur) <-- BEACHTEN!2.913UR06.04.05 00:09
Re: (Korrektur) <-- BEACHTEN!2.978Dartrax06.04.05 01:03
Re: (Korrektur) <-- BEACHTEN!2.900UR06.04.05 09:30
Re: (Korrektur) <-- BEACHTEN!3.000Dartrax06.04.05 13:18
Re: >> ES FUNKTIONIERT! << Für alle, die wissen ...2.869Maywood05.04.05 19:49
Re: >> ES FUNKTIONIERT! << Für alle, die wissen ...2.892Dartrax05.04.05 21:06
Re: >> ES FUNKTIONIERT! << Für alle, die wissen ...2.920Maywood06.04.05 16:02
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.864ModeratorFZelle09.03.05 18:17
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.864Dartrax09.03.05 18:32
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...2.902ModeratorFZelle10.03.05 11:52
Re: WebBrowser Control Shortcuts/Tastenkombinationen verhind...3.067Dartrax10.03.05 21:39

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel