Jump to content

Flash box


SpRaY
 Share

Recommended Posts

Im new here and as im still learning i tried to make my own gui and put flash content box there, code:

#include <GUIConstants.au3>
#include <GuiList.au3>
#include <IE.au3>
#NoTrayIcon

Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode", 4)

Global $sHTML, $oFrame

_IEErrorHandlerRegister()
$oIE = _IECreateEmbedded()

$Taskbar = WinGetPos("classname=Shell_TrayWnd")

; GUI SECTION
GUICreate("GUI", 697, 500, 193, 115)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$GUIObj = GUICtrlCreateObj($oIE, 172, 152, 521, 346)
$List1 = GUICtrlCreateList("", 2, 153, 166, 293, BitOR($LBS_SORT, $LBS_STANDARD, $WS_VSCROLL, $WS_BORDER))
$BotButton = GUICtrlCreateButton("(Play)", 18, 445, 137, 45, $BS_BITMAP)
GUICtrlSetImage($BotButton, "Graphics\button.bmp")
GUICtrlSetOnEvent(-1, "_Launch")

_Populate()
_SetupIE()

GUICtrlCreatePic("Graphics.bmp", 0, 0, 169, 151, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreatePic("Graphics\1.bmp", 168, 0, 372, 151, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreatePic("Graphics\2.bmp", 536, 0, 159, 151, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreatePic("Graphics\3.bmp", 0, 150, 169, 349, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreatePic("Graphics\4.bmp", 168, 150, 527, 349, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
; END GUI SECTION

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func _Populate()
    $aGames = IniReadSection("video.ini", "Videos")
    For $i = 1 To $aGames[0][0]
        _GUICtrlListAddItem($List1, $aGames[$i][0])
    Next
EndFunc   ;==>_Populate

Func _SetupIE()
    _IENavigate($oIE, "about:blank")
    $sHTML = ""
    $sHTML &= '<html>' & @CRLF
    $sHTML &= '<body bgcolor="#2b2e39">' & @CRLF
    $sHTML &= '<table border="0" width="100%" height="100%" id="table1">' & @CRLF
    $sHTML &= '<tr>' & @CRLF
    $sHTML &= '<td align="center">' & @CRLF
    $sHTML &= '<p align="center"><iframe name="I1" src="about:blank" scrolling="no" border="0" frameborder="0" height="306" width="475">' & @CRLF
    $sHTML &= '</iframe></td></p>' & @CRLF
    $sHTML &= '</tr>' & @CRLF
    $sHTML &= '</table>' & @CRLF
    $sHTML &= '</body>' & @CRLF
    $sHTML &= '</html>' & @CRLF
    _IEDocWriteHTML($oIE, $sHTML)
    _IEAction($oIE, "refresh")
    $oFrame = _IEGetObjByName($oIE, "I1")
EndFunc   ;==>_SetupIE

Func _Launch()
    $i_Name = _GUICtrlListSelectedIndex($List1)
    If $i_Name = $LB_ERR Then
        MsgBox(48, "Error", "You must first select a video.")
        Return 0
    EndIf
    $s_Name = _GUICtrlListGetText($List1, $i_Name)
    $s_Info = IniRead("video.ini", "Videos", $s_Name, "")
    If $s_Info = "" Then
        MsgBox(48, "Error", "Selected video not found.")
        Return 0
    EndIf
    
    _SetupIE()
    
    $aInfo = StringSplit($s_Info, ",")
    $oFrame.width = $aInfo[2]
    $oFrame.height = $aInfo[3]
    $oFrame.navigate ($aInfo[1])
EndFunc   ;==>_Launch

Func _Exit()
    Exit
EndFunc   ;==>_Exit

And the video.ini file:

[VIDEOS]
test=asd.swf,475,306

the problem is that when i click play, there is just white screen.. can someone change the code so i can understand why it happens ? Thx.

Link to comment
Share on other sites

hi

you forgot to update the internal frame with the file to play?

your original code gave me a display "blankasd.swf"

the following code works here, now you need a way to set the parameter in the Iframe to the src file you wish to play

nobbe

CODE
Func _SetupIE()

_IENavigate($oIE, "about:blank")

$sHTML = ""

$sHTML &= '<html>' & @CRLF

$sHTML &= '<body bgcolor="#2b2e39">' & @CRLF

$sHTML &= '<table border="0" width="100%" height="100%" id="table1">' & @CRLF

$sHTML &= '<tr>' & @CRLF

$sHTML &= '<td align="center">' & @CRLF

; $sHTML &= '<p align="center"><iframe name="I1" src="about:blank" scrolling="no" border="0" frameborder="0" height="306" width="475">' & @CRLF

$sHTML &= '<p align="center"><iframe name="I1" src="h:\autoit\asd.swf" scrolling="no" border="0" frameborder="0" height="306" width="475">' & @CRLF

$sHTML &= '</iframe></td></p>' & @CRLF

$sHTML &= '</tr>' & @CRLF

$sHTML &= '</table>' & @CRLF

$sHTML &= '</body>' & @CRLF

$sHTML &= '</html>' & @CRLF

_IEDocWriteHTML($oIE, $sHTML)

_IEAction($oIE, "refresh")

$oFrame = _IEGetObjByName($oIE, "I1")

EndFunc ;==>_SetupIE

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...