devxlogo

ExecuteMCICommand – Executing a MCI command

ExecuteMCICommand – Executing a MCI command

 Shared Function _    mciSendString(ByVal lpstrCommand As String, ByVal lpstrReturnString As _    String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As _    IntegerEnd Function' helper routine; executes a MCI command ' commandString is the command to execute' deviceAlreadyOpened must be set to true if the caller has already opened the ' deviceSub ExecuteMCICommand(ByVal commandString As String, ByVal deviceAlreadyOpened _    As Boolean)    Dim returnCode As Integer = mciSendString(commandString, vbNullString, 0, 0)    ' if the return code is not 0, an error occurred    If returnCode <> 0 Then        ' close the device if necessary        If deviceAlreadyOpened Then            commandString = "close AVIFile"            mciSendString(commandString, vbNullString, 0, 0)        End If        ' throw a custom exception        Throw New MCICommandException(returnCode)    End IfEnd Sub' helper custom exception' motes: requires the GetMCIErrorString functionClass MCICommandException    Inherits Exception    Public Sub New(ByVal errorCode As Integer)        MyBase.New(GetMCIErrorString(errorCode))    End SubEnd Class

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist