vb 抓WebBrowser1里的截图
有一WebBrowser1,点击Command1显示www.163.com,点击Command2把WebBrowser1里显示的截为图片保存在C:\pic下,自动命名为pic001.bmp
请问,点击Command2把WebBrowser1里显示的截为图片保存在C:\pic下,自动命名为pic001.bmp 应该怎么写?谢谢!
[解决办法]
'文件保存在C:\Picure_
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 5000 '5秒保存一次图
End Sub
Private Sub Timer1_Timer()
prog
End Sub
'执行程序段
Private Sub prog()
Dim Path As String
Dim DirName As String
Dim JPGNnme As String
DirName = "C:\Picure_" & Format(Now, "yyyy-mm-dd") '文件夹名"picure_2008-10-05"
Path = DirName & "" & Format(Now, "hh时mm分ss秒") & ".JPG" '文件名 "1时13分02秒.JPG"
If Dir(DirName, vbDirectory) = "" Then '先判断是否有这个文件夹
MkDir (DirName) '没有就新建
End If
keybd_event vbKeySnapshot, 0&, 0&, 0&
DoEvents
Picture1.Picture = Clipboard.GetData(vbCFBitmap)
SavePicture Picture1.Picture, Path
End Sub