Inserting a swf file in a windows application

This is a discussion on Inserting a swf file in a windows application within the Windows Programming forums, part of the Platform Specific Boards category; Is it possible to insert a swf file in a windows application? If so, how is it done?...

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    Thumbs up Inserting a swf file in a windows application

    Is it possible to insert a swf file in a windows application? If so, how is it done?

  2. #2
    Caffienated jinx's Avatar
    Join Date
    Oct 2001
    Posts
    235
    You need to be more specific. Are you using MFC or Api? Do you want the file hidden only viewable through disasembly or where it can be viewed?
    Weeel, itss aboot tieme wee goo back too Canada, eeehy boyss.

  3. #3
    Unregistered
    Guest

    I would also like to know

    I would also like to know how to make a window show a swf file.
    I use API.
    Josh

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Macromedia do offer a flash SDK to download.........dont know what you can do with it though....just noticed it once on thier site

  5. #5
    Caffienated jinx's Avatar
    Join Date
    Oct 2001
    Posts
    235

    Unregistered

    Ok, I am not that framiliar with swf or Api for that matter,
    Chris P.
    Last edited by jinx; 01-01-2002 at 06:31 PM.

  6. #6
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    I think that's his name

  7. #7
    Caffienated jinx's Avatar
    Join Date
    Oct 2001
    Posts
    235
    I think Chris Pocock is his name (if not oh well!). Mine is Josh, How'd he find out anyway, I'm not listed and I don't know him.
    Weeel, itss aboot tieme wee goo back too Canada, eeehy boyss.

  8. #8
    UNBANNED OneStiffRod's Avatar
    Join Date
    Jan 2002
    Posts
    669
    YES! It is possible to insert a Flash Movie into a windows program and have control over it. You probably need to look up some info on the Macromedia site to see if you can find a Flash Object that can have more control over the movie than this particular object allows. It seems to me that all this Object is doing is using the invokeHelper() fxn with a main arg of a hex value that seems to allow access to Flash Functions. The key to inserting a Flash object into a dialog box is in the RC file. I've included the RC file and the final executable.

    Here's the source to the Flash Object:

    <<HEADER FILE>>
    #if !defined(AFX_SHOCKWAVEFLASH_H__9387F420_A99A_11D1_ 849A_00A0C9089C5A__INCLUDED_)
    #define AFX_SHOCKWAVEFLASH_H__9387F420_A99A_11D1_849A_00A0 C9089C5A__INCLUDED_

    #if _MSC_VER >= 1000
    #pragma once
    #endif // _MSC_VER >= 1000
    // Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++

    // NOTE: Do not modify the contents of this file. If this class is regenerated by
    // Microsoft Visual C++, your modifications will be overwritten.

    /////////////////////////////////////////////////////////////////////////////
    // CShockwaveFlash wrapper class

    class CShockwaveFlash : public CWnd
    {
    protected:
    DECLARE_DYNCREATE(CShockwaveFlash)
    public:
    CLSID const& GetClsid()
    {
    static CLSID const clsid
    = { 0xd27cdb6e, 0xae6d, 0x11cf, { 0x96, 0xb8, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
    return clsid;
    }
    virtual BOOL Create(LPCTSTR lpszClassName,
    LPCTSTR lpszWindowName, DWORD dwStyle,
    const RECT& rect,
    CWnd* pParentWnd, UINT nID,
    CCreateContext* pContext = NULL)
    { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }

    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
    const RECT& rect, CWnd* pParentWnd, UINT nID,
    CFile* pPersist = NULL, BOOL bStorage = FALSE,
    BSTR bstrLicKey = NULL)
    { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
    pPersist, bStorage, bstrLicKey); }

    // Attributes
    public:

    // Operations
    public:
    long GetReadyState();
    long GetTotalFrames();
    BOOL GetPlaying();
    void SetPlaying(BOOL bNewValue);
    long GetQuality();
    void SetQuality(long nNewValue);
    long GetScaleMode();
    void SetScaleMode(long nNewValue);
    long GetAlignMode();
    void SetAlignMode(long nNewValue);
    long GetBackgroundColor();
    void SetBackgroundColor(long nNewValue);
    BOOL GetLoop();
    void SetLoop(BOOL bNewValue);
    CString GetMovie();
    void SetMovie(LPCTSTR lpszNewValue);
    long GetFrameNum();
    void SetFrameNum(long nNewValue);
    void SetZoomRect(long left, long top, long right, long bottom);
    void Zoom(long factor);
    void Pan(long x, long y, long mode);
    void Play();
    void Stop();
    void Back();
    void Forward();
    void Rewind();
    void StopPlay();
    void GotoFrame(long FrameNum);
    long CurrentFrame();
    BOOL IsPlaying();
    long PercentLoaded();
    BOOL FrameLoaded(long FrameNum);
    long FlashVersion();
    CString GetWMode();
    void SetWMode(LPCTSTR lpszNewValue);
    CString GetSAlign();
    void SetSAlign(LPCTSTR lpszNewValue);
    BOOL GetMenu();
    void SetMenu(BOOL bNewValue);
    CString GetBase();
    void SetBase(LPCTSTR lpszNewValue);
    CString GetScale();
    void SetScale(LPCTSTR lpszNewValue);
    BOOL GetDeviceFont();
    void SetDeviceFont(BOOL bNewValue);
    BOOL GetEmbedMovie();
    void SetEmbedMovie(BOOL bNewValue);
    CString GetBGColor();
    void SetBGColor(LPCTSTR lpszNewValue);
    CString GetQuality2();
    void SetQuality2(LPCTSTR lpszNewValue);
    };

    //{{AFX_INSERT_LOCATION}}
    // Microsoft Developer Studio will insert additional declarations immediately before the previous line.

    #endif // !defined(AFX_SHOCKWAVEFLASH_H__9387F420_A99A_11D1_ 849A_00A0C9089C5A__INCLUDED_)


    <<CPP File for Flash Object>>
    // Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++

    // NOTE: Do not modify the contents of this file. If this class is regenerated by
    // Microsoft Visual C++, your modifications will be overwritten.


    #include "stdafx.h"
    #include "shockwaveflash.h"

    /////////////////////////////////////////////////////////////////////////////
    // CShockwaveFlash

    IMPLEMENT_DYNCREATE(CShockwaveFlash, CWnd)

    /////////////////////////////////////////////////////////////////////////////
    // CShockwaveFlash properties

    /////////////////////////////////////////////////////////////////////////////
    // CShockwaveFlash operations

    long CShockwaveFlash::GetReadyState()
    {
    long result;
    InvokeHelper(DISPID_READYSTATE, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
    return result;
    }

    long CShockwaveFlash::GetTotalFrames()
    {
    long result;
    InvokeHelper(0x7c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
    return result;
    }

    BOOL CShockwaveFlash::GetPlaying()
    {
    BOOL result;
    InvokeHelper(0x7d, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetPlaying(BOOL bNewValue)
    {
    static BYTE parms[] =
    VTS_BOOL;
    InvokeHelper(0x7d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    bNewValue);
    }

    long CShockwaveFlash::GetQuality()
    {
    long result;
    InvokeHelper(0x69, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetQuality(long nNewValue)
    {
    static BYTE parms[] =
    VTS_I4;
    InvokeHelper(0x69, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    nNewValue);
    }

    long CShockwaveFlash::GetScaleMode()
    {
    long result;
    InvokeHelper(0x78, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetScaleMode(long nNewValue)
    {
    static BYTE parms[] =
    VTS_I4;
    InvokeHelper(0x78, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    nNewValue);
    }

    long CShockwaveFlash::GetAlignMode()
    {
    long result;
    InvokeHelper(0x79, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetAlignMode(long nNewValue)
    {
    static BYTE parms[] =
    VTS_I4;
    InvokeHelper(0x79, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    nNewValue);
    }

    long CShockwaveFlash::GetBackgroundColor()
    {
    long result;
    InvokeHelper(0x7b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetBackgroundColor(long nNewValue)
    {
    static BYTE parms[] =
    VTS_I4;
    InvokeHelper(0x7b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    nNewValue);
    }

    BOOL CShockwaveFlash::GetLoop()
    {
    BOOL result;
    InvokeHelper(0x6a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetLoop(BOOL bNewValue)
    {
    static BYTE parms[] =
    VTS_BOOL;
    InvokeHelper(0x6a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    bNewValue);
    }

    CString CShockwaveFlash::GetMovie()
    {
    CString result;
    InvokeHelper(0x66, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetMovie(LPCTSTR lpszNewValue)
    {
    static BYTE parms[] =
    VTS_BSTR;
    InvokeHelper(0x66, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    lpszNewValue);
    }

    long CShockwaveFlash::GetFrameNum()
    {
    long result;
    InvokeHelper(0x6b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetFrameNum(long nNewValue)
    {
    static BYTE parms[] =
    VTS_I4;
    InvokeHelper(0x6b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    nNewValue);
    }

    void CShockwaveFlash::SetZoomRect(long left, long top, long right, long bottom)
    {
    static BYTE parms[] =
    VTS_I4 VTS_I4 VTS_I4 VTS_I4;
    InvokeHelper(0x6d, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
    left, top, right, bottom);
    }

    void CShockwaveFlash::Zoom(long factor)
    {
    static BYTE parms[] =
    VTS_I4;
    InvokeHelper(0x76, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
    factor);
    }

    void CShockwaveFlash::Pan(long x, long y, long mode)
    {
    static BYTE parms[] =
    VTS_I4 VTS_I4 VTS_I4;
    InvokeHelper(0x77, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
    x, y, mode);
    }

    void CShockwaveFlash::Play()
    {
    InvokeHelper(0x70, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
    }

    void CShockwaveFlash::Stop()
    {
    InvokeHelper(0x71, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
    }

    void CShockwaveFlash::Back()
    {
    InvokeHelper(0x72, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
    }

    void CShockwaveFlash::Forward()
    {
    InvokeHelper(0x73, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
    }

    void CShockwaveFlash::Rewind()
    {
    InvokeHelper(0x74, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
    }

    void CShockwaveFlash::StopPlay()
    {
    InvokeHelper(0x7e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
    }

    void CShockwaveFlash::GotoFrame(long FrameNum)
    {
    static BYTE parms[] =
    VTS_I4;
    InvokeHelper(0x7f, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
    FrameNum);
    }

    long CShockwaveFlash::CurrentFrame()
    {
    long result;
    InvokeHelper(0x80, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
    return result;
    }

    BOOL CShockwaveFlash::IsPlaying()
    {
    BOOL result;
    InvokeHelper(0x81, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
    return result;
    }

    long CShockwaveFlash::PercentLoaded()
    {
    long result;
    InvokeHelper(0x82, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
    return result;
    }

    BOOL CShockwaveFlash::FrameLoaded(long FrameNum)
    {
    BOOL result;
    static BYTE parms[] =
    VTS_I4;
    InvokeHelper(0x83, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
    FrameNum);
    return result;
    }

    long CShockwaveFlash::FlashVersion()
    {
    long result;
    InvokeHelper(0x84, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
    return result;
    }

    CString CShockwaveFlash::GetWMode()
    {
    CString result;
    InvokeHelper(0x85, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetWMode(LPCTSTR lpszNewValue)
    {
    static BYTE parms[] =
    VTS_BSTR;
    InvokeHelper(0x85, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    lpszNewValue);
    }

    CString CShockwaveFlash::GetSAlign()
    {
    CString result;
    InvokeHelper(0x86, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetSAlign(LPCTSTR lpszNewValue)
    {
    static BYTE parms[] =
    VTS_BSTR;
    InvokeHelper(0x86, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    lpszNewValue);
    }

    BOOL CShockwaveFlash::GetMenu()
    {
    BOOL result;
    InvokeHelper(0x87, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetMenu(BOOL bNewValue)
    {
    static BYTE parms[] =
    VTS_BOOL;
    InvokeHelper(0x87, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    bNewValue);
    }

    CString CShockwaveFlash::GetBase()
    {
    CString result;
    InvokeHelper(0x88, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetBase(LPCTSTR lpszNewValue)
    {
    static BYTE parms[] =
    VTS_BSTR;
    InvokeHelper(0x88, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    lpszNewValue);
    }

    CString CShockwaveFlash::GetScale()
    {
    CString result;
    InvokeHelper(0x89, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetScale(LPCTSTR lpszNewValue)
    {
    static BYTE parms[] =
    VTS_BSTR;
    InvokeHelper(0x89, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    lpszNewValue);
    }

    BOOL CShockwaveFlash::GetDeviceFont()
    {
    BOOL result;
    InvokeHelper(0x8a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetDeviceFont(BOOL bNewValue)
    {
    static BYTE parms[] =
    VTS_BOOL;
    InvokeHelper(0x8a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    bNewValue);
    }

    BOOL CShockwaveFlash::GetEmbedMovie()
    {
    BOOL result;
    InvokeHelper(0x8b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetEmbedMovie(BOOL bNewValue)
    {
    static BYTE parms[] =
    VTS_BOOL;
    InvokeHelper(0x8b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    bNewValue);
    }

    CString CShockwaveFlash::GetBGColor()
    {
    CString result;
    InvokeHelper(0x8c, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetBGColor(LPCTSTR lpszNewValue)
    {
    static BYTE parms[] =
    VTS_BSTR;
    InvokeHelper(0x8c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    lpszNewValue);
    }

    CString CShockwaveFlash::GetQuality2()
    {
    CString result;
    InvokeHelper(0x8d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
    return result;
    }

    void CShockwaveFlash::SetQuality2(LPCTSTR lpszNewValue)
    {
    static BYTE parms[] =
    VTS_BSTR;
    InvokeHelper(0x8d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
    lpszNewValue);
    }

    I reinserted the actual code becuase I can't seem to upload the zip file even though it is well under the 102kb limit.
    Attached Files Attached Files
    My Avatar says: "Stay in School"

    Rocco is the Boy!
    "SHUT YOUR LIPS..."

  9. #9
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    That looks like its in MFC...do you (or anybody for that matter) know how to do it with the api? And also, is there any way to prevent the user from being able to bring up the menu when he/she has right-clicked the flash movie? (I couldn't see a message that responded to it).

    Thanks

  10. #10
    Registered User
    Join Date
    May 2007
    Posts
    4

    Question

    I've tried to get this code running in VS2008, but get the error that 'CWND : base class undefined'. i don't normally use MFC so I'm at a bit of a loss...could any point me in the right direction please ?

  11. #11
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Thread necrophilia is gross. Create a new thread and link to this one.

  12. #12
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    Quote Originally Posted by cash4questions View Post
    I've tried to get this code running in VS2008, but get the error that 'CWND : base class undefined'. i don't normally use MFC so I'm at a bit of a loss...could any point me in the right direction please ?
    This code has no sense at all
    You don't need MFC to insert SWF
    (<10 lines of code to insert any OCX in a basic C/ Win32 app)

  13. #13
    Registered User
    Join Date
    May 2009
    Posts
    3
    Use f-in-box @ F-IN-BOX :: DLL Edition :: Features

    Even Google uses it in Google Lively project!


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  2. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  3. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 06:05 PM
  4. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 02:58 PM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21