I am using VS2008, OS win Vista. I need to create a C++ windows form program to add a .swf flash animation to the form. How is this done. Any sample code, or a good tutorial is appreciated.

Dani AI

Generated

A concise, up-to-date summary for (VS2008 on Vista) and anyone else looking to host a .swf inside a Windows Forms C++ app. pointed in the right direction: the usual, straightforward route in a WinForms/C++/CLI project is to host the Shockwave Flash ActiveX control on the form. That control exposes properties and methods such as Movie, LoadMovie, Play, and Stop, which makes playback simple from managed code.

Typical workflow (designer + code):

  • Ensure the Flash ActiveX is installed/registered on the development machine (Vista will usually require an elevated prompt to register).
  • In Visual Studio: Toolbox -> Choose Items -> COM Components -> select "Shockwave Flash Object" and drag it onto the form. Visual Studio will add references for AxShockwaveFlashObjects/ShockwaveFlashObjects.
  • Set the Movie property in the designer or call LoadMovie and then Play from the form code.

A minimal C++/CLI snippet after InitializeComponent():

// example (C++/CLI)
this->axShockwaveFlash1->LoadMovie(0, "C:\\path\\animation.swf");
this->axShockwaveFlash1->Play();

Notes, alternatives and gotchas:

  • Mixed/native C++ apps can host the ActiveX via ATL (CAxWindow) or embed an HTML page in a WebBrowser control that embeds the SWF.
  • Deployment requires the same ActiveX bitness as the process. Set the project platform to match the installed Flash ActiveX (x86 vs x64); mixed-mode C++/CLI assemblies must match process architecture.
  • Common errors: "Class not registered" → register the OCX with regsvr32 from an elevated prompt; missing methods → missing type-library references.
  • Important: Adobe ended Flash Player support (see Adobe Flash Player End of Life). For modern use, consider converting SWFs to video or using an emulator like Ruffle if compatibility and security are concerns.

Recommended Answers

All 2 Replies

Never done it, but it sounds tractable:

Never done it, but it sounds tractable:

thanks mate. that was helpful

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.