Jump to content
Sign in to follow this  
VixinG

[SOLVED] IE embedded window flashes and loses attributes

Recommended Posts

VixinG

Hey, I completed my 1st application (hurray!).

Everything works, but the embedded window is flashing, whenever I delete or create new gui control.

Here - this is my aplication, and the embedded IE is on the right:

Posted Image

and when I'm changing stations sometimes this happens:

Posted Image

- The embedded IE object loses the background and graphics (sometimes only background), and refreshing does not help, but when I change it's alignment from TopMost to standard, and the application will hide beneath other windows, and then again I will set it on top = everything is visible...

Can I do something with that?

Source:

;------------------------------------------------------------;
;  Rainwave Player ver 1.1
;------------------------------------------------------------;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <IE.au3>
#include 'Icons.au3'
#include <Inet.au3>
#include 'WinSnap.au3'
#include <StaticConstants.au3>
#include "Marquee.au3"
#include <Timers.au3>
;------------------------------------------------------------;
; Hotkeys
;------------------------------------------------------------;
$hotkey1 = IniRead('keys.ini', 'Hotkeys', 'Omniwave', '{F1}')
$hotkey2 = IniRead('keys.ini', 'Hotkeys', 'Rainwave', '{F2}')
$hotkey3 = IniRead('keys.ini', 'Hotkeys', 'Chiptune', '{F3}')
$hotkey4 = IniRead('keys.ini', 'Hotkeys', 'Covers', '{F4}')
$hotkey5 = IniRead('keys.ini', 'Hotkeys', 'OCRradio', '{F5}')
$topmost = IniRead('keys.ini', 'Hotkeys', 'SetOnTop', '{F6}')
HotKeySet($hotkey1, "omniwave")
HotKeySet($hotkey2, "rainwave")
HotKeySet($hotkey3, "bitwave")
HotKeySet($hotkey4, "mixwave")
HotKeySet($hotkey5, "ocr_radio")
HotKeySet($topmost, "TopMost")
HotKeySet("{ESC}", "Quit")
;------------------------------------------------------------;
; Declaring, registering, etc.
;------------------------------------------------------------;
Global $SetOnTop = True
Global $title = 'Click desired station... and enjoy the music!'
Dim $nr[5] = [5, 1, 4, 3, 2]
$GUI = GUICreate('Rainwave Player', 580, 37, 0, 0, $WS_POPUP)
$oIE = _IECreateEmbedded()
Dim $png1[5] = ['.\art\aa.png', '.\art\bb.png', '.\art\cc.png', '.\art\dd.png', '.\art\ee.png']
Dim $png3[5] = ['.\art\aa.png', '.\art\bb.png', '.\art\cc.png', '.\art\dd.png', '.\art\ee.png']
Dim $png2[5] = ['.\art\aa2.png', '.\art\bb2.png', '.\art\cc2.png', '.\art\dd2.png', '.\art\ee2.png']
Global $dragLabel = GUICtrlCreateLabel('', 1, 1, 110, 33, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor($dragLabel, 0x000000)
_GUICtrlMarquee_SetScroll('', 'alternate', 'right', 1, 75)
_GUICtrlMarquee_SetDisplay(0, 0xf0ac20, 'black', 8, 'MS Reference Sans Serif')
Dim $pics[5] = [GUICtrlCreatePic('', 110, 1, 0, 0), GUICtrlCreatePic('', 154, 1, 0, 0), GUICtrlCreatePic('', 214, 1, 0, 0), GUICtrlCreatePic('', 310, 1, 0, 0), GUICtrlCreatePic('', 390, 1, 0, 0)]
Dim $urls[5] = ['http://www.rainwave.tk/player/omniwave.htm', 'http://www.rainwave.tk/player/rainwave.htm', 'http://www.rainwave.tk/player/bitwave.htm', 'http://www.rainwave.tk/player/mixwave.htm', 'http://www.rainwave.tk/player/ocremix.htm']
Local $disable
Global $00png = '.\art\00.png'
Global $00obj = GUICtrlCreatePic('', 1, 1, 0, 0)
_SetImage($00obj, $00png)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetBkColor(0x808080, $GUI)
_WinSnap_Set($GUI)
WinSetOnTop($GUI, "", 1)
;------------------------------------------------------------;
; Script
;------------------------------------------------------------;
Local $lastCursor
Refresh()
Dim $labels[5] = [GUICtrlCreateLabel('', 110, 1, 44, 23), GUICtrlCreateLabel('', 154, 1, 60, 23), GUICtrlCreateLabel('', 214, 1, 96, 23), GUICtrlCreateLabel('', 309, 1, 81, 23), GUICtrlCreateLabel('', 390, 1, 89, 23)]
For $i = 0 To 4 Step 1
GUICtrlSetBkColor($labels[$i], $GUI_BKCOLOR_TRANSPARENT)
Next
Local $highlighted = False
GUISetState(@SW_SHOW)
$marquee = _GUICtrlMarquee_Create($title, 110, 24, 369, 12, "")
$eIE = GUICtrlCreateObj($oIE, 480, -10, 150, 50)
_IENavigate($oIE, 'http://rainwave.tk/player/main.htm', 1)
While 1
$msg = GUIGetMsg()
If $msg >= 10 And $msg <= 14 Then
  AdlibRegister("GetName", 10000)
  ExitLoop
EndIf
WEnd
While 1
$msg = GUIGetMsg()
$cursor = GUIGetCursorInfo($GUI)
If $cursor[4] >= 10 And $cursor[4] <= 14 Then
  $x = $cursor[4] - 10
  If $cursor[4] = $labels[$x] And $highlighted = False Then
   _SetImage($pics[$x], $png2[$x])
   $highlighted = True
   $oldx = $x
   $old = $cursor[4]
  EndIf
  If $highlighted = True And $cursor[4] <> $old Then
   _SetImage($pics[$oldx], $png1[$oldx])
   $highlighted = False
  EndIf
  If $msg >= 10 And $msg <= 14 Then
   $png1 = $png3
   $a = $msg - 10
   GUICtrlDelete($eIE)
   $eIE = GUICtrlCreateObj($oIE, 480, -10, 150, 50)
   _IENavigate($oIE, $urls[$a], 0)
   _SetImage($pics[$x], $png2[$x])
   $png1[$x] = $png2[$x]
   $x2 = $x
   $msg2 = $msg
   Refresh()
   GetName()
  EndIf
  If $msg >= 10 And $msg <= 14 And $msg <> $msg2 Then
   $png1 = $png3
   GUICtrlDelete($eIE)
   $eIE = GUICtrlCreateObj($oIE, 480, -10, 150, 50)
   _IENavigate($oIE, $urls[$a])
   $png1[$x] = $png3[$x]
   _SetImage($pics[$x2], $png1[$x2])
   _SetImage($pics[$x], $png2[$x])
   $png1[$x] = $png2[$x]
   $x2 = $x
   $msg2 = $msg
   Refresh()
   GetName()
  EndIf
EndIf
If $cursor[4] = 0 And $highlighted = True Then
  Refresh()
EndIf
WEnd
Exit
;------------------------------------------------------------;
; Functions
;------------------------------------------------------------;
Func Refresh()
For $i = 0 To 4 Step 1
  _SetImage($pics[$i], $png1[$i])
  GUICtrlSetState($pics[$i], $GUI_DISABLE)
  $highlighted = False
Next
EndFunc   ;==>Refresh
Func TopMost()
If $SetOnTop = True Then
  WinSetOnTop($GUI, "", 0)
  $SetOnTop = False
Else
  WinSetOnTop($GUI, "", 1)
  $SetOnTop = True
EndIf
EndFunc   ;==>TopMost
Func omniwave()
$x = 0
$png1 = $png3
GUICtrlDelete($eIE)
$eIE = GUICtrlCreateObj($oIE, 480, -10, 150, 50)
_IENavigate($oIE, $urls[0], 0)
_SetImage($pics[0], $png2[0])
$png1[0] = $png2[0]
Refresh()
GetName()
EndFunc   ;==>omniwave
Func rainwave()
$x = 1
$png1 = $png3
GUICtrlDelete($eIE)
$eIE = GUICtrlCreateObj($oIE, 480, -10, 150, 50)
_IENavigate($oIE, $urls[1], 0)
_SetImage($pics[1], $png2[1])
$png1[1] = $png2[1]
Refresh()
GetName()
EndFunc   ;==>rainwave
Func bitwave()
$x = 2
$png1 = $png3
GUICtrlDelete($eIE)
$eIE = GUICtrlCreateObj($oIE, 480, -10, 150, 50)
_IENavigate($oIE, $urls[2], 0)
_SetImage($pics[2], $png2[2])
$png1[2] = $png2[2]
Refresh()
GetName()
EndFunc   ;==>bitwave
Func mixwave()
$x = 3
$png1 = $png3
GUICtrlDelete($eIE)
$eIE = GUICtrlCreateObj($oIE, 480, -10, 150, 50)
_IENavigate($oIE, $urls[3], 0)
_SetImage($pics[3], $png2[3])
$png1[3] = $png2[3]
Refresh()
GetName()
EndFunc   ;==>mixwave
Func ocr_radio()
$x = 4
$png1 = $png3
GUICtrlDelete($eIE)
$eIE = GUICtrlCreateObj($oIE, 480, -10, 150, 50)
_IENavigate($oIE, $urls[4], 0)
_SetImage($pics[4], $png2[4])
$png1[4] = $png2[4]
Refresh()
GetName()
EndFunc   ;==>ocr_radio
Func Quit()
Exit
EndFunc   ;==>Quit
Func GetName()
$fullsource = _INetGetSource('http://rainwave.cc/async/' & $nr[$x2] & '/get', True)
$start = StringInStr($fullsource, 'sched_current') + 300
$source = StringMid($fullsource, $start, 300)
$start = StringInStr($source, 'song_title": "') + 14
$stop = StringInStr($source, '", "artists')
$length = $stop - $start
$title = StringMid($source, $start, $length)
$start = StringInStr($fullsource, 'sched_current') + 300
$source = StringMid($fullsource, $start, 750)
$start = StringInStr($source, 'album_name": "')
$source = StringMid($source, $start)
$start = StringInStr($source, 'album_name": "') + 14
$stop = StringInStr($source, '", "')
$length = $stop - $start
$album = StringMid($source, $start, $length)
$title = $title & ' - ' & $album
$sample = _GUICtrlMarquee_Create($title, 110, 24, 369, 12, "")
GUICtrlDelete($marquee)
$marquee = _GUICtrlMarquee_Create($title, 110, 24, 369, 12, "")
GUICtrlDelete($sample)
EndFunc   ;==>GetName

Here is the application with required files (0.98 MB):

http://rainwave.tk/player/Rainwave%20Player%201.1.rar

btw Melba23: thanks for Marquee.au3!

Any ideas? ;)

I found solution :)

I embedded the shockwave flash object and problem is gone:

Func ObjectX()
GUICtrlDelete($oRP)
GUICtrlDelete($GUIActiveX)
$oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUIActiveX = GUICtrlCreateObj( $oRP, 490, 8 , 80 , 20 )
$LinkoRP = ObjEvent($oRP,"IEEvent_","Preview"); this is a dummy event handle
  With $oRP; Object tag pool
   .Movie = 'http://www.rainwave.tk/player/ffmp3-config.swf'; the wave file from inet / could be on disk
   .flashvars = 'url='&$var&'&codec=mp3&volume=75&introurl=&autoplay=true&tracking=false&jsevents=true&buffering=5&skin=ffmp3-rainwave.xml&title=OCRemix'
   .bgcolor = "#000000"; change background color to white FFFFFF
   .wmode = "Opaque"; Opaque / transparent
   .allowscriptaccess = 'always'
   .scale = 'noscale'
  EndWith
EndFunc

Thanks!

Edited by VixinG

[indent=3][/indent]

Share this post


Link to post
Share on other sites
Belini
VixinG

It looks good and could be posted in Example Scripts.

It is already posted by kjactive here:

;)


[indent=3][/indent]

Share this post


Link to post
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
Sign in to follow this  

×