VB WebBrowser 控件如何屏蔽所有页面声音
VBWebBrowser控件如何屏蔽所有页面声音。(包括刷新页面,页面加载完成所发出的“滴答”声。)强调一点:我想要的答案是可以在程序内部实现这个效果,而不是修改系统设置...
VB WebBrowser 控件如何屏蔽所有页面声音。(包括刷新页面,页面加载完成所发出的“滴答”声。)
强调一点:我想要的答案是可以在程序内部实现这个效果,而不是修改系统设置从而来进行实现。
s要实现网页不能发出的任何声音,怎么设置,但不能影响用户使用 展开
强调一点:我想要的答案是可以在程序内部实现这个效果,而不是修改系统设置从而来进行实现。
s要实现网页不能发出的任何声音,怎么设置,但不能影响用户使用 展开
3个回答
展开全部
Option Explicit
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Private Sub Command1_Click()
LockWindowUpdate Me.hwnd
WebBrowser1.Visible = False
WebBrowser1.navigate "m.baidu.com"
End Sub
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
WebBrowser1.Visible = True
LockWindowUpdate 0
End Sub
我测试了, 可用 以前也遇到过这个问题
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Private Sub Command1_Click()
LockWindowUpdate Me.hwnd
WebBrowser1.Visible = False
WebBrowser1.navigate "m.baidu.com"
End Sub
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
WebBrowser1.Visible = True
LockWindowUpdate 0
End Sub
我测试了, 可用 以前也遇到过这个问题
追问
还是不行,背景音乐,等都不行,还有别的办法吗
追答
背景音乐做是可以做, 不过就麻烦了, 你去搜下cWebBrowser.cls
要重新实现接口
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
WebBrowser.Silent = True
追问
试了你的方法不行,网页声音还是不能屏蔽,还有其它方法吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'添加一个控件Microsoft Internet Contros
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function VirtualProtect Lib "kernel32" (lpAddress As Any, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub Command1_Click()
WebBrowser1.Silent = True
WebBrowser1.Navigate "http://www.kugou.com/song/#hash=81EF9CE793B673E36696BAD77BCF0238"
End Sub
Private Sub Form_Load()
Dim OldProtect As Long
Dim FunAddress As Long
Dim Code1(2) As Byte
Code1(0) = &HC2: Code1(1) = &H4: Code1(2) = &H0
FunAddress = GetProcAddress(LoadLibrary("Winmm.dll"), "midiStreamOpen")
If FunAddress <> 0 Then
VirtualProtect ByVal FunAddress, 3, &H40, OldProtect
CopyMemory ByVal FunAddress, ByVal VarPtr(Code1(0)), 3
End If
Code1(1) = &HC
FunAddress = GetProcAddress(LoadLibrary("DSound.dll"), "DirectSoundCreate")
If FunAddress <> 0 Then
VirtualProtect ByVal FunAddress, 3, &H40, OldProtect
CopyMemory ByVal FunAddress, ByVal VarPtr(Code1(0)), 3
End If
FunAddress = GetProcAddress(LoadLibrary("winmm.dll"), "waveOutWrite")
If FunAddress <> 0 Then
VirtualProtect ByVal FunAddress, 3, &H40, OldProtect
CopyMemory ByVal FunAddress, ByVal VarPtr(Code1(0)), 3
End If
WebBrowser1.Navigate "about:blank"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询