Conversion Progress GUIBytescout SWF To Video SDK

Conversion Progress GUI for Bytescout SWF To Video SDK

Program.cs:

C#
// x64 IMPORTANT NOTE: set CPU to x86 to build in x86 mode. WHY? Because flash is not supported on x64 platform currently at all
using System;
using System.Windows.Forms;

namespace ConversionProgressGUI
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

Form1.cs:

C#
using System;
using System.Windows.Forms;

using BytescoutSWFToVideo;

namespace ConversionProgressGUI
{
    public partial class Form1 : Form
    {
        public const int WM_APP = 0x8000;
        public const int WM_CONVERSION_PROGRESS = WM_APP + 1; 

        SWFToVideoClass swf = new SWFToVideoClass();

        public Form1()
        {
            InitializeComponent();
        }

        private void buttonConvert_Click(object sender, EventArgs e)
        {
            if (!swf.IsRunning)
            {
                swf.SWFConversionMode = SWFConversionModeType.SWFAnimation;
                swf.ConversionTimeOut = 5000;

                swf.InputSWFFileName = "test.swf";
                swf.OutputVideoFileName = "test.wmv";

                swf.SetProgressNotifyWindow(Handle.ToInt32(), WM_CONVERSION_PROGRESS, 0);

                swf.Run();
            }
        }

        protected override void WndProc(ref Message m)
        {
            if (m.HWnd == Handle && m.Msg == WM_CONVERSION_PROGRESS)
            {
                progressBar1.Value = m.WParam.ToInt32();
            }

            base.WndProc(ref m);
        } 
    }
}