home *** CD-ROM | disk | FTP | other *** search
- #include <WINDOWS.H>
- #include <MMSYSTEM.H>
- #include <DIGITALV.H>
- #include "VIDEO.H"
-
- int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
- {
- // RudimentΣres Hauptprogramm
-
- FARPROC Procedure = MakeProcInstance ((FARPROC) DialogBoxProc, hInstance);
- DialogBox (hInstance, "DialogBox", NULL, (DLGPROC) Procedure);
- FreeProcInstance (Procedure);
- return (0);
- }
-
-
- BOOL FAR PASCAL DialogBoxProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
- {
- // Dialogfunktion zur Verwaltung der Buttons
-
- static BOOL FileOpen = FALSE;
- static WORD VideoDevice = 0;
-
- switch (message)
- {
- case WM_COMMAND:
- switch (wParam)
- {
- case ID_BUTTON_OPEN:
- if (! FileOpen)
- if (VideoDevice = OpenVideo ("D:\\DEMO.AVI", hDlg))
- FileOpen = TRUE;
- break;
-
- case ID_BUTTON_PLAY:
- PlayVideo (VideoDevice, hDlg);
- break;
-
- case ID_BUTTON_STOP:
- StopVideo (VideoDevice);
- break;
-
- case ID_BUTTON_CLOSE:
- CloseVideo (VideoDevice);
- FileOpen = FALSE;
- break;
-
- case ID_BUTTON_END:
- EndDialog (hDlg, TRUE);
- break;
- }
-
- break;
-
- case MM_MCINOTIFY: // Abspielen ist beendet, Video zurⁿcksetzen
- RewindVideo (VideoDevice);
- break;
- }
-
- return (FALSE);
- }
-
-
- WORD OpenVideo (char * Filename, HWND ParentWindow)
- {
- DWORD OpenFlags;
- MCI_DGV_OPEN_PARMS OpenParms;
-
- // 1.Ausfⁿllen der speziellen Struktur fⁿr ein MCI-Kommando...
- OpenParms.lpstrElementName = (LPSTR) Filename;
- OpenParms.dwStyle = WS_VISIBLE | WS_THICKFRAME;
- OpenParms.hWndParent = ParentWindow;
-
- // 2.Setzen ben÷tigter Flags...
- OpenFlags = MCI_OPEN_ELEMENT | MCI_DGV_OPEN_WS | MCI_DGV_OPEN_PARENT;
-
- if (! mciSendCommand (0, MCI_OPEN, OpenFlags, (DWORD) (LPVOID) & OpenParms))
- {
- // 4. Je nach Kommando Rⁿckgabewerte in der Struktur interpretieren
- return (OpenParms.wDeviceID);
- }
-
- else // Fehler
- {
- return (0);
- } // end of else
- }
-
-
- DWORD CloseVideo (WORD Device)
- {
- MCI_GENERIC_PARMS GenericParms;
-
- return (mciSendCommand (Device, MCI_CLOSE, 0L, (DWORD) (LPVOID) & GenericParms));
- }
-
-
- DWORD PlayVideo (WORD Device, HWND Window)
- {
- MCI_DGV_PLAY_PARMS PlayInfo;
-
- PlayInfo.dwCallback = (DWORD) Window;
-
- return (mciSendCommand (Device, MCI_PLAY, MCI_NOTIFY, (DWORD) (LPVOID) & PlayInfo));
- }
-
-
- DWORD StopVideo (WORD Device)
- {
- MCI_DGV_STOP_PARMS StopInfo;
-
- return (mciSendCommand (Device, MCI_STOP, 0L, (DWORD) (LPVOID) & StopInfo));
- }
-
-
- DWORD RewindVideo (WORD Device)
- {
- MCI_SEEK_PARMS SeekInfo;
-
- return (mciSendCommand (Device, MCI_SEEK, MCI_SEEK_TO_START, (DWORD) (LPVOID) & SeekInfo));
- }
-
-
-
-
-
-
-
-