Click here to Skip to main content
15,881,413 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralHello Pin
Otekpo Emmanuel6-Sep-13 7:38
Otekpo Emmanuel6-Sep-13 7:38 
GeneralRequest Pin
Otekpo Emmanuel6-Sep-13 7:39
Otekpo Emmanuel6-Sep-13 7:39 
GeneralRe: Request Pin
Dave Kreskowiak6-Sep-13 14:31
mveDave Kreskowiak6-Sep-13 14:31 
AnswerRe: Disable/enable ctrl+alt+del buttons and autorun. Pin
Chris Quinn5-Sep-13 21:20
Chris Quinn5-Sep-13 21:20 
AnswerRe: Disable/enable ctrl+alt+del buttons and autorun. Pin
Eddy Vluggen6-Sep-13 9:26
professionalEddy Vluggen6-Sep-13 9:26 
QuestionDatabase connection using adodc control/autorun Pin
Otekpo Emmanuel5-Sep-13 13:57
Otekpo Emmanuel5-Sep-13 13:57 
AnswerRe: Database connection using adodc control/autorun Pin
Mycroft Holmes5-Sep-13 20:22
professionalMycroft Holmes5-Sep-13 20:22 
QuestionSound doesn't play instantly...but wait for next operation to complete!! Pin
Jayme653-Sep-13 3:17
Jayme653-Sep-13 3:17 
I've a big interrogation concerning sound playback (WMP.lib)!
This code should play a sound, then compute...but it computes then play the sound!

VB
Class MainWindow
    Dim writingPath As String = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "\_UI Sounds\"
    Dim uiPlayer As New WMPLib.WindowsMediaPlayer
    Private Sub MainWindow_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        RunTest()
    End Sub
    Private Sub RunTest()
        Debug.Print("Started!")
        uiPlayer.URL = writingPath & "son1.wav"
        uiPlayer.controls.play()
        '
        Dim a As Integer = 0
        For i As Integer = 0 To 999999999
            a = i
        Next
        Debug.Print("Done!")
    End Sub
End Class


I thought that I perhaps should run the sound in a thread to be sure that it's played by its own!?
But this gives the same result

VB
Imports System.Threading
Class MainWindow
    Dim writingPath As String = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "\_UI Sounds\"
    Dim uiPlayer As New WMPLib.WindowsMediaPlayer
    Dim uiThread As Thread = New Thread(AddressOf PlayFile)
    Private Sub MainWindow_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        RunTest()
    End Sub
    Private Sub RunTest()
        uiThread = New Thread(AddressOf PlayFile)
        uiThread.Start()
        '
        Debug.Print("Started!")
        Dim a As Integer = 0
        For i As Integer = 0 To 999999999
            a = i
        Next
        Debug.Print("Done!")
    End Sub
    Private Sub PlayFile()
        uiPlayer.URL = writingPath & "son1.wav"
        uiPlayer.controls.play()
    End Sub
End Class


How should I please proceed to hear my sound 'instantly'?
What's my mistake?

Thanks for your help!!
AnswerRe: Sound doesn't play instantly...but wait for next operation to complete!! Pin
Richard Deeming3-Sep-13 3:53
mveRichard Deeming3-Sep-13 3:53 
AnswerRe: Sound doesn't play instantly...but wait for next operation to complete!! Pin
Bernhard Hiller3-Sep-13 23:08
Bernhard Hiller3-Sep-13 23:08 
GeneralRe: Sound doesn't play instantly...but wait for next operation to complete!! Pin
Jayme655-Sep-13 21:23
Jayme655-Sep-13 21:23 
QuestionLate Binding issue in Copy Objects of AutoCAD Pin
Adnan Siddiqi1-Sep-13 9:42
Adnan Siddiqi1-Sep-13 9:42 
AnswerRe: Late Binding issue in Copy Objects of AutoCAD Pin
Richard MacCutchan1-Sep-13 20:47
mveRichard MacCutchan1-Sep-13 20:47 
GeneralRe: Late Binding issue in Copy Objects of AutoCAD Pin
Adnan Siddiqi3-Sep-13 3:18
Adnan Siddiqi3-Sep-13 3:18 
QuestionUsing Directory.GetFiles() WITH multiple extensions AND sort order Pin
Jayme651-Sep-13 0:15
Jayme651-Sep-13 0:15 
AnswerRe: Using Directory.GetFiles() WITH multiple extensions AND sort order Pin
Eddy Vluggen1-Sep-13 1:59
professionalEddy Vluggen1-Sep-13 1:59 
AnswerRe: Using Directory.GetFiles() WITH multiple extensions AND sort order Pin
Eddy Vluggen2-Sep-13 3:16
professionalEddy Vluggen2-Sep-13 3:16 
QuestionHow to Run charmap.exe with a chosen font? Pin
Alan Burkhart31-Aug-13 1:41
Alan Burkhart31-Aug-13 1:41 
AnswerRe: How to Run charmap.exe with a chosen font? Pin
Dave Kreskowiak31-Aug-13 3:13
mveDave Kreskowiak31-Aug-13 3:13 
GeneralRe: How to Run charmap.exe with a chosen font? Pin
Alan Burkhart31-Aug-13 6:01
Alan Burkhart31-Aug-13 6:01 
GeneralRe: How to Run charmap.exe with a chosen font? Pin
Dave Kreskowiak31-Aug-13 8:27
mveDave Kreskowiak31-Aug-13 8:27 
AnswerRe: How to Run charmap.exe with a chosen font? Pin
TnTinMn2-Sep-13 5:52
TnTinMn2-Sep-13 5:52 
AnswerRe: How to Run charmap.exe with a chosen font? Pin
Marco Bertschi3-Sep-13 4:30
protectorMarco Bertschi3-Sep-13 4:30 
QuestionRandom Generator not Generating Pin
Zyndell29-Aug-13 9:55
Zyndell29-Aug-13 9:55 
SuggestionRe: Random Generator not Generating Pin
Richard MacCutchan29-Aug-13 21:17
mveRichard MacCutchan29-Aug-13 21:17 

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.