Help😠 Splash Screen W/ Sound

Posts 1–15 of 17 · Page 1 of 2
😠 Splash Screen W/ Sound
Im having a hell of a time trying to get sound to play ALONG with my splash screen.

What i want to happen is when the application starts and the splash screen pops up, to have a .wav file play (And not by opening iTunes to play it........................) Regardless of the .wav length or splash screen duration, i can edit the sound to be the length i want. Ive tried tons of code but none of it seems to work because its either outdated or opens iTunes to play the sound... Help me PLS!!!!!!!!!!
Code:
Dim Sound As New System.Media.SoundPlayer()
Sound.SoundLocation = "your path to the .wav file"  'ex.: c:\mysound.wav
Sound.Load()
Sound.Play()
Quote Originally Posted by Biesi View Post
Code:
Dim Sound As New System.Media.SoundPlayer()
Sound.SoundLocation = "your path to the .wav file"  'ex.: c:\mysound.wav
Sound.Load()
Sound.Play()
I love you

Dont know why i couldn't find that during my research XD
my.computer.audio.play(my.resources.SongName, AudioPlayBackMode.Whatever)
Quote Originally Posted by wut12345 View Post
my.computer.audio.play(my.resources.SongName, AudioPlayBackMode.Whatever)
Already fixed by first response. @Biesi Thank you for your help! @Jorndel Request Solved and close.
Quote Originally Posted by wut12345 View Post
my.computer.audio.play(my.resources.SongName, AudioPlayBackMode.Whatever)
better not to use My. tho
I have another question and sense this is still open ill ask here instead of making a new thread :P

@Biesi I have a program waiting for hotkey presses, everything works fine except i need the program to detect the hotkey press and execute the code when the form is NOT FOCUSED. Ive looked around and found stuff on loops but i see cons about that because that generally causes the application to have a high CPU rate like 50% 0.o

I need the program to detect hotkeys when it in the background/minimized/not focused. While another program has the focus (EX:Games)

This is a snippet of the code i have that works when the application/form is IN FOCUS. Code is JUST the hotkey functions, i removed the executed code for simplicity.

Code:
Public Class Form1

    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Integer
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Dim hotkey As Boolean
        hotkey = GetAsyncKeyState(Keys.F5)
        If hotkey = True Then
                'Code ran after hotkey detected
        End If
        Dim hotkey1 As Boolean
        hotkey1 = GetAsyncKeyState(Keys.F6)
        If hotkey1 = True Then
                'Code ran after hotkey detected
        End If
    End Sub
Quote Originally Posted by Renamon Toast Crunch View Post
I have another question and sense this is still open ill ask here instead of making a new thread :P

@Biesi I have a program waiting for hotkey presses, everything works fine except i need the program to detect the hotkey press and execute the code when the form is NOT FOCUSED. Ive looked around and found stuff on loops but i see cons about that because that generally causes the application to have a high CPU rate like 50% 0.o

I need the program to detect hotkeys when it in the background/minimized/not focused. While another program has the focus (EX:Games)

This is a snippet of the code i have that works when the application/form is IN FOCUS. Code is JUST the hotkey functions, i removed the executed code for simplicity.

Code:
Public Class Form1

    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Integer
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Dim hotkey As Boolean
        hotkey = GetAsyncKeyState(Keys.F5)
        If hotkey = True Then
                'Code ran after hotkey detected
        End If
        Dim hotkey1 As Boolean
        hotkey1 = GetAsyncKeyState(Keys.F6)
        If hotkey1 = True Then
                'Code ran after hotkey detected
        End If
    End Sub
Unclean code = bad
Quote Originally Posted by wut12345 View Post
Unclean code = bad
1dahell is unclean about this?
google for RegisterHotkey
When you capture the hotkey, run an if/then like this
Code:
        If Me.Focused = false Then
             ''//code
        End If
If you declare a bool in a timer, it'll just repeat the code over and over.. and over
Quote Originally Posted by DawgiiStylz View Post
If you declare a bool in a timer, it'll just repeat the code over and over.. and over
If you're talking about my code, it works fine. You run the bool under the if/then for the hotkey, that way it will only run when the key is pressed.
but if you're wanting to use hotkeys without the form being focused, RegisterHotkey API is one way to go. Its simple
Posts 1–15 of 17 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us