Develop and Download Open Source Software

Browse Subversion Repository

Contents of /filemv/mciplay.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7 - (show annotations) (download)
Wed Jan 2 22:06:47 2008 UTC (16 years, 4 months ago) by tabasa
File MIME type: text/plain
File size: 1806 byte(s)


1
2 #include "defextern.h"
3
4 #ifndef STRICT
5 #define STRICT
6 #endif
7 #include <windows.h>
8
9 #include <MMSYSTEM.H>
10 #include "mes.h"
11 #include "mciplay.h"
12
13 BOOL openS =FALSE;
14 BOOL openC =FALSE;
15 char name[] ="myplayer";
16
17
18 void MciEnd()
19 {
20 if(openS) mciSendString("close myplayer",NULL,0,NULL);
21 openS =FALSE;
22 }
23
24
25 void MciOpen(char *file, HWND hwnd)
26 {
27 char str[500];
28 if(openS){
29 MciEnd();
30 openS =FALSE;
31 }
32
33 wsprintf(str,"open \"%s\" alias myplayer",file);
34 if(mciSendString(str,NULL,0,NULL)==0)
35 openS =TRUE;
36 }
37
38 void MciPlay()
39 {
40 mciSendString("play myplayer ",NULL,0,NULL);
41 }
42
43
44 void MciStop()
45 {
46 mciSendString("stop myplayer",NULL,0,NULL);
47 }
48
49 int MciStatus()
50 {
51 char buf[256];
52 mciSendString("status myplayer mode",buf,sizeof(buf),NULL);
53 if (strcmp(buf ,"stopped")==0) return mci_stopped;
54 if (strcmp(buf ,"playing")==0) return mci_play;
55 return mci_default;
56 }
57
58
59 // ---------------------
60 // mciSendCommand ver.
61
62 MCIDEVICEID id;
63 HWND hWnd;
64
65
66 void mciEnd()
67 {
68 if(openC) mciSendCommand( id,
69 MCI_CLOSE,MCI_WAIT,(DWORD)NULL);
70
71 openS =FALSE;
72 }
73
74 void mciOpen(char *file, HWND hwnd)
75 {
76 hWnd =hwnd;
77 if(openC){
78 mciEnd();
79 openC =FALSE;
80 }
81 MCI_OVLY_OPEN_PARMS stOpenParams;
82 DWORD ret;
83
84 stOpenParams.lpstrElementName=file; // �t�@�C����
85 stOpenParams.hWndParent=hwnd; // �e�E�B���h�E���n���h��
86 stOpenParams.dwStyle=WS_CHILD|WS_BORDER; // ���������E�B���h�E���^�C�v
87 // �I�[�v��
88 ret =mciSendCommand(0,
89 MCI_OPEN,
90 MCI_WAIT|MCI_OPEN_ELEMENT|MCI_ANIM_OPEN_PARENT|MCI_ANIM_OPEN_WS|MCI_NOTIFY ,
91 (DWORD)(LPVOID)&stOpenParams);
92 // �f�o�C�X�h�c������
93 id =stOpenParams.wDeviceID;
94 if(ret ==0) openC =TRUE;
95 }
96
97 void mciPlay()
98 {
99 MCI_PLAY_PARMS strPlayParams;
100 mciSendCommand( id,
101 MCI_PLAY,MCI_NOTIFY,(DWORD)&hWnd);
102 }
103
104
105 void mciStop()
106 {
107 mciSendCommand( id,
108 MCI_STOP,MCI_WAIT,(DWORD)NULL);
109 }
110
111

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision
svn:mime-type text/plain

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26