Advertisement Jump to content
Sign in to follow this  

how to open/run flash movies from c++

This topic is 4880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am into making games and most games have cut scenes. as i am not passed the 2d stage and dont have a clue about 3d animation i was thinkin it would be easier to get a mate to make a flash movie for my game. so can you play/open flash movies from a c++ concole? if so how? i was think you will need a plugin or use opengl but i need to be pointed in the right direction. cheers

Share this post

Link to post
Share on other sites
I'm far from an expert with ActiveX or ATL or that stuff, but I got it working, and here's what I had to do (this is in VC6, might be slightly different with another compiler, but it might get you started regardless):

Had the following at the top of my .h file:
#import "C:\Windows\system32\Macromed\Flash\Flash.ocx" rename_namespace("Flash")

#include <atlbase.h>
extern CComModule _Module;
#include <atlwin.h>

#include <windows.h>

Had the following at the top of my .cpp file:
#pragma comment(lib, "atl")
CComModule _Module;

Variables I used were the following:

HWND hWndContainer;
Flash::IShockwaveFlash* pFlash;

And source code to create and do basic manipulation of the flash control:
hWndContainer = CreateWindowEx(0, "AtlAxWin", "", WS_POPUP | WS_VISIBLE, 0, 0, Width, Height, NULL, NULL, hInstance, NULL);
CLSID clsid;
HRESULT hr = CLSIDFromProgID(OLESTR("ShockwaveFlash.ShockwaveFlash.1"), &clsid);
hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, __uuidof(Flash::IShockwaveFlash), (void**)&pFlash);
AtlAxAttachControl(pFlash, hWndContainer, NULL);
pFlash->LoadMovie(0, _bstr_t("SomeFile.swf"));

Width and Height are just integers, and hInstance is the handle to the instance of the program. In a normal Windows app, this value is passed to WinMain(), but in a console app, I believe this value can be obtained through the code (HINSTANCE)GetModule(NULL).

Hopefully this gets you started and looking in the right direction at least.

Share this post

Link to post
Share on other sites
1:56 C:\\flashrunner.cpp [Warning] extra tokens at end of #import directive
1 C:\Windows\system32\Macromed\Flash\Flash.ocx stray '\144' in program
1:4 C:\Windows\system32\Macromed\Flash\Flash.ocx [Warning] null character(s) ignored

#to list a few . . .

Share this post

Link to post
Share on other sites
That's because #import isn't a standard preprocessor directive. VC6 interprets it one way, GCC another. Neither is right, neither is wrong.

Share this post

Link to post
Share on other sites
Can you not just dump Flash movies to an MPEG or AVI or something and play that? Seems a better routine.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!