这些程式码我看不太懂
不知道有哪些好心的大大可以帮我解惑
也帮我注解一下....
#pragma comment (lib, "comctl32.lib")
#pragma comment (lib, "dxguid.lib")
#pragma comment (lib, "strmiids.lib")
#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
#include <commctrl.h>
#include <dshow.h>
#include <cstdio>
extern"C" WINBASEAPI HWND WINAPI GetConsoleWindow();
#define MsgBox(s) MessageBox (0,s,0,MB_OK)
WCHAR e_str;
void cdecl MsgBox_ (wchar_t* fmt, ...)
{swprintf_s (e_str, 256, fmt, (char*)(&fmt+1)); MsgBox(e_str);}
namespace FileDlg
{
WCHAR title = L"*.*";
WCHAR filter =
L"AVI File (*.avi)\0*.avi\0"
L"MPEG File (*.mpg)\0*.mpg\0"
L"Mp3 File (*.mp3)\0*.mp3\0"
L"Wave File (*.wav)\0*.wav\0"
L"All Files (*.*)\0*.*\0\0";
WCHAR file_name, init_dir, exe_path={0}, *fname;
OPENFILENAME ofn = {
sizeof(OPENFILENAME), 0, 0, (LPCWSTR)filter,0,0,1, title,
512, file_name, 512, init_dir, 0, 6, 0,1, L"", 0,0,0
};
LPWSTR open (HWND hwnd)
{
ofn.hwndOwner = hwnd;
ofn.lpstrTitle = L"开档";
ofn.lpstrFilter = filter;
ofn.Flags = 6;
ofn.lpstrFile = 0; //若开档后仍为0表示按了
if (!GetOpenFileName (&ofn)) {
if(*ofn.lpstrFile)
MsgBox_ (L"Fail to open: %d", CommDlgExtendedError());
return 0;
}
return fname = ofn.lpstrFile; //取个短名字
}
}
#define DO(b) if (FAILED(b)) \
{MsgBox_(L"fail in %s line %d",__FILE__,__LINE__);}
struct Player
{
bool bPlaying;
long evCode;
LONGLONG pos, duration;
IGraphBuilder* pGraph;
IMediaControl* pCtrl;
IVideoWindow* pVideo;
IMediaSeeking* pSeek;
void init()
{
bPlaying = false;
DO (CoCreateInstance (CLSID_FilterGraph, 0, CLSCTX_INPROC,
IID_IGraphBuilder, (void**) &pGraph));
DO (pGraph->QueryInterface (IID_IMediaControl, (void**) &pCtrl));
DO (pGraph->QueryInterface (IID_IVideoWindow, (void**) &pVideo));
DO (pGraph->QueryInterface (IID_IMediaSeeking, (void**) &pSeek));
}
void free ..
访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容