📄 vesavcd.c
字号:
{
if(Playing) return;
DrawPower(hdc,ButtonState[BEPOWER-1]);
DrawStart(hdc,ButtonState[BESTART-1]);
DrawBack(hdc,ButtonState[BEBACK-1]);
DrawForWard(hdc,ButtonState[BEFORWARD-1]);
DrawEnd(hdc,ButtonState[BEEND-1]);
DrawLoop(hdc,ButtonState[BELOOP-1]);
DrawStop(hdc,ButtonState[BESTOP-1]);
DrawPlay(hdc,ButtonState[BEPLAY-1]);
DrawRestart(hdc,ButtonState[BERESTART-1]);
DrawPause(hdc,ButtonState[BEPAUSE-1]);
DrawDisc(hdc,ButtonState[BEDISC-1]);
DrawCapture(hdc,ButtonState[BECAPTURE-1]);
DrawMixSound(hdc,ButtonState[BEMIXSOUND-1]);
}
static void DrawButtonState(HWND hwnd,int Button,int Status)
{
HDC hdc;
if(Playing) return;
hdc=GetDC(hwnd);
switch(Button)
{
case BEPOWER: DrawPower(hdc,Status);break;
case BESTART: DrawStart(hdc,Status);break;
case BEBACK: DrawBack(hdc,Status);break;
case BEFORWARD: DrawForWard(hdc,Status);break;
case BEEND: DrawEnd(hdc,Status);break;
case BELOOP: DrawLoop(hdc,Status);break;
case BESTOP: DrawStop(hdc,Status);break;
case BEPLAY: DrawPlay(hdc,Status);break;
case BERESTART: DrawRestart(hdc,Status);break;
case BEPAUSE: DrawPause(hdc,Status);break;
case BEDISC: DrawDisc(hdc,Status);break;
case BECDOUT: DrawCDOut(hdc,Status);break;
case BEOTHER: DrawOther(hdc,Status);break;
case BECAPTURE: DrawCapture(hdc,Status);break;
case BEMIXSOUND: DrawMixSound(hdc,Status);break;
}
ReleaseDC(hwnd,hdc);
}
static void DrawCloseState(HWND hwnd)
{
HDC hdc;
HBITMAP hBmp;
if(Playing) return;
hdc=GetDC(hwnd);
DrawStart(hdc,0);
DrawBack(hdc,0);
DrawForWard(hdc,0);
DrawEnd(hdc,0);
DrawLoop(hdc,0);
DrawStop(hdc,0);
DrawPlay(hdc,0);
DrawRestart(hdc,0);
DrawPause(hdc,0);
DrawDisc(hdc,0);
hBmp=LoadBitmap(hInst,"MainBlock");
DrawBitmap(hdc,hBmp,117,21); //Close State
DeleteObject(hBmp);
hBmp=LoadBitmap(hInst,"TypeBlock");
DrawBitmap(hdc,hBmp,259,22); //Close Type
DeleteObject(hBmp);
ReleaseDC(hwnd,hdc);
}
void PASCAL FAR DrawPlayType(HDC hdc)
{
HBITMAP hBmp;
if(Playing) return;
hBmp=LoadBitmap(hInst,PlayType==0?"VCDISK":"MCIFILE");
DrawBitmap(hdc,hBmp,259,22); //VCD Type
DeleteObject(hBmp);
}
static void DrawOpenState(HWND hwnd)
{
HDC hdc;
HBITMAP hBmp;
hdc=GetDC(hwnd);
DrawPlayType(hdc);
DrawAllStatus(hdc);
DrawTimeBlock(hdc);
ReleaseDC(hwnd,hdc);
DisplayTime(CurrentPos);
}
HWND PASCAL FAR CreatehInt(HWND hwnd,int x,int y,char *Str)
{
HWND hIntwnd;
DWORD HighWidth;
int cx,cy;
HDC hdc;
hdc=GetDC(hwnd);
HighWidth=GetTextExtent(hdc,Str,lstrlen(Str));
ReleaseDC(hwnd,hdc);
cx=GetSystemMetrics(SM_CXBORDER);
cy=GetSystemMetrics(SM_CYBORDER);
cx+=cx;cy+=cy;
hIntwnd=CreateWindow("STATIC",Str,WS_CHILD|WS_VISIBLE|WS_BORDER,
x,y-HIWORD(HighWidth),LOWORD(HighWidth)+cx,
HIWORD(HighWidth)+cy,hwnd,NULL,hInst,NULL);
if(hIntwnd)
{
ShowWindow(hIntwnd,SW_SHOW);
UpdateWindow(hIntwnd);
}
return hIntwnd;
}
HWND hIntwnd=0;
int hIntBtn=0;
int ButtonPress=0;
int DisplayhIntCount=0;
void PASCAL FAR ClearhInt(void)
{
if(hIntwnd!=NULL)
{
DestroyWindow(hIntwnd);
hIntwnd=NULL;
hIntBtn=NULL;
}
DisplayhIntCount=0;
}
int tmpCurPos=0;
static void DrawhInt(HWND hwnd,int CurPos)
{
POINT ptCurrent;
if(ButtonPress!=0 && ButtonPress!=-1)
{
ClearhInt();
return;
}
if(CurPos==-1)
{
CurPos=InPositionBar(hwnd);
if(CurPos!=-1) CurPos=800;
}
if(CurPos==-1)
{//Clear HINT
ClearhInt();
return;
}
///////////// Create a TrackPopupMenu ////////
if(hIntBtn!=CurPos && hIntBtn!=0) ClearhInt();
if(hIntBtn==CurPos) return;
if(tmpCurPos==CurPos)
{
DisplayhIntCount++;
if(DisplayhIntCount<10) return;
}
else {//Cureent Position
tmpCurPos=CurPos;
DisplayhIntCount=0;
return;
}
switch(CurPos)
{
case BEPOWER:
if(Chinese) hIntwnd=CreatehInt(hwnd,12,110,"电源");
else hIntwnd=CreatehInt(hwnd,12,110,"Power");
if(hIntwnd) hIntBtn=CurPos;
break;
case BESTART:
if(Chinese) hIntwnd=CreatehInt(hwnd,63,107,"到头");
else hIntwnd=CreatehInt(hwnd,63,107,"To Start");
if(hIntwnd) hIntBtn=CurPos;
break;
case BEBACK:
if(Chinese) hIntwnd=CreatehInt(hwnd,96,107,"倒回");
else hIntwnd=CreatehInt(hwnd,96,107,"Back");
if(hIntwnd) hIntBtn=CurPos;
break;
case BEFORWARD:
if(Chinese) hIntwnd=CreatehInt(hwnd,129,107,"向前");
else hIntwnd=CreatehInt(hwnd,129,107,"Forward");
if(hIntwnd) hIntBtn=CurPos;
break;
case BEEND:
if(Chinese) hIntwnd=CreatehInt(hwnd,162,107,"到尾");
else hIntwnd=CreatehInt(hwnd,162,107,"To End");
if(hIntwnd) hIntBtn=CurPos;
break;
case BELOOP:
if(Chinese) hIntwnd=CreatehInt(hwnd,185,107,"允许循环");
else hIntwnd=CreatehInt(hwnd,185,107,"Enable Loop");
if(hIntwnd) hIntBtn=CurPos;
break;
case BESTOP:
if(Chinese) hIntwnd=CreatehInt(hwnd,228,107,"停止");
else hIntwnd=CreatehInt(hwnd,228,107,"Stop");
if(hIntwnd) hIntBtn=CurPos;
break;
case BEPLAY:
if(Chinese) hIntwnd=CreatehInt(hwnd,261,107,"播放");
else hIntwnd=CreatehInt(hwnd,261,107,"Play");
if(hIntwnd) hIntBtn=CurPos;
break;
case BERESTART:
if(Chinese) hIntwnd=CreatehInt(hwnd,328,107,"重新开始");
else hIntwnd=CreatehInt(hwnd,328,107,"Restart");
if(hIntwnd) hIntBtn=CurPos;
break;
case BEPAUSE:
if(Chinese) hIntwnd=CreatehInt(hwnd,361,107,"暂定");
else hIntwnd=CreatehInt(hwnd,361,107,"Pause");
if(hIntwnd) hIntBtn=CurPos;
break;
case BEDISC:
if(Chinese) hIntwnd=CreatehInt(hwnd,343,19,"选择文件");
else hIntwnd=CreatehInt(hwnd,343,19,"Select File");
if(hIntwnd) hIntBtn=CurPos;
break;
case BECDOUT:
if(Chinese) hIntwnd=CreatehInt(hwnd,394,107,"弹CD碟");
else hIntwnd=CreatehInt(hwnd,394,107,"Eject");
if(hIntwnd) hIntBtn=CurPos;
break;
case BEOTHER:
if(Chinese) hIntwnd=CreatehInt(hwnd,410,107,"其他功能");
else hIntwnd=CreatehInt(hwnd,410,107,"Other func");
if(hIntwnd) hIntBtn=CurPos;
break;
case BECAPTURE:
if(Chinese) hIntwnd=CreatehInt(hwnd,361,64,"取图");
else hIntwnd=CreatehInt(hwnd,361,64,"Capture");
if(hIntwnd) hIntBtn=CurPos;
break;
case BEMIXSOUND:
if(Chinese) hIntwnd=CreatehInt(hwnd,370,64,"立体声/混合声");
else hIntwnd=CreatehInt(hwnd,394,64,"Stereo/Mix");
if(hIntwnd) hIntBtn=CurPos;
break;
case 800: //Bar
if(Chinese) hIntwnd=CreatehInt(hwnd,120,84,"左键定位/右键定义循环点");
else hIntwnd=CreatehInt(hwnd,120,84,"Left Locate/Right Define Loop");
if(hIntwnd) hIntBtn=CurPos;
break;
}
}
static void DrawShowWindowhInt(HWND hwnd)
{
int CurPos=980;
if(hIntBtn!=CurPos && hIntBtn!=0) ClearhInt();
if(hIntBtn==CurPos) return;
if(tmpCurPos==CurPos)
{
DisplayhIntCount++;
if(DisplayhIntCount<10) return;
}
else {//Cureent Position
tmpCurPos=CurPos;
DisplayhIntCount=0;
return;
}
if(Chinese) hIntwnd=CreatehInt(hwnd,46,18,"预示图");
else hIntwnd=CreatehInt(hwnd,46,18,"PreView");
if(hIntwnd) hIntBtn=CurPos;
}
int MoveOut=0;
int CloseState=0;
int OldPlayState=0;
UINT TimerID=0;
unsigned short TimeCount=0;
static void DoUpHandle(HWND hwnd)
{
switch(ButtonPress)
{
/////////////// New //////////////
case BEMIXSOUND:
ButtonState[ButtonPress-1]^=1;
break;
//////////////////////////////////
case BELOOP:
ButtonState[ButtonPress-1]^=1;
break;
case BEPAUSE:
if(ButtonState[BESTOP-1]) break;
if(OldPlayState)
{
ButtonState[ButtonPress-1]^=1;
if(ButtonState[BEPAUSE-1]==1)
{
OldPlayState=ButtonState[BEPLAY-1];
ButtonState[BEPLAY-1]=0;
}
else ButtonState[BEPLAY-1]=OldPlayState;
DrawButtonState(hwnd,BEPLAY,ButtonState[BEPLAY-1]);
if(ButtonState[BEPLAY-1]==1)
{
ButtonState[BESTOP-1]=0;
DrawButtonState(hwnd,BESTOP,0);
}
}
break;
case BERESTART:
if(ButtonState[BEPAUSE-1]==1)
{
ButtonState[BEPLAY-1]=OldPlayState;
DrawButtonState(hwnd,BEPLAY,OldPlayState);
ButtonState[BEPAUSE-1]=0;
DrawButtonState(hwnd,BEPAUSE,0);
ButtonState[BESTOP-1]=0;
DrawButtonState(hwnd,BESTOP,0);
}
break;
case BEPLAY:
ButtonState[ButtonPress-1]^=1;
OldPlayState=ButtonState[BEPLAY-1];
if(ButtonState[BEPLAY-1]==1)
{
ButtonState[BEPAUSE-1]=0;
DrawButtonState(hwnd,BEPAUSE,0);
ButtonState[BESTOP-1]=0;
DrawButtonState(hwnd,BESTOP,0);
}
break;
case BESTOP:
if(ButtonState[BEPAUSE-1]) break;
if(OldPlayState)
{
ButtonState[ButtonPress-1]^=1;
if(ButtonState[BESTOP-1]==1)
{
OldPlayState=ButtonState[BEPLAY-1];
ButtonState[BEPLAY-1]=0;
}
else ButtonState[BEPLAY-1]=OldPlayState;
DrawButtonState(hwnd,BEPLAY,ButtonState[BEPLAY-1]);
if(ButtonState[BEPLAY-1]==1)
{
ButtonState[BEPAUSE-1]=0;
DrawButtonState(hwnd,BEPAUSE,0);
}
}
break;
}
DrawButtonState(hwnd,ButtonPress,ButtonState[ButtonPress-1]);
// Post Message to handle.
PostMessage(hwnd,WM_COMMAND,ButtonPress,0L);
}
long FAR PASCAL WndBmpProc(HWND hwnd,WORD message,WORD wParam,LONG lParam)
{
HDC hdc;
PAINTSTRUCT ps;
if(message==WM_PAINT)
{
HBITMAP hAbout;
hdc=BeginPaint(hwnd,&ps);
hAbout=LoadBitmap(hInst,"LOGO");
DrawBitmap(hdc,hAbout,0,0);
DeleteObject(hAbout);
EndPaint(hwnd,&ps);
return 0;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
DWORD huge PASCAL SelectProc(HWND hwnd,WORD message,WORD wParam,LONG LParam);
DWORD huge PASCAL OtherFunctionProc(HWND hwnd,WORD message,WORD wParam,LONG LParam);
LONG huge pascal KeyboardFunc (int nCode, WORD wParam, DWORD lParam);
FARPROC HookProc;
HHOOK HookHandle;
int VideoAbort=0;
int HadDown=0;
int HadSetCapture=0;
extern int TestMode;
extern long VCDHigh;
extern int DisplayPreView;
extern UINT Devs;
extern int CurDevID;
extern int MixSound;
extern WAVEOUTCAPS AudioCaps[10];
/////////////////// New Feature /////////////////
int StopFlags=0;
int StepFlags=0;
int MouseStop=0;
static int pascal TryToYield(void)
{
MSG msg;
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message==WM_STOPVIDEO)
{//STOP
StopFlags^=1;
}
else {
if(msg.message==WM_KEYDOWN &&
(msg.wParam==VK_SPACE||
msg.wParam==VK_RETURN))
{//Not play
StopFlags=StepFlags=0;
TranslateMessage(&msg);
DispatchMessage(&msg);
return 0;
}
else {//another message
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
if(MouseStop)
{
StopFlags=StepFlags=0;
return 0;
}
return 1;
}
void PASCAL FAR DisplaySystemMessage(HWND hwnd)
{
char TmpBuffer[50];
char InfoBuffer[640];
char WhichYUV[5];
*(DWORD *)WhichYUV=DCISurfaceScreen.dciInfo.dwCompression;
WhichYUV[4]=0;
InfoBuffer[0]=TmpBuffer[0]=0;
if(VCDHigh==288)
{//PAL
if(UseDCI)
{
if(DCIType==2)
{
lstrcpy(InfoBuffer,"========PAL Video======\n");
lstrcpy(TmpBuffer,"Use (");
lstrcat(TmpBuffer,WhichYUV);
lstrcat(TmpBuffer,") DCI Display\n");
lstrcat(InfoBuffer,TmpBuffer);
}
else if(DCIType==1 && DCIPlay) lstrcpy(InfoBuffer,"PAL Video,Use Primary surface DCI Display\n");
else goto PALNotUseDCI;
}
else {
PALNotUseDCI:
if(VESAColor==16 || VESAColor==163) lstrcpy(InfoBuffer,"PAL Video,Use 10E mode Display\n");
if(VESAColor==15) lstrcpy(InfoBuffer,"PAL Video,Use 10D mode Display\n");
if(VESAColor==64) lstrcpy(InfoBuffer,"PAL Video,Use 111 mode Display\n");
if(VESAColor==32) lstrcpy(InfoBuffer,"PAL Video,Use 110 mode Display\n");
if(VESAColor==8) lstrcpy(InfoBuffer,"PAL Video,Use 13 mode Display\n");
}
}
else {//NTSC
if(UseDCI)
{
if(DCIType==2)
{
lstrcpy(InfoBuffer,"========NTSC Video======\n");
lstrcpy(TmpBuffer,"Use (");
lstrcat(TmpBuffer,WhichYUV);
lstrcat(TmpBuffer,") DCI Display\n");
lstrcat(InfoBuffer,TmpBuffer);
}
else if(DCIType==1 && DCIPlay) lstrcpy(InfoBuffer,"NTSC Video,Use Primary surface DCI Display\n");
else goto NTSCNotUseDCI;
}
else {
NTSCNotUseDCI:
if(VESAColor==16 || VESAColor==163) lstrcpy(InfoBuffer,"NTSC Video,Use 10E mode Display\n");
if(VESAColor==15) lstrcpy(InfoBuffer,"NTSC Video,Use 10D mode Display\n");
if(VESAColor==64) lstrcpy(InfoBuffer,"NTSC Video,Use 111 mode Display\n");
if(VESAColor==32) lstrcpy(InfoBuffer,"NTSC Video,Use 110 mode Display\n");
if(VESAColor==8) lstrcpy(InfoBuffer,"NTSC Video,Use 13 mode Display\n");
}
}
////////////////// Sound Card Info ///////////////////
if(Devs==0) lstrcat(InfoBuffer,"No any Audio Device.\n");
else {
wsprintf(TmpBuffer,"There are %d Audio Devices\n",Devs);
lstrcat(InfoBuffer,TmpBuffer);
wsprintf(TmpBuffer,"Support %d Audio Channels\n",AudioCaps[CurDevID].wChannels);
lstrcat(InfoBuffer,TmpBuffer);
if(AudioCaps[CurDevID].dwSupport & WAVECAPS_VOLUME)
lstrcat(InfoBuffer,"This Device Support Volume Control\n");
else lstrcat(InfoBuffer,"This Device Not Support Volume Control\n");
if(AudioCaps[CurDevID].dwSupport & WAVECAPS_LRVOLUME)
lstrcat(InfoBuffer,"Support Left & Right Volume Control\n");
else lstrcat(InfoBuffer,"Not Support Left & Right Volume Control\n"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -