www.pudn.com > NewFlash.rar > realoneDlg.cpp
// realoneDlg.cpp : implementation file
//
#include "stdafx.h"
#include "realone.h"
#include "realoneDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRealoneDlg dialog
CRealoneDlg::CRealoneDlg(CWnd* pParent /*=NULL*/)
: CDialog(CRealoneDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CRealoneDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CRealoneDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
// DDX_Control(pDX, IDC_PLAY, m_play);
//{{AFX_DATA_MAP(CRealoneDlg)
DDX_Control(pDX, IDC_BUTTON1, m_Button1);
DDX_Control(pDX, IDC_SHOCKWAVEFLASH_FRONT, m_FrontFlash);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRealoneDlg, CDialog)
//{{AFX_MSG_MAP(CRealoneDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRealoneDlg message handlers
BOOL CRealoneDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
// CRect rc;
// GetClientRect(&rc);//获取客户区大小.
// m_play.Create("rmplayer",WS_CHILD|WS_MAXIMIZE|WS_BORDER|WS_DLGFRAME,rc,this,IDC_REALPLAYER1,NULL,FALSE);
// m_play.SetEnableFullScreen(TRUE);//设置播放器允许全屏和还原原始尺寸.
// m_play.SetEnableOriginalSize(TRUE);
// m_play=(CRealAudio*)this->GetDlgItem(IDC_REALPLAYER1);
// CString str="IMAGEWINDOW,CONTROLPANEL,STATUSBAR";//设置播放器显示视频,控制条与状态条.
// m_play->SetControls(str);
// m_Button1.SetSkin(IDB_BITMAP1,IDB_BITMAP2,IDB_BITMAP3,0,0,0,0,0,0);
return TRUE; // return TRUE unless you set the focus to a control
}
void CRealoneDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CRealoneDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CRealoneDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CRealoneDlg::OnButton1()
{
// TODO: Add your control notification handler code here
// CString strFilter="RealMedia Files(*.rm)|*.rm|MP3 Files(*.mp3)|*.mp3|All Files(*.*)|*.*||";
// CFileDialog filedlg(TRUE,NULL,NULL,OFN_OVERWRITEPROMPT,strFilter,this);
// if(filedlg.DoModal()==IDOK)
// {
// m_play->SetSource(filedlg.GetPathName());
// m_play->DoPlay();
// }
long frame=0;
frame = m_FrontFlash.CurrentFrame();
TRACE("frame=%d\n",frame);
m_FrontFlash.StopPlay();
m_FrontFlash.FrameLoaded(1);
// m_FrontFlash.SetFrameNum(200);
frame = m_FrontFlash.CurrentFrame();
TRACE("frame=%d\n",frame);
m_FrontFlash.Play();
}
void CRealoneDlg::OnOK()
{
m_play->DoStop();
// TODO: Add extra validation here
///////添加此代码时不要忘了在stdafx.h开头处添加前两行
// AnimateWindow(GetSafeHwnd(),1000,AW_HIDE|AW_BLEND);
// KillTimer(0);
////////////////////////////////////
//此处采用DestroyWindow关闭窗口
//多谢杜修杏 老师指点
///////////////////////////////////
this->DestroyWindow();
// CDialog::OnOK();
}
void CRealoneDlg::OnButton2()
{
CString str;
// TODO: Add your control notification handler code here
// m_FrontFlash.SetMovie("C:\\Documents and Settings\\All Users\\Documents\\1.exe");
// m_FrontFlash.SetMovie("C:\\Documents and Settings\\All Users\\Documents\\back.swf");
// m_FrontFlash.LoadMovie(0, "F:\\huangguangkan\\sjyTest\\other\\realone\\1.swf");
// m_FrontFlash.LoadMovie(0,"D:\\rs\\Downloads\\增视刺激训练2.0\\Data\\R06.swf");
// str = m_FrontFlash.GetWMode();
// str = m_FrontFlash.GetAllowScriptAccess();
// WinExec("C:\\Documents and Settings\\All Users\\Documents\\1.exe",SW_SHOW);
// str = m_FrontFlash.GetVariable("bbb");
// m_FrontFlash.Stop();
// m_FrontFlash.Play();
// m_FrontFlash.Play();
m_FrontFlash.SetMovie("F:\\huangguangkan\\sjyTest\\other\\realone\\1.1?i=113");
// str = m_FrontFlash.GetVariable("i");
// TRACE("str=%s\n",str);
// m_FrontFlash.SetVariable("i","haha");
// m_FrontFlash.SetVariable("i","123");
// str = m_FrontFlash.GetVariable("i");
TRACE("str=%s\n",str);
// m_FrontFlash.Stop();
m_FrontFlash.Play();
// m_FrontFlash.SetMovie("D:\\rs\\Downloads\\增视刺激训练2.0\\Data\\R06.swf");
// m_FrontFlash.SetAllowScriptAccess(str);
// long frame=0;
//// frame = m_FrontFlash.CurrentFrame();
// frame =m_FrontFlash.GetFrameNum();
// TRACE("frame=%d\n",frame);
// frame = m_FrontFlash.GetTotalFrames();
// TRACE("frame=%d\n",frame);
//// m_FrontFlash.StopPlay();
//// m_FrontFlash.FrameLoaded(1);
// m_FrontFlash.SetFrameNum(100);
// frame = m_FrontFlash.CurrentFrame();
// TRACE("frame=%d\n",frame);
// m_FrontFlash.SetPlaying(TRUE);
}