我计划为我得应用程序添加一个启动动画,使用shock wave falsh 控件。我在vc++6.0中,新建一个SDI工程,让后添加该控件到工程中,拖到对话框中,成功的播放flash动画;可是我用相同的方法加入我原来的工程添加一个对话框,并将该控件放入,对话框总是无法创建成功。
CShockwaveFlash m_FlashPicture;
m_FlashPicture.Create(NULL,WS_CHILD|WS_VISIBLE,rc,this,IDC_SHOCKWAVEFLASH1);
是不是我的程序和shock wave falsh 控件存在冲突,怎样解决呀. 
我放入CWebBrowser2 支持播放flash的控件也无法实现,和前者相同的现象.
我实在没有办法了,求助!

解决方案 »

  1.   

    不需要手工create
    你拖放进去的控件默认已经存在了
    你再create怎么能行呢
      

  2.   

    确认App::InitInstance()有没有调用
    AfxEnableControlContainer();
      

  3.   

    谢谢,但是不手工添加Create函数,对话框照样创建不成功呀?我也不知道为什么,但可以确定是对话框创建失败导致的,还有我创建的对话框类为:CFlashPciture m_flash;
    我在主菜单里添加了一个测试项:

    void CMainFrame::OnFullScreen() 
    {
        CFlashPciture m_flash;
        m_flash.DoModal();
    }
    一下是这个对话框类的代码:
    // FlashPciture.cpp : implementation file
    //#include "stdafx.h"
    #include "simurobtest.h"
    #include "FlashPciture.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // CFlashPciture dialog
    CFlashPciture::CFlashPciture(CWnd* pParent /*=NULL*/)
    : CDialog(CFlashPciture::IDD, pParent)
    {
    //{{AFX_DATA_INIT(CFlashPciture)
    // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
    }
    void CFlashPciture::DoDataExchange(CDataExchange* pDX)
    {
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CFlashPciture)
    DDX_Control(pDX, IDC_SHOCKWAVEFLASH1, m_FlashPicture);
    //}}AFX_DATA_MAP
    }
    BEGIN_MESSAGE_MAP(CFlashPciture, CDialog)
    //{{AFX_MSG_MAP(CFlashPciture)
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
    // CFlashPciture message handlersBOOL CFlashPciture::OnInitDialog() 
    {
    CDialog::OnInitDialog();

    // TODO: Add extra initialization here
             if (CDialog::OnCreate(lpCreateStruct) == -1)
    return -1;

    // TODO: Add your specialized creation code here
    RECT rc;
    this->GetClientRect(&rc);
    m_FlashPicture.MoveWindow( &rc, true );
    TCHAR strCurDrt[500];
    int nLen = ::GetCurrentDirectory(500,strCurDrt);
    if( strCurDrt[nLen]!='\\' )
    {
    strCurDrt[nLen++] = '\\';
    strCurDrt[nLen] = '\0';
    } CString strFileName = strCurDrt;
    strFileName += "startup.swf";  m_FlashPicture.LoadMovie(0, strFileName); m_FlashPicture.Play();
    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
    }BEGIN_EVENTSINK_MAP(CFlashPciture, CDialog)
        //{{AFX_EVENTSINK_MAP(CFlashPciture)
    ON_EVENT(CFlashPciture, IDC_SHOCKWAVEFLASH1, 150 /* FSCommand */, OnFSCommandShockwaveflash1, VTS_BSTR VTS_BSTR)
    //}}AFX_EVENTSINK_MAP
    END_EVENTSINK_MAP()void CFlashPciture::OnFSCommandShockwaveflash1(LPCTSTR command, LPCTSTR args) 
    {
    // TODO: Add your control notification handler code here
    if( 0 == strcmp(command,"bt") )
    {
    CDialog::OnOK();
    }
    else if( 0 == strcmp(command,"quit") )
    {

    CDialog::OnCancel();
    CSimuRobTestApp *pApp = (CSimuRobTestApp*) (AfxGetApp());
    pApp->ExitInstance();

    }
    }
      

  4.   

    当然调用了,我在一个菜单里做的测试,m_flash.DoModal() //返回值为-1,应该是对话框创建失败的问题
      

  5.   

    我的程序比较大,可能逻辑有点混乱。而且无法设置断点进行跟踪,如果设置断点就一下子进入了反汇编状态,所以很郁闷。我目前调试,只能用AfxMessageBox()了。
      

  6.   

    我新建一个简单的一个工程,播放flash是没有问题的.可是在原来的工程里究就不行了
      

  7.   

    void CMainFrame::OnFullScreen() 
    {
    // TODO: Add your command handler code here
        CFlashPciture m_flash;
    m_flash.DoModal();}