Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

ExecuteMCICommand - Executing a MCI command

Total Hit ( 2890)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
<System.Runtime.InteropServices.DllImport("winmm.dll")> Shared Function _
  mciSendString(ByVal lpstrCommand As String, ByVal lpstrReturnString As _
  String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As _
  Integer
End 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
' device

Sub 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 If
End Sub

' helper custom exception
' motes: requires the GetMCIErrorString function

Class MCICommandException
  Inherits Exception

  Public Sub New(ByVal errorCode As Integer)
    MyBase.New(GetMCIErrorString(errorCode))
  End Sub
End Class


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.