⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webbmenu.frm

📁 这个程序演示如何控制控件的缺省弹出菜单(例如TextBox)
💻 FRM
字号:
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
Begin VB.Form Form1 
   Caption         =   "Webbmenu sample from BlackBeltVB.com"
   ClientHeight    =   3945
   ClientLeft      =   2370
   ClientTop       =   2790
   ClientWidth     =   6720
   LinkTopic       =   "Form1"
   ScaleHeight     =   3945
   ScaleWidth      =   6720
   Begin VB.TextBox Text1 
      Height          =   315
      Left            =   420
      TabIndex        =   0
      Text            =   "http://blackbeltvb.com"
      Top             =   3480
      Width           =   4395
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Navigate!"
      Default         =   -1  'True
      Height          =   375
      Left            =   4980
      TabIndex        =   1
      Top             =   3480
      Width           =   1515
   End
   Begin SHDocVwCtl.WebBrowser WebBrowser1 
      Height          =   2955
      Left            =   420
      TabIndex        =   2
      Top             =   240
      Width           =   6075
      ExtentX         =   10716
      ExtentY         =   5212
      ViewMode        =   1
      Offline         =   0
      Silent          =   0
      RegisterAsBrowser=   0
      RegisterAsDropTarget=   1
      AutoArrange     =   -1  'True
      NoClientEdge    =   0   'False
      AlignLeft       =   0   'False
      ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
      Location        =   ""
   End
   Begin VB.Menu mnuBrowser 
      Caption         =   "Browser Menu"
      Visible         =   0   'False
      Begin VB.Menu mnuPrint 
         Caption         =   "&Print"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' Webbmenu sample from BlackBeltVB.com
' http://blackbeltvb.com
'
' Written by Matt Hart
' Copyright 1999 by Matt Hart
' 
' This software is FREEWARE. You may use it as you see fit for 
' your own projects but you may not re-sell the original or the 
' source code. Do not copy this sample to a collection, such as
' a CD-ROM archive. You may link directly to the original sample
' using "http://blackbeltvb.com/blackbeltvb.htm"
' 
' No warranty express or implied, is given as to the use of this
' program. Use at your own risk.
'
' Note that the .hWnd "property" of the WebBrowser control
' has never worked for me, thus the workaround for obtaining
' the hWwnd.

Dim hw As Long

Private Sub Command1_Click()
    WebBrowser1.Navigate Text1.Text
    WebBrowser1.Visible = True
End Sub

Private Sub Form_Load()
    Dim h As Long, aClass As String, k As Long
    h = GetWindow(hwnd, GW_CHILD)
    aClass = Space$(128)
    Do While h
        k = GetClassName(h, aClass, 128)
        If Left$(aClass, k) = "Shell Embedding" Then hw = h: Exit Do
        h = GetWindow(h, GW_HWNDNEXT)
    Loop

    WebBrowser1.Navigate ""
    origWndProc = SetWindowLong(hw, GWL_WNDPROC, AddressOf AppWndProc)
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    SetWindowLong hw, GWL_WNDPROC, origWndProc
End Sub

Private Sub mnuPrint_Click()
    MsgBox "Print!"
End Sub

Private Sub Text1_GotFocus()
    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -