Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

MMengine.dll (MultiMedia MCI encapsulation)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Patrice Terrier
    replied
    In order to use the MMENEGINE.DLL,
    change these in your WIN32API.INC
    Code:
    TYPE MIXERLINE
      cbStruct AS DWORD          'size of MIXERLINE structure
      dwDestination AS DWORD     'zero based destination index
      dwSource AS DWORD          'zero based source index (if source)
      dwLineID AS DWORD          'unique line id for mixer device
      fdwLine AS DWORD           'state/information about line
      dwUser AS DWORD            'driver specific information
      dwComponentType AS DWORD   'component type line connects to
      cChannels AS DWORD         'number of channels line supports
      cConnections AS DWORD      'number of connections (possible)
      cControls AS DWORD         'number of controls at this line
      szShortName AS ASCIIZ * %MIXER_SHORT_NAME_CHARS
      szName AS ASCIIZ * %MIXER_LONG_NAME_CHARS
      'lpTarget AS Target                   ' Patrice
    'END TYPE                               ' Patrice
      dwType AS DWORD                       ' Patrice
      dwDeviceID AS DWORD                   ' Patrice
      wMid  AS INTEGER                      ' Patrice
      wPid AS INTEGER                       ' Patrice
      vDriverVersion AS DWORD               ' Patrice
      szPname As ASCIIZ * %MAXPNAMELEN      ' Patrice
    END TYPE
    
    TYPE MIXERCONTROL
      cbStruct AS DWORD            'size in Byte of MIXERCONTROL
      dwControlID AS DWORD         'unique control id for mixer device
      dwControlType AS DWORD       'MIXERCONTROL_CONTROLTYPE_xxx
      fdwControl AS DWORD          'MIXERCONTROL_CONTROLF_xxx
      cMultipleItems AS DWORD      'if MIXERCONTROL_CONTROLF_MULTIPLE set
      szShortName AS ASCIIZ * %MIXER_SHORT_NAME_CHARS
      szName AS ASCIIZ * %MIXER_LONG_NAME_CHARS
      'Bounds AS pbBounds
      'Metrics AS pbMetrics
      lMinimum AS LONG                      ' Patrice Minimum value
      lMaximum AS LONG                      ' Patrice Maximum value
      reserved(10) AS LONG                  ' Patrice reserved structure space
    END TYPE
    
    TYPE MIXERLINECONTROLS
      cbStruct AS DWORD              'size in Byte of MIXERLINECONTROLS
      dwLineID AS DWORD              'line id (from MIXERLINE.dwLineID)
      'item AS DWORD                  'dwControlID or dwControlType
      dwControl AS DWORD                     'Patrice dwControlID or dwControlType 
      cControls AS DWORD             'count of controls pmxctrl points to
      cbmxctrl AS DWORD              'size in Byte of _one_ MIXERCONTROL
      pamxctrl AS MIXERCONTROL PTR   'pointer to first MIXERCONTROL array
    END TYPE
    
    DECLARE SUB CopyMemory LIB "KERNEL32.DLL" ALIAS "RtlMoveMemory" (lpDest AS ANY, lpSource AS ANY, BYVAL cbMove AS DWORD)


    ------------------
    Patrice Terrier
    mailto[email protected][email protected]</A>

    Leave a comment:


  • Patrice Terrier
    started a topic MMengine.dll (MultiMedia MCI encapsulation)

    MMengine.dll (MultiMedia MCI encapsulation)

    Code:
    '+--------------------------------------------------------------------------+
    '|                                                                          |
    '|                                MMengine                                  |
    '|                                                                          |
    '|                      MultiMedia MCI encapsulation                        |
    '|                                                                          |
    '|                              Version 1.00                                |
    '|                                                                          |
    '+--------------------------------------------------------------------------+
    '|                                                                          |
    '|                         Author Patrice TERRIER                           |
    '|            8 Domaine de Rochagnon. 38800 Champagnier  FRANCE             |
    '|                       [url="http://www.zapsolution.com"]http://www.zapsolution.com[/url]                          |
    '|                    E-mail: [email protected]                      |
    '|                                                                          |
    '|                   copyright (c) 2000 Patrice TERRIER                     |
    '|                                                                          |
    '+--------------------------------------------------------------------------+
    '|                  Project started on : 09-21-2000                         |
    '|                        Last revised : 10-01-2000                         |
    '+--------------------------------------------------------------------------+
    
    #COMPILE DLL "MMENGINE.DLL"
    
    ' ** Eliminate unnecessary macros
    %PB_CC32 = 1 ' WIN32API.INC
    
    #INCLUDE "WIN32API.INC"
    #INCLUDE "MMENGINE.INC"
    
    %PLAYING    =  3
    %PAUSED     =  2
    %STOPPED    =  1
    %NOT_OPENED = -1
    
    GLOBAL hInst&
    GLOBAL MM_hWnd&
    GLOBAL MM_from&
    GLOBAL MM_to& 
    GLOBAL MM_IsOpen&
    GLOBAL zTmp AS ASCIIZ * 256
    
    FUNCTION LibMain& (BYVAL DllInstance&, BYVAL Reason&, BYVAL Reserved&) EXPORT
    
        Ret& = %TRUE      
    
        SELECT CASE Reason&
      
        CASE %DLL_PROCESS_ATTACH ' DLL is attaching to the address space of the current process
    
             hInst& = DllInstance&
             CALL MMInit()
    
        CASE %DLL_THREAD_ATTACH  ' A new thread is being created in the current process.
    
        CASE %DLL_THREAD_DETACH  ' A thread is exiting cleanly.
         
      	 CALL MMSetAutoRepeat (0)
    	 CALL MMClose
    
        CASE %DLL_PROCESS_DETACH  ' The calling process is detaching the DLL from its address space.
    
    	 CALL MMSetAutoRepeat (0)
    	 CALL MMClose
    
        END SELECT
      
    LibExit:
        FUNCTION = Ret&
    
    END FUNCTION
    
    SUB MMInit() EXPORT
    '   These functions help you if you want to use the default device
    '   the parameter must be the device type like:
    '   MpegVideo, sequencer, avivideo, waveaudio,  videodisc
    
        IF MMGetDefaultDevice("MPEGVideo") <> "mciqtz.drv" THEN
         ' If Driver"mciqtz.drv" not the default device for type
         ' "MMVideo" then set mciqtz.drv as a default device
           CALL MMSetDefaultDevice("MPEGVideo", "mciqtz.drv")
         ' MMSetDefaultDevice "MPEGVideo", "mciqtz.drv"' this the most
         ' important device and it will receives calls mci.
         ' Some programs change this device like XING mpeg
         ' and if this occur you can not play all mutimedia files
         ' and you will have unexpected errors
        END IF
        IF MMGetDefaultDevice("Sequencer") <> "mciseq.drv" THEN
         ' If Driver"mciseq.drv" not the default device for type
         ' "sequencer" then set mciqtz.drv as a default device
           CALL MMSetDefaultDevice("Sequencer", "mciseq.drv")
        END IF
        IF MMGetDefaultDevice("AviVideo") <> "mciavi.drv" THEN
         ' If Driver"mciavi.drv" not the default device for type
         ' "avivideo" then set avivideo as a default device
           CALL MMSetDefaultDevice("AviVideo", "mciavi.drv")
        END IF
    END SUB
    
    FUNCTION MMOpen(BYVAL hWnd&, FilName$) EXPORT AS DWORD
    '   This function initializes a device to play the specified FilName$. 
    '   hWnd& correspond to the handle of the parent window.
    
        CALL GetShortPathName ((FilName$), zTmp, SIZEOF(zTmp))
        
        ShortPath$ = zTmp
        typeDevice$ = "MPEGVideo"
           
        Style& = %WS_CHILD OR %WS_VISIBLE
        cmdToDo$ = "Open " + zTmp + " Type " + typeDevice$ + " Alias MM" + _
                   " parent" + STR$(hWnd&) +" Style Child"' + STR$(Style&) 
    
        MM_hWnd& = hwnd& ' Store hWnd& in global buffer
        MM_from& = 0
        MM_to& = 0
        Ret??? = mciSendString((cmdToDo$), BYVAL %NULL, 0, BYVAL %NULL)
        IF Ret??? = 0 THEN
           MM_IsOpen& = -1
        END IF
        FUNCTION = Ret???
        
    END FUNCTION
    
    FUNCTION MMDeviceID() EXPORT AS DWORD
    '   This function retrieves the device identifier corresponding 
    '   to the name of an open device. 
    
        FUNCTION = mciGetDeviceID("MM")
    END FUNCTION
    
    FUNCTION MMGetTotalFrames() EXPORT AS LONG
    '   This function returns the number of frames in a multimedia file.
    
        CALL mciSendString("set MM time format frames", zTmp, SIZEOF(zTmp), BYVAL %NULL)
        Ret??? = mciSendString("status MM length", zTmp, SIZEOF(zTmp), BYVAL %NULL)
    
        IF Ret??? THEN
           FUNCTION = -1
        ELSE
           FUNCTION = CLNG(VAL(zTmp))
        END IF
    
    END FUNCTION
    
    FUNCTION MMGetTotalTimeByMS() EXPORT AS LONG
    '   This function returns the track length in minutes and seconds.
    
    '   Sets the time format to minutes, seconds.
    '   All commands that use position values will assume MS.
        CALL mciSendString("set MM time format ms", zTmp, SIZEOF(zTmp), BYVAL %NULL)
        Ret??? = mciSendString("status MM length", zTmp, SIZEOF(zTmp), BYVAL %NULL)
    
        IF Ret??? THEN
           FUNCTION = -1
        ELSE
           FUNCTION = CLNG(VAL(zTmp))
        END IF
    
    END FUNCTION
    
    FUNCTION MMPlay(BYVAL FromHere&, BYVAL ToThere&) EXPORT AS DWORD
    '   This function allows to play specific parts from within a multimeda file.
    
        TotalFrames& = MAX&(MMGetTotalFrames, 0)
        IF FromHere& = 0 AND ToThere& = 0 THEN
           MM_from& = 1
           MM_to& = TotalFrames&
        ELSEIF FromHere& AND ToThere& THEN
           MM_from& = FromHere&
           MM_to& = ToThere&
        ELSEIF FromHere& AND ToThere& = 0 THEN
           MM_from& = FromHere&
           MM_to& = TotalFrames&
        ELSEIF FromHere& = 0 AND ToThere& THEN
           MM_from& = 1
           MM_to& = ToThere&
        END IF
    
        cmdToDo$ = "Play MM from" + STR$(MM_from&) + " to" + STR$(MM_to&)
    
        FUNCTION = mciSendString((cmdToDo$), BYVAL %NULL, 0, BYVAL %NULL)
    
    END FUNCTION
    
    FUNCTION MMClose() EXPORT AS DWORD
    '   This function closes an open multimedia device.
    
        IF MM_IsOpen& THEN
           CALL MMStop
           '*'CALL apiSLEEP(200)
           FUNCTION = mciSendString("Close MM", BYVAL %NULL, 0, BYVAL %NULL)
           '*'CALL apiSLEEP(300)
           MM_IsOpen& = 0
        END IF
    END FUNCTION
    
    FUNCTION MMStop() EXPORT AS DWORD
    '   This function stops playing of a multimedia file.
    
        FUNCTION = mciSendString("Stop MM", BYVAL %NULL, 0, BYVAL %NULL)
    END FUNCTION
    
    FUNCTION MMPause() EXPORT AS DWORD
    '   This function pauses playing of a multimedia file.
    
        FUNCTION = mciSendString("Pause MM", BYVAL %NULL, 0, BYVAL %NULL)
    END FUNCTION
    
    FUNCTION MMResume() EXPORT AS DWORD
    '   This function resumes playing of a multimedia file.
    
        FUNCTION = mciSendString("Resume MM", BYVAL %NULL, 0, BYVAL %NULL)
    END FUNCTION
    
    FUNCTION MMPutWindow(BYVAL xLeft&, BYVAL yTop&, BYVAL xWidth&, BYVAL yHeight&) EXPORT AS DWORD
    '   This function sets the VIDEO's window size and location
    '   using the provided coordinates.
    
        cmdToDo$ = "Put MM window at" + STR$(xLeft&) + STR$(yTop&) + str$(xWidth&) + str$(yHeight&)
        FUNCTION = mciSendString((cmdToDo$), BYVAL %NULL, 0, BYVAL %NULL)
    
    END FUNCTION
    
    FUNCTION MMMove(ToThere&) EXPORT AS DWORD
    '   This function moves the current read/play position 
    '   to the specified ToThere& location.
    
        cmdToDo$ = "Seek MM to" + STR$(ToThere&)
        FUNCTION = mciSendString((cmdToDo$), BYVAL %NULL, 0, BYVAL %NULL)
        CALL mciSendString("Play MM", BYVAL %NULL, 0, BYVAL %NULL)
    
    END FUNCTION
    
    FUNCTION MMGetStatus() EXPORT AS LONG
    '   This function returns the current status of an open multimedia file.
    
        CALL mciSendString("Status MM mode", zTmp, SIZEOF(zTmp), BYVAL %NULL)
        SELECT CASE LCASE$(zTmp)
        CASE "playing"
             FUNCTION = %MM_PLAYING
        CASE "paused"
             FUNCTION = %MM_PAUSED
        CASE "stopped"
             FUNCTION = %MM_STOPPED
        CASE ELSE
             FUNCTION = 0
        END SELECT
    
    END FUNCTION
    
    FUNCTION MMGetCurrentPos() EXPORT AS LONG
    '   This function returns the current pos location in an open multimedia file.
    
        Ret??? = mciSendString("Status MM position", zTmp, SIZEOF(zTmp), BYVAL %NULL)
        IF Ret??? THEN
           FUNCTION = -1
        ELSE
           FUNCTION = CLNG(VAL(zTmp))
        END IF
    
    END FUNCTION
    
    FUNCTION MMGetPercent() EXPORT AS LONG
    '   This function returns the current pos as a percentage value.
        TotalFrames& = MAX&(MMGetTotalFrames, 0)
        CurrentPos& = MAX&(MMGetCurrentPos, 0)
        IF TotalFrames& AND CurrentPos& THEN
           FUNCTION = CLNG((CurrentPos& * 100) \ TotalFrames&)
        END IF
    END FUNCTION
    
    FUNCTION MMMoveAtPercent(Percent&) EXPORT AS DWORD
    '   This function moves the current read/play position 
    '   at the specified Percent& location.
        TotalFrames& = MAX&(MMGetTotalFrames, 0)
        IF Percent& = 100 THEN
           ToThere& = TotalFrames&
        ELSE
           ToThere& = CLNG(TotalFrames& / 100) * Percent&
        END IF
        FUNCTION = MMMove(ToThere&)
    
    END FUNCTION
    
    FUNCTION MMGetFramesPerSecond() EXPORT AS LONG
    '   This function returns the number of frames per second.
    
        TotalTime& = MAX&(MMGetTotalTimeByMS, 0)
        TotalFrames& = MAX&(MMGetTotalFrames, 0)
        IF TotalFrames& = 0 OR TotalTime& = 0 THEN
           FUNCTION = -1
        ELSE
           FUNCTION = CLNG(TotalFrames& / (TotalTime& / 1000))
        END IF
    
    END FUNCTION
    
    FUNCTION MMAreAtEnd() EXPORT AS LONG
    '   This function test for the current play location
    '   It returns TRUE if the END has been reached
    '   Else it returns FALSE.
    
        CurrentPos& = MMGetCurrentPos
        IF CurrentPos& > -1 THEN
           IF MM_to& <= CurrentPos& THEN FUNCTION = -1 
        END IF
    
    END FUNCTION
    
    FUNCTION MMTimerProc(BYVAL hWnd&, BYVAL Msg&, BYVAL idEvent&, BYVAL dwTime&) AS LONG
    '   Private function being used by MMSetAutoRepeat
    
        IF MMAreAtEnd THEN CALL MMPlay (MM_from&, MM_to&)
        
    END FUNCTION
    
    SUB MMSetAutoRepeat(BYVAL Autorep&) STATIC EXPORT
    '   This subroutine switches the autorepeat mode to ON or OFF.
    
        IF Autorep& THEN
           MMTimerIs& = SetTimer(%NULL , 0, 100, CodePtr(MMTimerProc))
        ELSE
           IF MMTimerIs& THEN CALL KillTimer(%NULL, MMTimerIs&): MMTimerIs& = 0
        END IF
        
    END SUB
    
    FUNCTION MMGetDefaultDevice(BYVAL typeDevice$) EXPORT AS STRING
    '   This function gets the default device for a typeDevice$.
    
        DIM zDevice AS ASCIIZ * 256
    
        CALL GetWindowsDirectory(zTmp, SIZEOF(zTmp))
        zTmp = RTRIM$(zTmp, ANY CHR$(0,92)) + "\system.ini"
    
        CALL GetPrivateProfileString("MCI", (typeDevice$), "None", zDevice, SIZEOF(zDevice), zTmp)
        FUNCTION = LCASE$(zDevice)
        
    END FUNCTION
    
    SUB MMSetDefaultDevice(BYVAL typeDevice$, BYVAL drvDefaultDevice$) EXPORT
    '   This subroutine updates SYSTEM.INI with the provided typeDevice$
    
        CALL GetWindowsDirectory(zTmp, SIZEOF(zTmp))
        zTmp = RTRIM$(zTmp, ANY CHR$(0,92)) + "\system.ini"
        CALL WritePrivateProfileString("MCI", (typeDevice$), (drvDefaultDevice$), zTmp)
    
    END SUB
    
    FUNCTION MMErrorMsg(BYVAL Ret???) EXPORT AS STRING
    '   This function returns a detailed MCI error string.
        CALL mciGetErrorString(Ret???, zTmp, SIZEOF(zTmp))
        FUNCTION = zTmp
    END FUNCTION
    
    FUNCTION MMSetMasterVolume(BYVAL hmixer&, mxc AS MIXERCONTROL, BYVAL volume&) EXPORT AS LONG
    '   This function sets the value for a volume control. 
    '   Returns True if successful
    
        DIM mxcd AS MIXERCONTROLDETAILS
        DIM vol AS MIXERCONTROLDETAILS_UNSIGNED
    
        Volume& = MAX&(MIN&(Volume&, 100), 0) * 655
    
        mxcd.item = 0
        mxcd.dwControlID = mxc.dwControlID
        mxcd.cbStruct = SIZEOF(mxcd)
        mxcd.cbDetails = SIZEOF(vol)
    
      ' Allocate a buffer for the control value buffer
        hmem& = GlobalAlloc(&H40, SIZEOF(vol))
        mxcd.paDetails = GlobalLock(hmem&)
        mxcd.cChannels = 1
        vol.dwValue = volume&
    
      ' Copy the data into the control value buffer
        CALL CopyMemory (BYVAL mxcd.paDetails, vol, SIZEOF(vol))
    
      ' Set the control value
        rc& = mixerSetControlDetails(hmixer&, mxcd, %MIXER_SETCONTROLDETAILSF_VALUE)
    
        CALL GlobalFree (hmem&)
        IF rc& = %MMSYSERR_NOERROR THEN
           FUNCTION = %TRUE
        ELSE
           FUNCTION = %FALSE
        END IF
    END FUNCTION
    
    FUNCTION MMGetVolumeControl(BYVAL hmixer&, BYVAL componentType&, _
                                BYVAL ctrlType&, mxc AS MIXERCONTROL) EXPORT AS LONG
    '   This function attempts to obtain a mixer control.
    '   Returns True if successful.
    
        DIM mxlc AS MIXERLINECONTROLS
        DIM mxl  AS MIXERLINE
    
        mxl.cbStruct = SIZEOF(mxl)
        mxl.dwComponentType = componentType&
    
      ' The mixerGetLineInfo function retrieves information about a specific 
      ' line of a mixer device.
        rc& = mixerGetLineInfo(hmixer&, mxl, %MIXER_GETLINEINFOF_COMPONENTTYPE)
    
        FUNCTION = %False
        IF rc& = %MMSYSERR_NOERROR THEN
           mxlc.cbStruct = SIZEOF(mxlc)
           mxlc.dwLineID = mxl.dwLineID
           mxlc.dwControl = ctrlType&
           mxlc.cControls = 1
           mxlc.cbmxctrl = SIZEOF(mxc)
    
         ' Allocate a buffer for the control
           hMem& = GlobalAlloc(&H40, SIZEOF(mxc))
           mxlc.pamxctrl = GlobalLock(hMem&)
           mxc.cbStruct = SIZEOF(mxc)
    
         ' The mixerGetLineControls function retrieves one or more controls 
         ' associated with an audio line.
           rc& = mixerGetLineControls(hmixer&, mxlc, %MIXER_GETLINECONTROLSF_ONEBYTYPE)
    
           IF rc& = %MMSYSERR_NOERROR THEN
              FUNCTION = %True
            ' Copy the control into the destination structure
              CALL CopyMemory(mxc, BYVAL mxlc.pamxctrl, SIZEOF(mxc))
           END IF
           CALL GlobalFree (hmem&)
        END IF
    END FUNCTION
    
    FUNCTION MMGetMasterVolume(BYVAL hmix&, mxc AS MIXERCONTROL) EXPORT AS LONG
    '   This function gets the value for a volume control. 
    '   Returns True if successful
    
        DIM md AS MIXERCONTROLDETAILS
      ' Get the volume control
        ok& = MMGetVolumeControl(hmix&, _
                                 %MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, _
                                 %MIXERCONTROL_CONTROLTYPE_VOLUME, _
                                 mxc)
        md.cbStruct = SIZEOF(md)
        md.dwControlID = mxc.dwControlID
        md.cChannels = 1
        md.item = 0
    
        Volume& = 0
        md.cbDetails = SIZEOF(Volume&)
        md.paDetails = VARPTR(Volume&)
    
        rc& = mixerGetControlDetails(hmix&, md, %MIXER_GETCONTROLDETAILSF_VALUE)
        
        FUNCTION = CLNG((Volume& / 65535) * 100)
    
    END FUNCTION
    
    FUNCTION MMFreeze() EXPORT AS DWORD
    '   The freeze command freezes video input or video output on a VCR or disables 
    '   video acquisition to the frame buffer. 
    '   Digital-video, video-overlay, and VCR devices recognize this command. 
    
        CALL mciSendString("Capability MM can freeze", zTmp, SIZEOF(zTmp), BYVAL %NULL)
        IF LCASE$(zTmp) = "true" THEN
           cmdToDo$ = "Freeze MM output wait"
           FUNCTION = mciSendString((cmdToDo$), BYVAL %NULL, 0, BYVAL %NULL)
        ELSE
           FUNCTION = %MCIERR_UNSUPPORTED_FUNCTION
        END IF
    
    END FUNCTION
    
    FUNCTION MMUnFreeze() EXPORT AS DWORD
    '   The MMUnFreeze command reenables video acquisition to the frame buffer after 
    '   it has been disabled by the freeze command. 
    '   Digital-video, video-overlay, and VCR devices recognize this command.
    
        CALL mciSendString("Capability MM can freeze", zTmp, SIZEOF(zTmp), BYVAL %NULL)
        IF LCASE$(zTmp) = "true" THEN
           cmdToDo$ = "Unfreeze MM wait"
           FUNCTION = mciSendString((cmdToDo$), BYVAL %NULL, 0, BYVAL %NULL)
        ELSE
           FUNCTION = %MCIERR_UNSUPPORTED_FUNCTION
        END IF
    
    END FUNCTION
    
    FUNCTION MMGetSize(xWidth&, yHeight&) EXPORT AS DWORD
    '   This function gets the media's width and height sizes.
    '   Returns Error code if unsuccessful
        
        Ret??? = mciSendString("Where MM source", zTmp, SIZEOF(zTmp), BYVAL %NULL)
        IF Ret??? THEN
           xWidth& = 0: yHeight& = 0
        ELSE
           Coordinate$ = TRIM$(zTmp)
           xWidth& = VAL(PARSE$(Coordinate$, " ", 3))
           yHeight& = VAL(PARSE$(Coordinate$, " ", 4))
        END IF
        
    END FUNCTION
    
    FUNCTION MMGetLocation(xLeft&, yTop&, xWidth&, yHeight&) EXPORT AS DWORD
    '   This function returns the media's window coordinates.
    '   Returns Error code if unsuccessful
    
        Ret??? = mciSendString("Where MM window", zTmp, SIZEOF(zTmp), BYVAL %NULL)
        IF Ret??? THEN
           xLeft& = 0: yTop& = 0: xWidth& = 0: yHeight& = 0
        ELSE
           Coordinate$ = TRIM$(zTmp)
           xLeft& = VAL(PARSE$(Coordinate$, " ", 1))
           yTop& = VAL(PARSE$(Coordinate$, " ", 2))
           xWidth& = VAL(PARSE$(Coordinate$, " ", 3))
           yHeight& = VAL(PARSE$(Coordinate$, " ", 4))
        END IF
    
    END FUNCTION
    
    FUNCTION MMGetWindowHandle (hWnd&) EXPORT AS DWORD
    '   This function returns the handle of the window being used to display video.
        
        Ret??? = mciSendString("Status MM window handle", zTmp, SIZEOF(zTmp), BYVAL %NULL)
        IF Ret??? = 0 THEN
           hWnd& = VAL(zTmp)
        ELSE
           hWnd& = 0
        END IF
        FUNCTION = Ret???
        
    END FUNCTION    
    
    'FUNCTION MMCapture(BYVAL FilName$, BYVAL xL&, BYVAL yT&, BYVAL xW&, BYVAL yH&) EXPORT AS DWORD
    ''   This function copies the content of the frame buffer and stores it 
    ''   in the specified file. 
    ''   Returns Error code if unsuccessful
    '    IF xL& OR yT& OR xW& OR yH& THEN
    '       AtLocation$ = " at" + STR$(xL&) + STR$(yT&) + STR$(xW&) + STR$(yH&)
    '    END IF
    '    cmdToDo$ = "Capture MM as " + FilName$ + AtLocation$
    '    FUNCTION = mciSendString((CmdToDo$), BYVAL %NULL, 0, BYVAL %NULL)
    '
    'END FUNCTION
    **************************************************************
    INCLUDE FILE SECTION
    **************************************************************

    Code:
    '+--------------------------------------------------------------------------+
    '|                                                                          |
    '|                              MMengine.inc                                |
    '|                                                                          |
    '|                      MultiMedia MCI encapsulation                        |
    '|                                                                          |
    '|                              Version 1.00                                |
    '|                                                                          |
    '+--------------------------------------------------------------------------+
    '|                                                                          |
    '|                         Author Patrice TERRIER                           |
    '|            8 Domaine de Rochagnon. 38800 Champagnier  FRANCE             |
    '|                       [url="http://www.zapsolution.com"]http://www.zapsolution.com[/url]                          |
    '|                    E-mail: [email protected]                      |
    '|                                                                          |
    '|                   copyright (c) 2000 Patrice TERRIER                     |
    '|                                                                          |
    '+--------------------------------------------------------------------------+
    '|                  Project started on : 09-21-2000                         |
    '|                        Last revised : 10-01-2000                         |
    '+--------------------------------------------------------------------------+
    '
    'MMENGINE.INC
    '
    DECLARE FUNCTION MMOpen LIB "MMENGINE.DLL" (BYVAL hWnd&, FilName$) AS DWORD
    DECLARE FUNCTION MMPlay LIB "MMENGINE.DLL" (BYVAL FromHere&, BYVAL ToThere&) AS DWORD
    DECLARE FUNCTION MMGetTotalFrames LIB "MMENGINE.DLL" () AS LONG
    DECLARE FUNCTION MMGetTotalTimeByMS LIB "MMENGINE.DLL" () AS LONG
    DECLARE FUNCTION MMClose LIB "MMENGINE.DLL" () AS DWORD
    DECLARE FUNCTION MMStop LIB "MMENGINE.DLL" () AS DWORD
    DECLARE FUNCTION MMPause LIB "MMENGINE.DLL" () AS DWORD
    DECLARE FUNCTION MMResume LIB "MMENGINE.DLL" () AS DWORD
    DECLARE FUNCTION MMPutWindow LIB "MMENGINE.DLL" (BYVAL xLeft&, BYVAL yTop&, BYVAL xWidth&, BYVAL yHeight&) AS DWORD
    DECLARE FUNCTION MMMove LIB "MMENGINE.DLL" (ToThere&) AS DWORD
    DECLARE FUNCTION MMGetStatus LIB "MMENGINE.DLL" () AS LONG
    DECLARE FUNCTION MMGetCurrentPos LIB "MMENGINE.DLL" () AS LONG
    DECLARE FUNCTION MMGetPercent LIB "MMENGINE.DLL" () AS LONG
    DECLARE FUNCTION MMGetFramesPerSecond LIB "MMENGINE.DLL" () AS LONG
    DECLARE FUNCTION MMAreAtEnd LIB "MMENGINE.DLL" () AS LONG
         DECLARE SUB MMSetAutoRepeat LIB "MMENGINE.DLL" (BYVAL Autorep&)
    DECLARE FUNCTION MMGetDefaultDevice LIB "MMENGINE.DLL" (BYVAL typeDevice$) AS STRING
         DECLARE SUB MMSetDefaultDevice LIB "MMENGINE.DLL" (BYVAL typeDevice$, BYVAL drvDefaultDevice$)
         DECLARE SUB MMInit LIB "MMENGINE.DLL" ()
    DECLARE FUNCTION MMDeviceID LIB "MMENGINE.DLL" () AS DWORD
    DECLARE FUNCTION MMFreeze LIB "MMENGINE.DLL" () AS DWORD
    DECLARE FUNCTION MMUnFreeze LIB "MMENGINE.DLL" () AS DWORD
    DECLARE FUNCTION MMErrorMsg$ LIB "MMENGINE.DLL" (BYVAL Ret???)
    DECLARE FUNCTION MMGetSize LIB "MMENGINE.DLL" (xWidth&, yHeight&) AS DWORD
    DECLARE FUNCTION MMMoveAtPercent LIB "MMENGINE.DLL" (Percent&) AS DWORD
    DECLARE FUNCTION MMGetLocation LIB "MMENGINE.DLL" (xLeft&, yTop&, xWidth&, yHeight&) AS DWORD
    DECLARE FUNCTION MMGetWindowHandle LIB "MMENGINE.DLL" (hWnd&) AS DWORD
    'DECLARE FUNCTION MMCapture LIB "MMENGINE.DLL" (BYVAL FilName$, BYVAL xL&, BYVAL yT&, BYVAL xW&, BYVAL yH&) AS DWORD
    
    DECLARE FUNCTION MMGetMasterVolume LIB "MMENGINE.DLL" (ByVal hmixer&, mxc AS MIXERCONTROL) AS LONG
    DECLARE FUNCTION MMGetVolumeControl LIB "MMENGINE.DLL" (BYVAL hmixer&, BYVAL componentType&, BYVAL ctrlType&, mxc AS MIXERCONTROL) AS LONG
    DECLARE FUNCTION MMSetMasterVolume LIB "MMENGINE.DLL" (BYVAL hmixer&, mxc AS MIXERCONTROL, BYVAL volume&) AS LONG
    
    %MM_PLAYING = 3
    %MM_PAUSED  = 2
    %MM_STOPPED = 1
    ------------------
    Patrice Terrier
    mailto[email protected][email protected]</A>

    [This message has been edited by Patrice Terrier (edited June 01, 2003).]
Working...
X