Embedding Flash Player ActiveX into an Application
Since Adobe officially ended support for Flash Player in December 2020, using the Flash Player ActiveX control inside applications has become even more challenging and requires special solutions to ensure compatibility and security.
When embedding Adobe Flash Player ActiveX in an application, developers typically face several issues:
- The application depends on the presence of swflash.ocx or flash.ocx on the target system.
- Compatibility must be maintained with the specific installed version of Flash Player ActiveX, despite the lack of updates after EOL.
- There is no straightforward way to protect Flash movies from being misused or extracted.
F-IN-BOX addresses these issues by providing a reliable and secure way to continue using Flash Player ActiveX inside .NET applications, even after Flash EOL.
By default, the component uses the swflash.ocx or flash.ocx installed on the system. However, you can supply your own version of the control from any supported source. For example, you can embed flash.ocx into your application's resource section and load it at runtime.
Since Adobe's end-of-life announcement for Flash, the presence of these OCX files on modern systems has become uncommon, as it is officially recommended to remove them.
With this approach, your application will run even if the Flash Player ActiveX is not installed on the target system. F-IN-BOX simplifies deployment and removes installation headaches.
Below is an example of loading flash.ocx code from a resource.
C# Example
private f_in_box__lib.f_in_box__control f_in_box__control1;
private void MainForm_Load(object sender, System.EventArgs e)
{
// Load flash.ocx from resource
System.IO.Stream StreamWithFlashOCXCode =
System.Reflection.Assembly.GetExecutingAssembly().
GetManifestResourceStream("Sample3_StandalonePlayer.flash_ocx.flash.ocx");
if (StreamWithFlashOCXCode == null)
{
System.Windows.Forms.MessageBox.Show("Resource 'Flash.ocx' not found");
return;
}
f_in_box__lib.AxCode code = new f_in_box__lib.AxCode(StreamWithFlashOCXCode);
f_in_box__control1 = new f_in_box__lib.f_in_box__control(code);
Controls.Add(f_in_box__control1);
}
VB.NET Example
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
' Load flash.ocx from resource
Dim StreamWithFlashOCXCode As System.IO.Stream = _
Me.GetType().Assembly. _
GetManifestResourceStream("Sample3_StandalonePlayer.flash.ocx")
If StreamWithFlashOCXCode Is Nothing Then
MsgBox("Resource 'Flash.ocx' not found")
End If
Dim code As New f_in_box__lib.AxCode(StreamWithFlashOCXCode)
f_in_box__control1 = New f_in_box__lib.f_in_box__control(code)
End Sub
Notes
f_in_box__lib.AxCode
is used to load the ActiveX control from a stream containing the Flash OCX binary.- Embedding the control this way removes the dependency on having Flash ActiveX installed globally.
- Ensure that the Flash OCX binary is included as an embedded resource in your project.