Click here to Skip to main content
15,887,350 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Problem related to multiline textbox Pin
Eddy Vluggen29-Mar-09 7:33
professionalEddy Vluggen29-Mar-09 7:33 
AnswerRe: Problem related to multiline textbox Pin
Luc Pattyn29-Mar-09 6:55
sitebuilderLuc Pattyn29-Mar-09 6:55 
AnswerRe: Problem related to multiline textbox Pin
dineshrajputglobal29-Mar-09 22:55
dineshrajputglobal29-Mar-09 22:55 
QuestionUse { and & _ in string.Format Pin
mehrdadc4828-Mar-09 20:43
mehrdadc4828-Mar-09 20:43 
AnswerRe: Use { and & _ in string.Format Pin
Henry Minute28-Mar-09 23:43
Henry Minute28-Mar-09 23:43 
QuestionVisual Basic integration to SAP though RFC [modified] Pin
yog211228-Mar-09 7:33
yog211228-Mar-09 7:33 
AnswerRe: Visual Basic integration to SAP though RFC Pin
Dave Kreskowiak28-Mar-09 12:43
mveDave Kreskowiak28-Mar-09 12:43 
QuestionWHY MCISENDSTRING DOESN'T PLAY THE FILE? Pin
JUNEYT28-Mar-09 1:52
JUNEYT28-Mar-09 1:52 
Hi,

I am tryign to play a MP3 file via mcisendtring. However, it doesn't play anything. I couldn't figure out what is causing it. It doesn't give me any error message and it doesn't play it also. If you know the problem, would you please let me know.

Thank you.


Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows.Forms
Imports System.Runtime.InteropServices

Public Class Player


    Private isOpen As Boolean = False
    Private GetFileName As String = Nothing

    'mciSendString 
    <[DllImport]("winmm.dll")> _
    Private Shared Function mciSendString(ByVal command As String, ByVal ReturnValue As StringBuilder, _
                                          ByVal returnLength As Integer, ByVal winHandle As IntPtr) As Long
    End Function

    'This procedure closes the playing media file

    Public Sub ClosePlayer()

        If (isOpen) Then

            Dim PlayCommand As String = "Close " + GetFileName

            mciSendString(PlayCommand, Nothing, 0, IntPtr.Zero)
            isOpen = False

        End If

    End Sub

    'This procedure will open the media file

    Private Sub OpenMediaFile()

        ClosePlayer()
        Dim PlayCommand As String = "open \""" + GetFileName + " \ "" type mpegvideo alias MediaFile"

        mciSendString(PlayCommand, Nothing, 0, IntPtr.Zero)
        isOpen = True

    End Sub

    'This sub procedure will play the media file
    '
    Private Sub PlayMediaFile()

        If (isOpen) Then
            Dim PlayCommand As String = "play " + GetFileName
            mciSendString(PlayCommand, Nothing, 0, 0)
        End If

    End Sub

    'This sub procedure will initiate playing

    Public Sub Play(ByVal FileName As String)

        GetFileName = fileName
        OpenMediaFile()
        PlayMediaFile()

    End Sub

    'this procedure will pause the file
    '
    Public Sub Pause()
        mciSendString("pause " + GetFileName, Nothing, 0, IntPtr.Zero)
    End Sub

    'This sub procedure will resume the file
    '
    Public Sub Resumit()
        mciSendString("resume " + GetFileName, Nothing, 0, 0)
    End Sub


End Class



Dim playclass as new Player
    playclass.play("hello.mp3") 


What a curious mind needs to discover knowledge is noting else than a pin-hole.


AnswerRe: WHY MCISENDSTRING DOESN'T PLAY THE FILE? Pin
Alan N28-Mar-09 5:17
Alan N28-Mar-09 5:17 
GeneralRe: WHY MCISENDSTRING DOESN'T PLAY THE FILE? Pin
JUNEYT28-Mar-09 6:31
JUNEYT28-Mar-09 6:31 
GeneralRe: WHY MCISENDSTRING DOESN'T PLAY THE FILE? Pin
Alan N28-Mar-09 7:06
Alan N28-Mar-09 7:06 
GeneralRe: WHY MCISENDSTRING DOESN'T PLAY THE FILE? Pin
JUNEYT28-Mar-09 21:54
JUNEYT28-Mar-09 21:54 
GeneralRe: WHY MCISENDSTRING DOESN'T PLAY THE FILE? Pin
Alan N28-Mar-09 22:41
Alan N28-Mar-09 22:41 
GeneralRe: WHY MCISENDSTRING DOESN'T PLAY THE FILE? Pin
Eddy Vluggen28-Mar-09 23:48
professionalEddy Vluggen28-Mar-09 23:48 
QuestionQuestion about .dll in VB.NET Pin
Xavious27-Mar-09 17:12
Xavious27-Mar-09 17:12 
AnswerRe: Question about .dll in VB.NET Pin
Dave Kreskowiak27-Mar-09 17:58
mveDave Kreskowiak27-Mar-09 17:58 
GeneralRe: Question about .dll in VB.NET Pin
Xavious27-Mar-09 22:00
Xavious27-Mar-09 22:00 
GeneralRe: Question about .dll in VB.NET Pin
Dave Kreskowiak28-Mar-09 12:39
mveDave Kreskowiak28-Mar-09 12:39 
Questionvb shell extension... Pin
drummerboy051127-Mar-09 6:49
professionaldrummerboy051127-Mar-09 6:49 
AnswerRe: vb shell extension... Pin
Dave Kreskowiak27-Mar-09 12:02
mveDave Kreskowiak27-Mar-09 12:02 
QuestionResetting the DMM by transmitting *RST command through MSComm control error Pin
gopalraja27-Mar-09 4:50
gopalraja27-Mar-09 4:50 
AnswerRe: Resetting the DMM by transmitting *RST command through MSComm control error Pin
Dave Kreskowiak27-Mar-09 11:59
mveDave Kreskowiak27-Mar-09 11:59 
GeneralRe: Resetting the DMM by transmitting *RST command through MSComm control error Pin
Luc Pattyn27-Mar-09 21:39
sitebuilderLuc Pattyn27-Mar-09 21:39 
GeneralRe: Resetting the DMM by transmitting *RST command through MSComm control error Pin
Dave Kreskowiak28-Mar-09 12:36
mveDave Kreskowiak28-Mar-09 12:36 
GeneralRe: Resetting the DMM by transmitting *RST command through MSComm control error Pin
Luc Pattyn28-Mar-09 13:10
sitebuilderLuc Pattyn28-Mar-09 13:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.