实现网络加载动态图

| |
[不指定 2013/12/18 18:37 | by admin ]
最简单的方法,在picturebox控件中添加gif格式图片
首先、需要注册,注册方法:在工程中选中“引用”→引用项目ActiveMovie Control type Libray→然后点击“确定”键即可。

Private pMC As FilgraphManager
Private pVW As IVideoWindow
’转载请注明出处,红防安全网 http://blog.hkfx.net QQ:3925993
Private Sub Form_Load()
Set xPost = CreateObject("Microsoft.XMLHTTP")
xPost.Open "GET", "http://www.hkfx.net/img/scan.gif", 0
xPost.Send
Set sGet = CreateObject("ADODB.Stream")
sGet.Mode = 3
sGet.Type = 1
sGet.Open
sGet.Write (xPost.responseBody)
sGet.SaveToFile App.Path & "\scan.gif", 2
'------------------------------------------------------------------------------------
Me.ScaleMode = 3
Picture1.ScaleMode = 3
'------------------------------------------------------------------------------------
On Error Resume Next
    Set pMC = New FilgraphManager
    pMC.Stop
    pMC.RenderFile ""
    pMC.RenderFile App.Path & "\scan.gif"
    Set pVW = pMC
    pVW.WindowStyle = CLng(&H6000000)
    pVW.Left = 0
    pVW.Top = 0
    pVW.Width = Picture1.ScaleWidth
    pVW.Height = Picture1.ScaleHeight
    pVW.Owner = Picture1.hWnd
    pVW.MessageDrain = Picture1.hWnd
    pMC.Run
    Kill App.Path & "/scan.gif"
End Sub
程序源码 | 评论(0) | 引用(0) | 阅读(2100)