Archive: Shockwave Flash control in UI


Shockwave Flash control in UI
Goal: I need an animated Flash banner on my installer.

By my research so far, it seems that the SWF control is a COM object, which has to be instantiated using CoCreateInstance instead of CreateControl (though I am in no way sure of that yet).

Any ideas how that should finally be achieved? I'm quite fine with making a DLL-calling plugin of some sort, or even recompiling some UI exe, if pointed towards some proper source files, if that's what it takes.


Solved, after much enlightening but unnecessary tinkering.


System::Call `atl::AtlAxWinInit() i.r0`
${If} $0 == 0
MessageBox MB_OK "Unable to initialize ActiveX at all."
GoTo badflash
${EndIf}

System::Call `kernel32::GetModuleHandle(i 0) i.R3`
System::Call 'user32::CreateWindowEx(i 0, t "AtlAxWin", t "http://somewhere.com/movie.swf", i ${WS_CHILD}|${WS_VISIBLE}, i 0, i 0, i 250, i 250, i $HWNDPARENT, i 0, i R3, i 0) i.R1'
${If} $R1 == 0
System::Call 'kernel32::GetLastError() i.R1'
MessageBox MB_OK "Flashbox init error: $R1"
${EndIf}

badflash:


Just a proof of concept, but there it is.

The above has a potential performance drawback - it essentially creates an ActiveX window, with a shell document window in it, with Internet Explorer in it, and finally with Shockwave Flash inside. So, here's another way of doing this, with less resulting window clutter:


System::Call `atl::AtlAxWinInit() i.r0`
System::Call `kernel32::GetModuleHandle(i 0) i.R3`
System::Call 'user32::CreateWindowEx(i 0, t "AtlAxWin", t "{D27CDB6E-AE6D-11cf-96B8-444553540000}", i ${WS_CHILD}|${WS_VISIBLE}, i 0, i 0, i 250, i 250, i $HWNDPARENT, i 0, i R3, i 0) i.R1'
System::Call `atl::AtlAxGetControl(i R1, *i .r1) i .r0`
StrCpy $3 "c:\\folder\\movie.swf"
System::Call "$1->22(w r3) i .r2" ; 22 = set_Movie


Still the resulting window doesn't properly respond to WM_PAINT messages, like neither does the former example. Any solution to that, perhaps, before I solve it myself? ;P