mfc播放器Word文档下载推荐.docx
- 文档编号:17666456
- 上传时间:2022-12-08
- 格式:DOCX
- 页数:28
- 大小:21.33KB
mfc播放器Word文档下载推荐.docx
《mfc播放器Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《mfc播放器Word文档下载推荐.docx(28页珍藏版)》请在冰豆网上搜索。
intxop,yop;
CStringFileString;
CMainWindow();
staticconstTCHARszFilters1[];
staticconstTCHARszFilters2[];
afx_msgvoidOnLButtonDown(UINTnFlags,CPointpoint);
afx_msgvoidOnLButtonUp(UINTnFlags,CPointpoint);
afx_msgBOOLOnMouseWheel(UINTnFlags,shortzDelta,CPointpoint);
afx_msgintOnCreate(LPCREATESTRUCTlpcs);
afx_msgLRESULTOnMCINotify(WPARAMwParam,LPARAMlParam);
afx_msgvoidOnBtnClick();
afx_msgvoidOnBtnClick1();
afx_msgvoidOnBtnClick2();
afx_msgvoidOnBtnClick3();
afx_msgvoidOnBtnClick4();
afx_msgvoidOnBtnClick5();
afx_msgvoidOnCheckClick();
afx_msgvoidOnCheckClick1();
afx_msgvoidOnCheckClick2();
afx_msgvoidOnCheckClick3();
afx_msgvoidOnTimer(UINTnTimerID);
afx_msgvoidOnSize(UINTnType,intcx,intcy);
afx_msgBOOLOnEraseBkgnd(CDC*pDC);
afx_msgHBRUSHOnCtlColor(CDC*pDC,CWnd*pWnd,UINTnCtlColor);
DECLARE_MESSAGE_MAP()
//窗体代码Player.cpp
#include<
afxwin.h>
#include"
Player.h"
VolumeControl.h"
vfw.h>
afxext.h>
math.h"
#pragmacomment(lib,"
vfw32.lib"
)
#defineIDC_LISTBOX1000
#defineIDC_OPEN1001
#defineIDC_OPEN11002
#defineIDC_OPEN21003
#defineIDC_OPEN31004
#defineIDC_OPEN41007
#defineIDC_CLOSE1005
#defineIDC_MAIN1006
#defineIDC_CHECK1008
#defineIDC_CHECK11009
#defineIDC_CHECK21010
#defineIDC_CHECK31011
CMyAppmyApp;
constTCHARCMainWindow:
:
szFilters1[]=_T("
SoundFiles(*.mp3)|*.mp3|AllFiles(*.*)|*.*||"
);
szFilters2[]=_T("
MovieFiles(*.avi)|*.avi|AllFiles(*.*)|*.*||"
UINTnSound;
CStringstr1,str,name,filename;
intsign=1,nVolume,length,count=0;
ControlWindow*con;
BOOLEloop=FALSE,Eloop1=FALSE,Eloop2=FALSE,flag=FALSE,Eloop3=FALSE;
intIndex=0;
BOOLCMyApp:
InitInstance()
m_pMainWnd=newCMainWindow;
m_pMainWnd->
ShowWindow(m_nCmdShow);
UpdateWindow();
returnTRUE;
}
BEGIN_MESSAGE_MAP(CMainWindow,CFrameWnd)
ON_WM_CREATE()
ON_BN_CLICKED(IDC_OPEN,OnBtnClick)
ON_BN_CLICKED(IDC_OPEN1,OnBtnClick1)
ON_BN_CLICKED(IDC_OPEN2,OnBtnClick2)
ON_BN_CLICKED(IDC_OPEN3,OnBtnClick3)
ON_BN_CLICKED(IDC_CLOSE,OnBtnClick4)
ON_BN_CLICKED(IDC_OPEN4,OnBtnClick5)
ON_BN_CLICKED(IDC_CHECK,OnCheckClick)
ON_BN_CLICKED(IDC_CHECK1,OnCheckClick1)
ON_BN_CLICKED(IDC_CHECK2,OnCheckClick2)
ON_BN_CLICKED(IDC_CHECK3,OnCheckClick3)
ON_WM_ERASEBKGND()
ON_WM_CTLCOLOR()
ON_WM_SIZE()
ON_WM_TIMER()
ON_WM_MOUSEWHEEL()
ON_MESSAGE(MCIWNDF_NOTIFYMODE,OnMCINotify)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()
CMainWindow:
CMainWindow()
Create(NULL,_T("
Player"
),WS_POPUPWINDOW,CRect(100,100,620,610),this);
intCMainWindow:
OnCreate(LPCREATESTRUCTlpcs)
if(CFrameWnd:
OnCreate(lpcs)==-1)
return-1;
//CoInitializeEx
CClientDCdc(this);
SetWindowPos(m_hWnd,HWND_TOPMOST,100,100,620,610,WS_EX_TOPMOST);
con=newControlWindow();
//con->
ShowWindow(SW_SHOW);
if(dc.GetDeviceCaps(RASTERCAPS)&
RC_PALETTE)
struct{
LOGPALETTElp;
PALETTEENTRYape[63];
}pal;
LOGPALETTE*pLP=(LOGPALETTE*)&
pal;
pLP->
palVersion=0x300;
palNumEntries=64;
for(inti=0;
i<
64;
i++)
{
palPalEntry[i].peRed=0;
palPalEntry[i].peGreen=0;
palPalEntry[i].peBlue=255-(i*4);
palPalEntry[i].peFlags=0;
}
m_palette.CreatePalette(pLP);
font1.CreatePointFont(80,_T("
MSSansSerif"
));
CRectrect;
rect.SetRect(110,450,210,465);
loop.Create("
单曲循环"
WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON,rect,this,IDC_CHECK);
loop.SetFont(&
font1);
rect.SetRect(110,470,210,485);
loop1.Create("
列表循环"
WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON,rect,this,IDC_CHECK1);
loop1.SetFont(&
rect.SetRect(200,450,300,465);
loop2.Create("
单曲播放"
WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON,rect,this,IDC_CHECK2);
loop2.SetFont(&
loop2.SetCheck(BST_CHECKED);
rect.SetRect(200,470,300,485);
loop3.Create("
顺序播放"
WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON,rect,this,IDC_CHECK3);
loop3.SetFont(&
rect.SetRect(10,444,50,484);
clo.Create(NULL,WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|BS_ICON|WS_BORDER,rect,this,IDC_CLOSE);
clo.SetIcon(AfxGetApp()->
LoadIcon(_T("
IDI_ICON5"
)));
rect.SetRect(460,444,500,484);
open.Create(NULL,WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|BS_ICON|WS_BORDER,rect,this,IDC_OPEN4);
open.SetIcon(AfxGetApp()->
IDI_ICON7"
rect.SetRect(300,444,340,484);
btn.Create(NULL,WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|BS_ICON|WS_BORDER,rect,this,IDC_OPEN);
btn.SetIcon(AfxGetApp()->
IDI_ICON1"
rect.SetRect(340,444,380,484);
btn2.Create(NULL,WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|BS_ICON|WS_BORDER,rect,this,IDC_OPEN2);
btn2.SetIcon(AfxGetApp()->
IDI_ICON3"
rect.SetRect(380,444,420,484);
btn1.Create(NULL,WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|BS_ICON|WS_BORDER,rect,this,IDC_OPEN1);
btn1.SetIcon(AfxGetApp()->
IDI_ICON2"
rect.SetRect(420,444,460,484);
btn3.Create(NULL,WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|BS_ICON|WS_BORDER,rect,this,IDC_OPEN3);
btn3.SetIcon(AfxGetApp()->
IDI_ICON4"
//bitmap.m_hObject=(HBITMAP):
LoadImage(AfxGetInstanceHandle(),"
b.bmp"
IMAGE_BITMAP,110,40,LR_LOADFROMFILE);
//CClientDCdc1(this);
//CBitmapbitmap;
//bitmap.LoadBitmap(_T("
IDB_BITMAP1"
//CBrushbrush(&
bitmap);
//dc1.FillRect(CRect(390,445,500,485),&
brush);
rect.SetRect(370,5,505,430);
ListBox1.Create(WS_CHILD|WS_VISIBLE|LBS_STANDARD|WS_BORDER,rect,this,IDC_LISTBOX);
font.CreatePointFont(100,_T("
MSScansSerif"
ListBox1.SetFont(&
font);
if(!
MCIWndRegisterClass()){
MessageBox("
初始化未成功"
//m_hMyMCIWnd=MCIWndCreate(this->
m_hWnd,AfxGetInstanceHandle(),MCIWNDF_NOTIFYSIZE|MCIWNDF_NOERRORDLG|MCIWNDF_NOTIFYMODE|WS_CHILD|WS_VISIBLE|WS_BORDER|MCIWNDF_NOMENU,NULL);
GetSafeHwnd(),AfxGetInstanceHandle(),WS_CHILD|WS_VISIBLE|MCIWNDF_NOPLAYBAR|MCIWNDF_NOMENU|MCIWNDF_NOTIFYMODE|WS_BORDER,NULL);
//nVolume=MCIWndGetVolume(m_hMyMCIWnd);
BOOLCMainWindow:
OnEraseBkgnd(CDC*pDC)
GetClientRect(&
rect);
SetWindowPos(m_hMyMCIWnd,NULL,3,3,3,3,SWP_NOZORDER);
CPalette*pOldPalette;
if((HPALETTE)m_palette!
=NULL){
pOldPalette=pDC->
SelectPalette(&
m_palette,FALSE);
pDC->
RealizePalette();
DoGradientFill(pDC,&
if((HPALETTE)m_palette!
=NULL)
SelectPalette(pOldPalette,FALSE);
voidCMainWindow:
OnBtnClick1()
ListBox1.DeleteString(ListBox1.GetCurSel());
OnBtnClick2()
CFileDialogdlg(TRUE,_T("
avi"
),_T("
*.avi"
),OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT,szFilters2);
if(dlg.DoModal()==IDOK){
m_hMyMCIWnd=MCIWndCreate(this->
nVolume=MCIWndGetVolume(m_hMyMCIWnd);
name=dlg.GetFileName();
MCIWndStop(m_hMyMCIWnd);
ListBox1.AddString(name);
filename=name;
if(filename.GetLength()>
0&
&
GetSuffix(filename)=="
){
nSound=MCIWndOpen(m_hMyMCIWnd,(LPCSTR)filename,NULL);
:
SetWindowPos(m_hMyMCIWnd,NULL,3,3,400,400,SWP_NOZORDER);
HRGNhRgn1=:
CreateRoundRectRgn(3,3,400,400,20,20);
SetWindowRgn(m_hMyMCIWnd,hRgn1,TRUE);
if(nSound==0)
MCIWndPlay(m_hMyMCIWnd);
con->
m_slider.EnableWindow(TRUE);
m_slider1.EnableWindow(TRUE);
SetTimer(1,1000,NULL);
else{
//MCIWndDestroy(m_hMyMCIWnd);
MessageBox(_T("
没有读出文件"
),0,MB_OK);
OnBtnClick3()
for(inti=0;
ListBox1.GetCount();
ListBox1.DeleteString(i);
i--;
OnBtnClick4()
this->
CloseWindow();
DestroyWindow();
OnBtnClick5()
count++;
if(count%2==0){
open.SetIcon(AfxGetApp()->
LoadIcon("
ShowWindow(SW_HIDE);
IDI_ICON8"
OnBtnClick()
mp3"
*.mp3"
),OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT,szFilters1);
MCIWndStop(m_hMyMCIWnd);
if(nSound==0){
CStringCMainWindow:
GetSuffix(CStringstrFileName)
{
return
strFileName.Right(strFileName.GetLength()-strFileName.ReverseFind('
.'
)-1);
LRESULTCMainWindow:
OnMCINotify(WPARAMwParam,LPARAMlParam)
if(wParam==MCI_MODE_STOP)
结束"
DoGradientFill(CDC*pDC,LPRECTpRect)
CBrush*brush3[255];
TRY{
CBrush*
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- mfc 播放