我计划为我得应用程序添加一个启动动画,使用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的控件也无法实现,和前者相同的现象.
我实在没有办法了,求助!
CShockwaveFlash m_FlashPicture;
m_FlashPicture.Create(NULL,WS_CHILD|WS_VISIBLE,rc,this,IDC_SHOCKWAVEFLASH1);
是不是我的程序和shock wave falsh 控件存在冲突,怎样解决呀.
我放入CWebBrowser2 支持播放flash的控件也无法实现,和前者相同的现象.
我实在没有办法了,求助!
你拖放进去的控件默认已经存在了
你再create怎么能行呢
AfxEnableControlContainer();
我在主菜单里添加了一个测试项:
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();
}
}
{
// TODO: Add your command handler code here
CFlashPciture m_flash;
m_flash.DoModal();}