My.(bStr, AudioPlayMode.Background)ĭim bStr(My.) As Byte I've got two different Subs I'll be calling in an event, both are to play sound files. What is happening is that, when the event takes place, that is when the button is clicked, only one method is executed. However its more than one method be called within the event of when a button is clicked. It is working alright, I wrote these codes to play these files in a Sub method for it to be executed when called. I tried out a code to play files stored in the resource folder. NET applications (File, Resource, System sounds). This is an "all in one" Sound class for your. ' "SystemQuestion" ' "SystemExclaimation" ' "SystemHand" ' "Maximize" ' "MenuCommand" ' "MenuPopup" ' "Minimize" ' "MailBeep" ' "Open" ' "Close" ' "SystemAsterisk" ' "RestoreUp" ' "RestoreDown" ' "SystemExit" ' "SystemStart"Īll the job is done by the PlaySound function. Object, _īyVal e As System.EventArgs) Handles btnSystem.Click Sound.PlayWaveResource( " The Microsoft Sound.wav")Įnd Sub Private Sub btnSystem_Click( ByVal sender As System. ' Remeber to include the wave in the project ' and then in the "build action" ' properties set it as: "Embedded Resource" Object, _īyVal e As System.EventArgs) Handles btnEmbed.Click ' File Located in executable dir, change it if you needĮnd Sub Private Sub btnEmbed_Click( ByVal sender As System. Object, _īyVal e As System.EventArgs) Handles btnFile.Click Public Const SND_FILENAME = &H20000 ' name is file name Public Const SND_RESOURCE = &H40004 ' name is resource name or atomĮnd Class ' Using the code: Private Sub btnFile_Click( ByVal sender As System. Declare Auto Function PlaySound Lib " winmm.dll" ( ByVal name _Īs String, ByVal hmod As Integer, ByVal flags As Integer) As Integer Declare Auto Function PlaySound Lib " winmm.dll" ( ByVal name _Īs Byte(), ByVal hmod As Integer, ByVal flags As Integer) As Integer Public Const SND_SYNC = &H0 ' play synchronously Public Const SND_ASYNC = &H1 ' play asynchronously Public Const SND_MEMORY = &H4 ' Play wav in memory Public Const SND_ALIAS = &H10000 ' Play system alias wav Public Const SND_NODEFAULT = &H2
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |