请问高手们怎样在WebBrowser控件调用和获得收藏夹里面,收藏的网站呢?
解决方案 »
- 很古老的问题,但是没找到答案的。。ADO连接的问题
- 请问如何解决图片移动时抖动??
- 为什么可以读取txt 文件的内容, 不可以读取doc 文件的内容, 要做到这一点应该怎样做?
- 关于CrzayHosptial源码的附加分,
- 求教:ACCESS数据库恢复?
- CHM帮助文件,刚打开时显示“该页无法显示”
- 英语6级(在考专业8级),本科(自考有学土学位),高程(在考系分),。。求职
- 请问菜单左边的一长条图片是怎么加上去的?(不是小图标,像98的开始菜单)
- 一个想不同的问题~~~~~~~~
- 罗玉胜你出来
- 关于WebBrowser1的一个问题
- webbrowser,如何禁止自动弹出窗口?在线等,即时结贴.
2 Get the folder path from registry
如果你不用dir也可以用vb的dir控件.
Private Type SHITEMID
cb As Long
abID As Byte
End TypePublic Type ITEMIDLIST
mkid As SHITEMID
End Type
Public Function SpecialFolder(ByRef CSIDL As Long) As String
'locate the favorites folder
Dim R As Long
Dim sPath As String
Dim IDL As ITEMIDLIST
Const NOERROR = 0
Const MAX_LENGTH = 260
R = SHGetSpecialFolderLocation(MDIMain.hwnd, CSIDL, IDL)
If R = NOERROR Then
sPath = Space$(MAX_LENGTH)
R = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath)
If R Then
SpecialFolder = Left$(sPath, InStr(sPath, vbNullChar) - 1)
End If
End If
End Function
Private Function M_Dom_oncontextmenu() As Boolean
M_Dom_oncontextmenu = False
End Function Private Sub Webbrowser1_DownloadComplete()
Set M_Dom = Webbrowser1.Document
End SubRem 好了,右键菜单没有了===============================================================================控件调用和获得收藏夹里面基本上用 specialfolder(6 ) 就可以得到收藏夹的路径, 然后你可以用dir去循环读入每个目录,然后dir里面的file, file的名字就是你要的收藏的名字, 路径可以自己根据从上面得到的路径去得到.
如果你不用dir也可以用vb的dir控件.
Private Type SHITEMID
cb As Long
abID As Byte
End TypePublic Type ITEMIDLIST
mkid As SHITEMID
End Type
Public Function SpecialFolder(ByRef CSIDL As Long) As String
'locate the favorites folder
Dim R As Long
Dim sPath As String
Dim IDL As ITEMIDLIST
Const NOERROR = 0
Const MAX_LENGTH = 260
R = SHGetSpecialFolderLocation(MDIMain.hwnd, CSIDL, IDL)
If R = NOERROR Then
sPath = Space$(MAX_LENGTH)
R = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath)
If R Then
SpecialFolder = Left$(sPath, InStr(sPath, vbNullChar) - 1)
End If
End If
End Function
===================================================================================================
全屏是的,webbrowser本生是一个控件, 你要它全屏,就是要它所在的窗体全屏, 可以用setwindowlong取消窗体的 title, 用Call ShowWindow(FindWindow("Shell_traywnd", ""), 0) 隐藏tray,就是下边那个包含开始那一行. 用Call ShowWindow(FindWindow("Shell_traywnd", ""), 9) 恢复. 够详细了吧.然后在form1.windowstate = 2 就可以了.==============================================================================================================
选择网页上的内容。
Private Sub Command1_Click()
'请先选中一些内容
Me.WebBrowser1.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
MsgBox Clipboard.GetText
End Sub==============================================================================================================
用IE来下载文件
Private Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long
Private Sub Command1_Click()
Dim sDownload As String
sDownload = StrConv(Text1.Text, vbUnicode)
Call DoFileDownload(sDownload)
End SubPrivate Sub Form_Load()
Text1.Text = "http://www.chat.ru/~softdaily/fo-ag162.zip"
Form1.Caption = "Audiograbber 1.62 Full"
Text2.Text = "http://www6.50megs.com/audiograbber/demos/cr-ag161.zip"
End Sub
================================================================================================================我要动态加载和删除WebBrowser控件应该怎么做?Private Sub Command1_Click()
Form1.Controls.Add "shell.explorer.2", "NewWeb", Form1
With Form1!NewWeb
.Visible = True
.Width = 10000
.Height = 10000
.Left = 0
.Top = 0
.Navigate2 "www.csdn.net"
End With
End SubPrivate Sub Command2_Click()
Controls.Remove Form1!newweb
End SubForm1.Controls.Add "shell.explorer.2", newweb(newweb.Count), Form1
With Form1!newweb(newweb.Count)
.Visible = True
.Width = 1000
.Height = 1000
.Left = newweb(newweb.Count - 1).Left + newweb(newweb.Count - 1).Width
.Top = 0
'.Navigate2 "www.csdn.net"
End With
为什么他说我
Form1.Controls.Add "shell.explorer.2", newweb(newweb.Count), Form1
这一行错误13 类型不匹配?
ps:我在form中已经有了一个newweb(0)控件先为一个WebBrowser
Dim i As Integer
Private Sub AddWeb_Click()
For i = 1 To 10
Load NewWeb(i)
NewWeb(i).Top = i * 100
NewWeb(i).Left = i * 100
NewWeb(i).Visible = True
Next i
End SubPrivate Sub DelWeb_Click()
For i = 1 To 10
Unload NewWeb(i)
Next i
End Sub=============================================================================================================
一个把页面保存为MHT(即MHTML)文件
1、谢谢楼上几位大侠!我现在将 pcwak(书剑狂生[MS MVP]) 大侠提供的资料贴出来,以供大家参考:
我终于找到一个把页面保存为MHT(即MHTML)文件的方法了!
首先,在工程中必须要引用一个库:
Library CDO
D:\WINNT\System32\cdosys.dll
Microsoft CDO for Windows 2000 Library
其次,需要Stream对应的接口的支持,如果你一时找不到就使用支持这个的较新的ADO就行了,如
Library ADODB
D:\Program Files\Common Files\system\ado\msado15.dll
Microsoft ActiveX Data Objects 2.5 Library
代码如下,十分简单(同时由于流的特点,显示在实际应用中没必要象本例中那样把文件保存到磁盘上就可直接转换为字符串或字节数组什么的处理的。另,对于Microsoft CDO for Windows 2000 Library这个库,在WIN98中要怎么使用还没试过,感兴趣的朋友可以试试并跟帖,以丰富完善其内容:)Private Sub Command1_Click()
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iMsg As New CDO.Message
Dim iConf As New CDO.Configuration
Dim objStream As ADODB.StreamWith iMsg
.CreateMHTMLBody "http://www.163.com/";, , _
"domain\username", _
"password"
Set objStream = .GetStream
Call objStream.SaveToFile("f:\test.mht", adSaveCreateOverWrite)
End With
End Sub2、
'首先加入对ADODB和CDO(Microsoft CDO for Windows 2000 Library,对应文件名为CDOSYS.dll)的引用
Private Sub Command1_Click()
Dim message As New CDO.message
Dim Outstream As ADODB.Stream
On Error GoTo myerr1
Call message.CreateMHTMLBody("http://www.csdn.net", CDO.CdoMHTMLFlags.cdoSuppressNone, "", "")
Set Outstream = message.GetStream
Call Outstream.SaveToFile("c:\test.mht", ADODB.SaveOptionsEnum.adSaveCreateOverWrite)
MsgBox "完成"
Exit Sub
myerr1:
Set message = Nothing
Set Outstream = Nothing
End Sub=================================================================================================================
请问高手们怎样在WebBrowser控件调用收藏夹和在收藏夹里添加收藏
Option ExplicitPrivate Sub Command1_Click()
Dim ObjSUH As New ShellUIHelper
ObjSUH.AddFavorite "http://www.csdn.net", "CSDN"
Set ObjSUH = Nothing
End Sub=================================================================================================================