Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/xjb2006/article/details/83068708
This is 2008 to 1-year-old son to write a small program interface ,, look at the effect it
Main interface
Play flash song
Use of technology is relatively simple, but very popular at the time flash ah, just like mp4, mp3
With the flash player, paste Code:
// Show.cpp : 实现文件
//
#include "stdafx.h"
#include "XzxLike.h"
#include "Show.h"
#include ".\show.h"
#include "XzxLikeDlg.h"
// CShow 对话框
IMPLEMENT_DYNAMIC(CShow, CDialog)
CShow::CShow(CWnd* pParent /*=NULL*/)
: CDialog(CShow::IDD, pParent)
{
m_nIndex=0;
}
CShow::~CShow()
{
}
void CShow::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SHOCKWAVEFLASH1, m_flash);
}
BEGIN_MESSAGE_MAP(CShow, CDialog)
ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON5, OnBnClickedButton5)
ON_WM_SIZE()
ON_WM_SETCURSOR()
END_MESSAGE_MAP()
// CShow 消息处理程序
BOOL CShow::OnInitDialog()
{
CDialog::OnInitDialog();
m_flash.m_pMain=m_pMain;
m_flash.put_BackgroundColor(RGB(241,222,201)); //bgr
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
void CShow::InitPlay()
{
m_nIndex=0;
ACTInfo eg=m_pacts->GetAt(m_nIndex);
CString szMovie=m_pMain->GetSWFName(*pszDir,eg.nIDName);
if(szMovie.IsEmpty())
return;
m_flash.LoadMovie(0,szMovie);
if(m_pMain->m_nCurModle==4&&(m_nIndex==0||m_nIndex==1))
m_flash.GotoFrame(1);
else
m_flash.GotoFrame(1);
m_flash.Play();
//if(m_flash.get_Playing())
//{
// m_flash.StopPlay();
// m_flash.GotoFrame(0);
// return;
//}
}
void CShow::Play()
{
this->Stop();
ACTInfo eg=m_pacts->GetAt(m_nIndex);
CString szMovie=m_pMain->GetSWFName(*pszDir,eg.nIDName);
m_flash.LoadMovie(0,szMovie);
if(szMovie.IsEmpty())
return;
if(m_pMain->m_nCurModle==4&&(m_nIndex==0||m_nIndex==1))
m_flash.GotoFrame(1);
else
m_flash.GotoFrame(1);
m_flash.Play();
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
MoveWindow(100,100,x-200,y-200);
}
void CShow::Up()
{
m_nIndex--;
if(m_nIndex<0)
m_nIndex=0;
Play();
}
void CShow::Down()
{
int nCount=(int)m_pacts->GetCount();
m_nIndex++;
if(m_nIndex>nCount-1)
m_nIndex=nCount-1;
Play();
}
void CShow::PlayOrStop()
{
if(m_flash.get_Playing())
{
m_flash.StopPlay();
}
else
m_flash.Play();
}
void CShow::OnBnClickedButton1()//播放
{
}
void CShow::OnBnClickedButton5()//返回
{
m_flash.StopPlay();
m_pMain->ShowItem(0);
}
void CShow::Stop()
{
m_flash.StopPlay();
}
void CShow::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if(m_flash.m_hWnd)
{
m_flash.MoveWindow(0,0,cx,cy);
}
}
void CShow::OnOK()
{
}
void CShow::OnCancel()
{
}
bool CShow::SetFullScreen(BOOL inEnabled)
{
static RECT rect;
//static RECT rect1;
static LONG lStyle=0;
if(inEnabled)
{
int nXFull=::GetSystemMetrics(SM_CXSCREEN);
int nYFull=::GetSystemMetrics(SM_CYSCREEN);
this->GetWindowRect(&rect);
lStyle = GetWindowStyle(GetSafeHwnd());
SetWindowLong(this->GetSafeHwnd(), GWL_STYLE, WS_POPUP | WS_VISIBLE);
SetWindowPos(&::CWnd::wndTop,0,0,nXFull,nYFull,SWP_NOACTIVATE);
m_pMain->m_gif.ShowWindow(SW_HIDE);
}
else
{
SetWindowLong(m_hWnd, GWL_STYLE, lStyle);
SetWindowPos(&::CWnd::wndTop,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,SWP_NOACTIVATE);
m_pMain->m_gif.ShowWindow(SW_SHOW);
}
return true;//SUCCEEDED(hr);
return false;
}
bool CShow::GetFullScreen(void)
{
int nXFull=::GetSystemMetrics(SM_CXSCREEN);
int nYFull=::GetSystemMetrics(SM_CYSCREEN);
RECT rect;
this->GetWindowRect(&rect);
if((rect.bottom-rect.top)>=nYFull&&(rect.right-rect.left)>=nXFull)
return true;
else
return false;
return false;
}
BOOL CShow::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if(WM_USER+100==message)
{
if(wParam==0&&lParam==0)
{
BOOL bFull=GetFullScreen();
SetFullScreen(!bFull);
}
if(wParam==0&&lParam==1)
{
SetFullScreen(0);
}
if(wParam==1&&lParam==0)
{
SetFullScreen(1);
}
}
return CDialog::OnWndMsg(message, wParam, lParam, pResult);
}
BOOL CShow::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if(m_pMain->m_hCur)
{
::SetCursor(m_pMain->m_hCur);
return true;
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
Interface style full of innocence, hoping to evoke memories of your childhood!
Project source code Download:
https://download.csdn.net/download/xjb2006/10722976
Thanks, bye!