Results 1 to 3 of 3

Thread: Am tryin my best... but

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2004
    Location
    uk liverpool
    Posts
    238

    Thumbs down Am tryin my best... but

    What am i doing wrong just wanna play a wav when form starts .any ideas. please.thanks

    paul


    Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long



    Private Sub Form_Load()
    Dim result As Integer
    result=sndplaysound (C:\My Documents\vbbooks\chimes1)
    End Sub

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    Try this quicky:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Const SND_ASYNC = &H1
    4. Private Const SND_FILENAME = &H20000
    5.  
    6. Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _
    7.     (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    8.  
    9. Private Sub Form_Load()
    10. Dim sFile$
    11.  
    12.     sFile = "C:\Windows\Media\chimes.wav"
    13.     If Not Dir(sFile) = "" Then
    14.         PlaySound sFile, ByVal 0&, SND_FILENAME Or SND_ASYNC
    15.     End If
    16.  
    17. End Sub

  3. #3
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    does this help
    VB Code:
    1. Private Const SND_APPLICATION = &H80         '  look for application specific association
    2. Private Const SND_ALIAS = &H10000     '  name is a WIN.INI [sounds] entry
    3. Private Const SND_ALIAS_ID = &H110000    '  name is a WIN.INI [sounds] entry identifier
    4. Private Const SND_ASYNC = &H1         '  play asynchronously
    5. Private Const SND_FILENAME = &H20000     '  name is a file name
    6. Private Const SND_LOOP = &H8         '  loop the sound until next sndPlaySound
    7. Private Const SND_MEMORY = &H4         '  lpszSoundName points to a memory file
    8. Private Const SND_NODEFAULT = &H2         '  silence not default, if sound not found
    9. Private Const SND_NOSTOP = &H10        '  don't stop any currently playing sound
    10. Private Const SND_NOWAIT = &H2000      '  don't wait if the driver is busy
    11. Private Const SND_PURGE = &H40               '  purge non-static events for task
    12. Private Const SND_RESOURCE = &H40004     '  name is a resource name or atom
    13. Private Const SND_SYNC = &H0         '  play synchronously (default)
    14. Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    15. Private Sub Form_Load()
    16.     'KPD-Team 2000
    17.     'URL: [url]http://www.allapi.net/[/url]
    18.     'E-Mail: [email][email protected][/email]
    19.     PlaySound "C:\WINDOWS\MEDIA\TADA.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC
    20. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width