PDA

Показать полную графическую версию : [решено] Проигравание gif в форме


Vagac
17-03-2010, 19:31
Подскажите как заставить gif проигрыватся в форме на буржуйском сайте нашел вот такой код
------------------------------------------------------------------------------------------------------------------------------
Opt("MustDeclareVars", 1)
#include <IE.au3>

_Main()

Func _Main()
Local $pheight = 50, $pwidth = 50, $oIE, $GUIActiveX, $gif
;$gif = FileOpenDialog("Select Animated Gif", @ScriptDir, "gif files (*.gif)", 3)
$gif="C:\Documents and Settings\Sysadmin\Рабочий стол\36_9_300.GIF"

If @error Then Exit
_GetGifPixWidth_Height($gif, $pwidth, $pheight)
$oIE = ObjCreate("Shell.Explorer.2")
GUICreate("Embedded Web control Test", 640, 580)
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, $pwidth, $pheight)
$oIE.navigate ("about:blank")
While _IEPropertyGet($oIE, "busy")
Sleep(100)
WEnd
$oIE.document.body.background = $gif
$oIE.document.body.scroll = "no"
GUISetState()
While GUIGetMsg() <> -3
WEnd
EndFunc ;==>_Main

Func _GetGifPixWidth_Height($s_gif, ByRef $pwidth, ByRef $pheight)
If FileGetSize($s_gif) > 9 Then
Local $sizes = FileRead($s_gif, 10)
ConsoleWrite("Gif version: " & StringMid($sizes, 1, 6) & @LF)
$pwidth = Asc(StringMid($sizes, 8, 1)) * 256 + Asc(StringMid($sizes, 7, 1))
$pheight = Asc(StringMid($sizes, 10, 1)) * 256 + Asc(StringMid($sizes, 9, 1))
ConsoleWrite($pwidth & " x " & $pheight & @LF)
EndIf
EndFunc
----------------------------------------------------------------------------------------------------------------------------
gif проигрывается а как мне сделать в своей форме не понимаю знаний не хватает

Creat0R
17-03-2010, 23:08
нашел вот такой код »
Ужас :cool: Вы не ту утилиту использовали для разукраски AutoIt-кода :), нужно Au3ToPost (http://creator-lab.ucoz.ru/load/3-1-0-18).

как мне сделать в своей форме »
В чём конкретно сложность?

Vagac
18-03-2010, 00:04
Сложность в непонимании даных функций на форме созданной в "кода" планирую разместить несколько гиф как заставить их работать
А за Au3ToPost спасибо сам бы не нашел обязательно исправлюсь.

Creat0R
18-03-2010, 00:44
Сложность в непонимании даных функций на форме созданной в "кода" »
Вот функция _GUICtrlCreateGif и пример её использования:

#include <IE.au3>

GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("Embedded Web control Test", 640, 580)

_GUICtrlCreateGif(@SystemDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@SystemDir) & "\oobe\html\mouse\images\clicking.gif", 5, 5)
_GUICtrlCreateGif(@WindowsDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@WindowsDir) & "\pchealth\helpctr\System\images\progbar.gif", 450, 5)
_GUICtrlCreateGif(@SystemDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@SystemDir) & "\oobe\images\dialup.gif", 5, 300)

GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)()

While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)() <> -3
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)

Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _GUICtrlCreateGif($sGifFile, $iLeft, $iTop, $iWidth=-1, $iHeight=-1)
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $iSizes, $oIE, $nGUIActiveX

If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) ($iWidth = -1 Or (http://www.autoitscript.com/autoit3/docs/keywords.htm#Or) $iHeight = -1) And (http://www.autoitscript.com/autoit3/docs/keywords.htm#And) FileGetSize (http://www.autoitscript.com/autoit3/docs/functions/FileGetSize.htm)($sGifFile) > 9 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$iSizes = FileRead (http://www.autoitscript.com/autoit3/docs/functions/FileRead.htm)($sGifFile, 10)

If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iWidth = -1 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $iWidth = Asc (http://www.autoitscript.com/autoit3/docs/functions/Asc.htm)(StringMid (http://www.autoitscript.com/autoit3/docs/functions/StringMid.htm)($iSizes, 8, 1)) * 256 + Asc (http://www.autoitscript.com/autoit3/docs/functions/Asc.htm)(StringMid (http://www.autoitscript.com/autoit3/docs/functions/StringMid.htm)($iSizes, 7, 1))
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iHeight = -1 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $iHeight = Asc (http://www.autoitscript.com/autoit3/docs/functions/Asc.htm)(StringMid (http://www.autoitscript.com/autoit3/docs/functions/StringMid.htm)($iSizes, 10, 1)) * 256 + Asc (http://www.autoitscript.com/autoit3/docs/functions/Asc.htm)(StringMid (http://www.autoitscript.com/autoit3/docs/functions/StringMid.htm)($iSizes, 9, 1))
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)

$oIE = ObjCreate (http://www.autoitscript.com/autoit3/docs/functions/ObjCreate.htm)("Shell.Explorer.2")
$nGUIActiveX = GUICtrlCreateObj (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateObj.htm)($oIE, $iLeft, $iTop, $iWidth, $iHeight)
$oIE.Navigate("about:blank")

While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) $oIE.Busy
Sleep (http://www.autoitscript.com/autoit3/docs/functions/Sleep.htm)(1)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)

$oIE.Document.Body.Background = $sGifFile
$oIE.Document.Body.Scroll = "No"

Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $nGUIActiveX
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)

Vagac
18-03-2010, 00:53
Creat0R Больщое спасибо за быстрые ответы и помощь буду разбиратся

Yashied
18-03-2010, 02:11
Есть еще неплохая UDF (http://www.autoitscript.com/forum/index.php?showtopic=96132), правда более сложная.

Vagac
18-03-2010, 17:59
Всем САПИБО разобрался




© OSzone.net 2001-2012