我有4个问题 关于VB ACCESS数据库 的图片 和 变量 和 PictureBox 和 二进制变量 的问题 15
在VB和ACCESS数据库环境中1.怎么把数据库的OLE对象存入二进制变量2.怎样把一张pictureBox的图片变为二进制变量?(最好不用存入磁盘)3.怎么把这个二进制...
在VB和ACCESS数据库环境中
1.怎么把数据库的OLE 对象存入二进制变量
2.怎样把一张pictureBox的图片变为二进制变量?(最好不用存入磁盘)
3.怎么把这个二进制变量赋值给PictureBox?(显示出来)
4二进制变量 怎么定义..怎么赋值?
可不可以按照上面的问题来回答..? 展开
1.怎么把数据库的OLE 对象存入二进制变量
2.怎样把一张pictureBox的图片变为二进制变量?(最好不用存入磁盘)
3.怎么把这个二进制变量赋值给PictureBox?(显示出来)
4二进制变量 怎么定义..怎么赋值?
可不可以按照上面的问题来回答..? 展开
2个回答
展开全部
分析HTML代码的 <img src部分
得到路径后 你想怎样处理都可以了
Private Declare Function OleLoadPicturePath Lib "oleaut32.dll" (ByVal szURLorPath As Long, ByVal punkCaller As Long, ByVal dwReserved As Long, ByVal clrReserved As OLE_COLOR, ByRef riid As TGUID, ByRef ppvRet As IPicture) As Long
Private Type TGUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Private Sub Form_Load()
Dim HtmlCode As String
Dim S, E, L As Long
HtmlCode = Inet1.OpenURL("")
S = InStr(HtmlCode, "<a href= target=_blank><img src=")
E = InStr(HtmlCode, " width=174 height=59")
L = E - S - Len("<a href= target=_blank><img src=")
Set Image1.Picture = LoadPicture(Mid(HtmlCode, S + Len("<a href= target=_blank><img src="), L))
End Sub
'加载函数
Public Function LoadPicture(ByVal strFileName As String) As Picture
Dim IID As TGUID
With IID
.Data1 = &H7BF80980
.Data2 = &HBF32
.Data3 = &H101A
.Data4(0) = &H8B
.Data4(1) = &HBB
.Data4(2) = &H0
.Data4(3) = &HAA
.Data4(4) = &H0
.Data4(5) = &H30
.Data4(6) = &HC
.Data4(7) = &HAB
End With
On Error GoTo LocalErr
OleLoadPicturePath StrPtr(strFileName), 0&, 0&, 0&, IID, LoadPicture
Exit Function
LocalErr:
Set LoadPicture = VB.LoadPicture(strFileName)
Err.Clear
End Function
在窗体上放
一个Image控件
一个 Microsoft Internet Transfer Control6.0
控件
希望加分
得到路径后 你想怎样处理都可以了
Private Declare Function OleLoadPicturePath Lib "oleaut32.dll" (ByVal szURLorPath As Long, ByVal punkCaller As Long, ByVal dwReserved As Long, ByVal clrReserved As OLE_COLOR, ByRef riid As TGUID, ByRef ppvRet As IPicture) As Long
Private Type TGUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Private Sub Form_Load()
Dim HtmlCode As String
Dim S, E, L As Long
HtmlCode = Inet1.OpenURL("")
S = InStr(HtmlCode, "<a href= target=_blank><img src=")
E = InStr(HtmlCode, " width=174 height=59")
L = E - S - Len("<a href= target=_blank><img src=")
Set Image1.Picture = LoadPicture(Mid(HtmlCode, S + Len("<a href= target=_blank><img src="), L))
End Sub
'加载函数
Public Function LoadPicture(ByVal strFileName As String) As Picture
Dim IID As TGUID
With IID
.Data1 = &H7BF80980
.Data2 = &HBF32
.Data3 = &H101A
.Data4(0) = &H8B
.Data4(1) = &HBB
.Data4(2) = &H0
.Data4(3) = &HAA
.Data4(4) = &H0
.Data4(5) = &H30
.Data4(6) = &HC
.Data4(7) = &HAB
End With
On Error GoTo LocalErr
OleLoadPicturePath StrPtr(strFileName), 0&, 0&, 0&, IID, LoadPicture
Exit Function
LocalErr:
Set LoadPicture = VB.LoadPicture(strFileName)
Err.Clear
End Function
在窗体上放
一个Image控件
一个 Microsoft Internet Transfer Control6.0
控件
希望加分
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询