📄 videotest2dlg.cpp
字号:
// VideoTest2Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "Afxcoll.h"
#include "Afxtempl.h"
#include "VideoTest2.h"
#include "VideoTest2Dlg.h"
#include "ConfigFileReader.h"
#include "BaseConfigFile.h"
#include "RuleConfigFile.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CVideoTest2Dlg dialog
CVideoTest2Dlg::CVideoTest2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CVideoTest2Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CVideoTest2Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CVideoTest2Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVideoTest2Dlg)
DDX_Control(pDX, IDC_MEDIAPLAYER1, m_player);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVideoTest2Dlg, CDialog)
//{{AFX_MSG_MAP(CVideoTest2Dlg)
ON_WM_TIMER()
ON_WM_CHAR()
//}}AFX_MSG_MAP
ON_MESSAGE( WM_HOTKEY, OnHotKey )
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVideoTest2Dlg message handlers
BOOL CVideoTest2Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 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
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
//register the hotkey
HWND hWnd = GetSafeHwnd();
RegisterHotKey(hWnd, 1001, MOD_CONTROL , 'A');
RegisterHotKey(hWnd, 1002, MOD_CONTROL , 'a');
RegisterHotKey(hWnd, 1003, MOD_CONTROL, 'P');
RegisterHotKey(hWnd, 1004, MOD_CONTROL, 'p');
// Begin to load rules in the play.lst
CConfigFileReader con(_T(".\\"));
playlist= con.ReadRuleConfigfile(_T("play.lst"));
// CArray<CObList *,CObList *> playfileDetaillist ;
// load each media list file the play list
for(int i=0;i<playlist->GetCount();i++){
CRuleConfigFile *ruleconfile= (CRuleConfigFile*) playlist->GetAt(playlist->FindIndex( i ) );
//con.ReadBaseConfigfile(ruleconfile->getFilePath());
playfileDetaillist.Add(con.ReadBaseConfigfile(ruleconfile->getFilePath()));
}
afxDump << playfileDetaillist<<"end\n";
//CBaseConfigFile *confile= (CBaseConfigFile*) list->GetAt(list->FindIndex( 0 ) );
// confile.
// MessageBox(confile->getPartition()+confile->getFilePath(),TEXT("CONMENT"),MB_OK);
/// m_player.SetFileName(confile->getPartition()+confile->getFilePath());
//m_player.SetFileName(_T(".\\1.wmv"));
// m_player.se
// m_player.Stop();
//m_player.Play();
m_nTimer = SetTimer(1,8000,NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
void CVideoTest2Dlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
switch(nIDEvent)
{
case 1:
CObList *onefilelist= playfileDetaillist.GetAt(0);
CBaseConfigFile *mediafile= (CBaseConfigFile*) onefilelist->GetAt(onefilelist->FindIndex( 0 ) );
//MessageBox(mediafile->getPartition()+mediafile->getFilePath(),TEXT("CONMENT"),MB_OK);
m_player.SetFileName(mediafile->getPartition()+mediafile->getFilePath());
m_player.Play();
KillTimer(m_nTimer);
break;
}
CDialog::OnTimer(nIDEvent);
}
LRESULT CVideoTest2Dlg::OnHotKey(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
switch(wParam) {
case 1001:
case 1002:
{
// MessageBox(TEXT("get msg 1001"),TEXT("CONMENT"),MB_OK);
HWND hWnd = GetSafeHwnd();
LONG lStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
lStyle &= ~WS_POPUP;
::SetWindowLong(m_hWnd, GWL_STYLE, lStyle);
::ShowWindow(m_hWnd, SW_SHOW);
CWnd::SetForegroundWindow();
m_player.Play();
break;
}
case 1003:
case 1004:
{
// MessageBox(TEXT("get msg 1003"),TEXT("CONMENT"),MB_OK);
HWND hWnd = GetSafeHwnd();
LONG lStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
lStyle |= WS_POPUP;
::SetWindowLong(m_hWnd, GWL_STYLE, lStyle);
::ShowWindow(m_hWnd, SW_HIDE);
m_player.Pause();
break;
}
}
return 0;
// return CDialog::OnHotKey(wParam, lParam);
}
BOOL CVideoTest2Dlg::DestroyWindow()
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::DestroyWindow();
}
void CVideoTest2Dlg::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnChar(nChar, nRepCnt, nFlags);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -