Results 1 to 3 of 3

Thread: simple, but i need hints

  1. #1

    Thread Starter
    Addicted Member Ester's Avatar
    Join Date
    Feb 2001
    Posts
    148

    Wink

    hello there..
    im developing an applications that says "good morning/afternoon/evening/night" on startup, this might sound silly, but would anyone kindly give me the time limits that i can use in my program for morning, then the limit for afternoon, evening night
    #2 im actually a beginner when it comes to using multimedia with vb6, i know this is easy, but i never tried, how can we open a sound file and then close it after it finishes..ummm someone could possibly help by giving me hints for the code i need to use for the good morning/afternoon etc part..
    thx
    Tell whoever has sorrow,
    Grief shall never last
    Just as joy has no tommorow,
    Woe is bound not to last
    Estrelitta

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    Here is code to play a sound file

    Code:
    'module (Api Functions declarations)
    
    Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    
    Public Const SND_ALIAS = &H10000     '  name is a WIN.INI [sounds] entry
    Public Const SND_ASYNC = &H1         '  play asynchronously
    Public Const SND_LOOP = &H8         '  loop the sound until next sndPlaySound
    Public Const SND_NOWAIT = &H2000      '  don't wait if the driver is busy
    Public Const SND_SYNC = &H0         '  play synchronously (default)
    
    'Form code
    
    public sub cmdPlaysoundClick()
    
    dim ret as long
    ret=sndplaysound("c:\windows\bee.wav",SND_SYNC)
    
    End Sub
    Hope this helps
    TheBao

  3. #3
    Lively Member
    Join Date
    Jul 1999
    Posts
    99

    Smile

    on your form add a timer control. add this code:

    Code:
    Private Form_Load()
    Timer1.Interval = 1000
    Timer1.Enabled = True
    End Sub
    
    Private Sub Timer1_Timer()
    '// Add your code here to check the time and
    '// display message and play sound you like
    End Sub
    i did not include the complete code. you can figure it out. use the code above to play the sound. goodluck!

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