CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Join Date
    Oct 2012
    Posts
    59

    How to add midi sound in vb6

    I want add 12 sounds in vb6. I dont know how and what components to use. Then when i do manage add the sounds i need eacht of sound play once depending of program answer. For example:

    I create 1 CSom button and SDtade button is zodiac answer.

    Code:
    If SDate.Caption = "Aries" Then
    CSom. play aries.midi
    end if
    If SDate.Caption = "Taurus" Then
    CSom. play taurus.midi
    end if
    Can anyone help me?

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to add midi sound in vb6

    How do you PLAY media? No program named play that I know of
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2005
    Posts
    1,083

    Re: How to add midi sound in vb6

    IMO It's just way to explain what he wants...


    Here's a way --> http://www.devx.com/vb2themax/Tip/18384
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  4. #4
    Join Date
    Oct 2012
    Posts
    59

    Re: How to add midi sound in vb6

    Quote Originally Posted by jggtz View Post
    IMO It's just way to explain what he wants...


    Here's a way --> http://www.devx.com/vb2themax/Tip/18384

    Yes it is this what i want to do, but i dont know where write code especially when my code is very long.

    This is my programs all code:

    Code:
    Dim intTotal1 As Integer
    Dim strTotal1 As String
    Dim intTotal2 As Integer
    Dim strTotal2 As String
    
    Option Explicit
    
    Private Const GWL_EXSTYLE = (-20)
    Private Const WS_EX_LAYERED = &H80000
    Private Const LWA_ALPHA = &H2
    
    Private Declare Function GetWindowLong Lib "user32" _
      Alias "GetWindowLongA" (ByVal hWnd As Long, _
      ByVal nIndex As Long) As Long
    
    Private Declare Function SetWindowLong Lib "user32" _
       Alias "SetWindowLongA" (ByVal hWnd As Long, _
       ByVal nIndex As Long, ByVal dwNewLong As Long) _
       As Long
    
    Private Declare Function SetLayeredWindowAttributes Lib _
        "user32" (ByVal hWnd As Long, ByVal crKey As Long, _
        ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    Public Function TransForm(Form As Form, TransLevel As Byte) As Boolean
        SetWindowLong Form.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
        SetLayeredWindowAttributes Form.hWnd, 0, TransLevel, LWA_ALPHA
        TransForm = Err.LastDllError = 0
    End Function
    Private Sub Command2_Click()
        TransForm AboutScr, 255
        Load AboutScr
        AboutScr.Show vbModal, Me
    End Sub
    Private Sub Form_Load()
        TransForm Me, 224
    End Sub
    Private Sub txtLevel_Change()
            On Error Resume Next
        TransForm Me, txtLevel.Text
    End Sub
    Private Sub Command1_Click()
    
    If IsNumeric(Text1.Text) And _
           IsNumeric(Text2.Text) And _
           IsNumeric(Text3.Text) And _
           IsNumeric(Text4.Text) And _
           IsNumeric(Text5.Text) And _
           IsNumeric(Text6.Text) And _
           IsNumeric(Text7.Text) And _
           IsNumeric(Text8.Text) Then
            If Val(Text1.Text) <> 1 And Val(Text1.Text) <> 2 Then
                MsgBox "Metai turi prasidėti skaičiuomi 1 ar 2", vbInformation, "Dėmesio!"
            Exit Sub
        End If
            If Val(Text5.Text & Text6.Text) < 1 Or _
           Val(Text5.Text & Text6.Text) > 12 Then
            MsgBox "Mėnesiai turi būti tarp 01 ir 12", vbInformation, "Dėmesio!"
            Exit Sub
        End If
            If Val(Text7.Text & Text8.Text) < 1 Or _
           Val(Text7.Text & Text8.Text) > 31 Then
            MsgBox "Dienos turi būti tarp 01 ir 31", vbInformation, "Dėmesio!"
            Exit Sub
        End If
            intTotal1 = Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text) + Val(Text8.Text)
            strTotal1 = Format(intTotal1, "00")
            intTotal2 = Val(Left(strTotal1, 1)) + Val(Right(strTotal1, 1))
            If intTotal2 > 9 Then
                strTotal2 = Format(intTotal2, "00")
                intTotal2 = Val(Left(strTotal2, 1)) + Val(Right(strTotal2, 1))
        End If
            Label1.Caption = Format(intTotal2)
           Dim strAux As String
    strAux = Text5.Text & Text6.Text & Text7.Text & Text8.Text
    If strAux >= "0321" And strAux <= "0420" Then SDate.Caption = "Avinas"
    If strAux >= "0421" And strAux <= "0521" Then SDate.Caption = "Jautis"
    If strAux >= "0522" And strAux <= "0621" Then SDate.Caption = "Dvynys"
    If strAux >= "0622" And strAux <= "0722" Then SDate.Caption = "Vėžys"
    If strAux >= "0722" And strAux <= "0822" Then SDate.Caption = "Liūtas"
    If strAux >= "0823" And strAux <= "0923" Then SDate.Caption = "Mergelė"
    If strAux >= "0924" And strAux <= "1023" Then SDate.Caption = "Svarstyklės"
    If strAux >= "1024" And strAux <= "1122" Then SDate.Caption = "Skorpionas"
    If strAux >= "1123" And strAux <= "1222" Then SDate.Caption = "Šaulys"
    If strAux >= "1223" Or strAux <= "0119" Then SDate.Caption = "Ožiaragis"
    If strAux >= "0120" And strAux <= "0218" Then SDate.Caption = "Vandenis"
    If strAux >= "0219" And strAux <= "0320" Then SDate.Caption = "Žuvys"
     Else
           MsgBox "Laukelis paliktas tuščias arba įvestas ne skaičius!", vbInformation, "Dėmesio!"
        End If
        If SDate.Caption = "Avinas" Then
        psavt.Caption = "Įkvėpimas ir Drąsa"
        End If
        If SDate.Caption = "Jautis" Then
        psavt.Caption = "Atkaklumas ir Patikimumas"
        End If
        If SDate.Caption = "Dvyniai" Then
        psavt.Caption = "Žingeidumas ir Įvairiapusiškumas"
        End If
        If SDate.Caption = "Vėžys" Then
        psavt.Caption = "Pastovumas ir Atjauta"
        End If
        If SDate.Caption = "Liūtas" Then
        psavt.Caption = "Išdidumas ir Optimizmas"
        End If
        If SDate.Caption = "Mergelė" Then
        psavt.Caption = "Analitinis protas ir Įvairiapusiškumas"
        End If
        If SDate.Caption = "Svarstyklės" Then
        psavt.Caption = "Diplomatija ir Simpatiškumas"
        End If
        If SDate.Caption = "Skorpionas" Then
        psavt.Caption = "Veiklumas ir Išdidumas"
        End If
        If SDate.Caption = "Šaulys" Then
        psavt.Caption = "Draugiškumas ir Įvairiapusiškumas"
        End If
        If SDate.Caption = "Ožiaragis" Then
        psavt.Caption = "Atsakingumas ir Veiklumas"
        End If
        If SDate.Caption = "Vandenis" Then
        psavt.Caption = "Orginalumas ir Intuicija"
        End If
        If SDate.Caption = "Žuvys" Then
        psavt.Caption = "Pagalba nelaimėje ir Darbštumas"
        End If
      If SDate.Caption = "Avinas" Then
        psavn.Caption = "Impulsyvumas ir Nedisciplinuotumas"
        End If
        If SDate.Caption = "Jautis" Then
        psavn.Caption = "Gobšumas ir Užsispyrimas"
        End If
        If SDate.Caption = "Dvyniai" Then
        psavn.Caption = "Nekantrumas ir Nepastovumas"
        End If
        If SDate.Caption = "Vėžys" Then
        psavn.Caption = "Gobšumas ir Per didelis jautrumas"
        End If
        If SDate.Caption = "Liūtas" Then
        psavn.Caption = "Nepakantumas ir Nelankstumas"
        End If
        If SDate.Caption = "Mergelė" Then
        psavn.Caption = "Kritiškumas ir Nepakantumas"
        End If
        If SDate.Caption = "Svarstyklės" Then
        psavn.Caption = "Neryžtingumas ir Priklausomybė"
        End If
        If SDate.Caption = "Skorpionas" Then
        psavn.Caption = "Gobšumas ir Neužmirštantis įžeidimo"
        End If
        If SDate.Caption = "Šaulys" Then
        psavn.Caption = "Netaktiškumas ir Nepastovumas"
        End If
        If SDate.Caption = "Ožiaragis" Then
        psavn.Caption = "Uždarumas ir Pesimizmas"
        End If
        If SDate.Caption = "Vandenis" Then
        psavn.Caption = "Nedisciplinuotumas ir Nepriklausomybė"
        End If
        If SDate.Caption = "Žuvys" Then
        psavn.Caption = "Neryžtingumas ir Per didelis jautrumas"
        End If
      If SDate.Caption = "Avinas" Then
        kri.Caption = "Kantrybės"
        End If
        If SDate.Caption = "Jautis" Then
        kri.Caption = "Nepriklausomybės"
        End If
        If SDate.Caption = "Dvyniai" Then
        kri.Caption = "Kontroliuoti savo energiją ir protą"
        End If
        If SDate.Caption = "Vėžys" Then
        kri.Caption = "Pastabumo"
        End If
        If SDate.Caption = "Liūtas" Then
        kri.Caption = "Kuklumo"
        End If
        If SDate.Caption = "Mergelė" Then
        kri.Caption = "Pakantumo ir Tolerancijos"
        End If
        If SDate.Caption = "Svarstyklės" Then
        kri.Caption = "Ryžtingumo"
        End If
        If SDate.Caption = "Skorpionas" Then
        kri.Caption = "Atlaidumo"
        End If
        If SDate.Caption = "Šaulys" Then
        kri.Caption = "Susivaldymo"
        End If
        If SDate.Caption = "Ožiaragis" Then
        kri.Caption = "Visuomeniškumo"
        End If
        If SDate.Caption = "Vandenis" Then
        kri.Caption = "Nuoširdumo"
        End If
        If SDate.Caption = "Žuvys" Then
        kri.Caption = "Atkaklumo"
        End If
        If SDate.Caption = "Avinas" Then
        trm.Caption = "Greit užsidega, greit perdega"
        End If
        If SDate.Caption = "Jautis" Then
        trm.Caption = "Pasėja grūdus, kai dirva paruošta"
        End If
        If SDate.Caption = "Dvyniai" Then
        trm.Caption = "Šokinėja nuo vienos idėjos prie kitos"
        End If
        If SDate.Caption = "Vėžys" Then
        trm.Caption = "Emocionaliai bendrauja su įvairiausio tipo žmonėmis"
        End If
        If SDate.Caption = "Liūtas" Then
        trm.Caption = "Ugnis dega ilgai"
        End If
        If SDate.Caption = "Mergelė" Then
        trm.Caption = "Šokinėja iš vieno lauko į kitą, pasėja po truputį kiekviename lauke"
        End If
        If SDate.Caption = "Svarstyklės" Then
        trm.Caption = "Idėjas apsvarsto iš visų pusių, planuoja, skaičiuoja, sunkiai priima sprendimą"
        End If
        If SDate.Caption = "Skorpionas" Then
        trm.Caption = "Intensyviai bendrauja tik su tam tikros grupės žmonėmis"
        End If
        If SDate.Caption = "Šaulys" Then
        trm.Caption = "Šokinėja nuo vienokios ugnies prie kitokios"
        End If
        If SDate.Caption = "Ožiaragis" Then
        trm.Caption = "Aria ir tręšia dirvą sėjai"
        End If
        If SDate.Caption = "Vandenis" Then
        trm.Caption = "Tobulai išnagrinėja idėją ir jos įgyvendinimą"
        End If
        If SDate.Caption = "Žuvys" Then
        trm.Caption = "Šokinėja nuo vienų prie kitų, jausmai tai vienoki, tai kitokie"
        End If
        If SDate.Caption = "Avinas" Then
    Tal.Caption = "Impulsas, Veiksmas, Energija"
    End If
    If SDate.Caption = "Jautis" Then
    Tal.Caption = "Realizmas, Darbštumas, Užsispyrimas "
    End If
    If SDate.Caption = "Dvynys" Then
    Tal.Caption = "Dvilypumas, Nepastovumas, Darbas keliomis kryptimis "
    End If
    If SDate.Caption = "Vėžys" Then
    Tal.Caption = "Išorinis pasyvumas, Gilus mąstymas, Jautrumas"
    End If
    If SDate.Caption = "Liūtas" Then
    Tal.Caption = "Veiksmas, Organizavimas, Vadovavimas"
    End If
    If SDate.Caption = "Mergelė" Then
    Tal.Caption = "Atsargumas, Realizmas, Aktyvumas"
    End If
    If SDate.Caption = "Svarstyklės" Then
    Tal.Caption = "Nepastovumas, Dvilypumas, Kolektyvinė veikla"
    End If
    If SDate.Caption = "Skorpionas" Then
    Tal.Caption = "Emocinė energija, Kritiškumas, Jautrumas"
    End If
    If SDate.Caption = "Šaulys" Then
    Tal.Caption = "Valdžios siekimas, Nepriklausomybė"
    End If
    If SDate.Caption = "Ožiaragis" Then
    Tal.Caption = "Pastovumas, Lėtumas, Realizmas"
    End If
    If SDate.Caption = "Vandenis" Then
    Tal.Caption = "Atsargumas, Judrumas, Individuali veikla"
    End If
    If SDate.Caption = "Žuvys" Then
    Tal.Caption = "Jautrumas, Realizmo stoka, Artistiškumas"
    End If
    If SDate.Caption = "Avinas" Then
    Apie.Caption = " Apie tuos, kuriuos valdo impulsas"
    End If
    If SDate.Caption = "Jautis" Then
    Apie.Caption = "Apie tuos, kurie mėgsta skaniai pavalgyti"
    End If
    If SDate.Caption = "Dvynys" Then
    Apie.Caption = "Apie tuos, kurie panašūs į vėją"
    End If
    If SDate.Caption = "Vėžys" Then
    Apie.Caption = "Apie tuos, kurie primena veidrodžius"
    End If
    If SDate.Caption = "Liūtas" Then
    Apie.Caption = "Apie tuos, kuriuos reikia kasdien girti"
    End If
    If SDate.Caption = "Mergelė" Then
    Apie.Caption = "Apie tuos, kurie turi aštrią akį"
    End If
    If SDate.Caption = "Svarstyklės" Then
    Apie.Caption = "Apie tuos, kurie sunkiai apsisprendžia"
    End If
    If SDate.Caption = "Skorpionas" Then
    Apie.Caption = "Apie tuos, kurie pabunda pavakary"
    End If
    If SDate.Caption = "Šaulys" Then
    Apie.Caption = "Apie tuos, kurie mėgsta pavalkatauti"
    End If
    If SDate.Caption = "Ožiaragis" Then
    Apie.Caption = "Apie tuos, kurie gimsta drauge su Jėzum Kristum"
    End If
    If SDate.Caption = "Vandenis" Then
    Apie.Caption = "Apie tuos, kurie gimsta per pūgas"
    End If
    If SDate.Caption = "Žuvys" Then
    Apie.Caption = "Apie tuos, kurių žodžiai upeliais liejasi"
    End If
    If SDate.Caption = "Avinas" Then
    tp.Caption = "Liūtas, Avinas, Jautis, Šaulys, Vandenis, Žuvys"
    End If
    If SDate.Caption = "Jautis" Then
    tp.Caption = "Mergelė, Ožiaragis, Žuvys, Avinas, Vėžys"
    End If
    If SDate.Caption = "Dvynys" Then
    tp.Caption = "Vandenis, Svarstyklės, Skorpionas, Vėžys, Liūtas, Svarstyklės, Jautis"
    End If
    If SDate.Caption = "Vėžys" Then
    tp.Caption = "Skorpionas, Žuvys, Vėžys, Liūtas, Mergelė, Jautis"
    End If
    If SDate.Caption = "Liūtas" Then
    tp.Caption = "Šaulys, Avinas, Liūtas, Svarstyklės, Vėžys, Dvyniai"
    End If
    If SDate.Caption = "Mergelė" Then
    tp.Caption = "Jautis, Ožiaragis, Svarstyklės, Skorpionas, Vėžys, Liūtas"
    End If
    If SDate.Caption = "Svarstyklės" Then
    tp.Caption = "Vandenis, Dvyniai, Šaulys, Liūtas, Mergelė"
    End If
    If SDate.Caption = "Skorpionas" Then
    tp.Caption = "Žuvys, Vėžys, Šaulys, Ožiaragis, Mergelė, Svarstyklės"
    End If
    If SDate.Caption = "Šaulys" Then
    tp.Caption = "Liūtas, Avinas, Ožiaragis, Vandenis, Svarstyklės, Skorpionas"
    End If
    If SDate.Caption = "Ožiaragis" Then
    tp.Caption = "Jautis, Mergelė, Žuvys, Vandenis, Skorpionas, Šaulys"
    End If
    If SDate.Caption = "Vandenis" Then
    tp.Caption = "Dvyniai, Svarstyklės, Žuvys, Avinas, Šaulys, Ožiaragis"
    End If
    If SDate.Caption = "Žuvys" Then
    tp.Caption = "Skorpionas, Vėžys, Avinas, Jautis, Ožiaragis, Vandenis"
    End If
    If SDate.Caption = "Avinas" Then
    sns.Caption = "Vėžiu, Svarstyklėmis ir Ožiaragiu"
    End If
    If SDate.Caption = "Jautis" Then
    sns.Caption = "Liūtu, Skorpionu, Vandeniu"
    End If
    If SDate.Caption = "Dvynys" Then
    sns.Caption = "Mergelėmis, Šauliais, Žuvimis"
    End If
    If SDate.Caption = "Vėžys" Then
    sns.Caption = "Ožiaragiais, Svarstyklėmis, Avinais"
    End If
    If SDate.Caption = "Liūtas" Then
    sns.Caption = "Vandeniu ir Jaučiu"
    End If
    If SDate.Caption = "Mergelė" Then
    sns.Caption = "Šauliu, Žuvimis, Dvyniais"
    End If
    If SDate.Caption = "Svarstyklės" Then
    sns.Caption = "Ožiaragiais ir Avinais"
    End If
    If SDate.Caption = "Skorpionas" Then
    sns.Caption = "Vandeniais ir Jaučiais"
    End If
    If SDate.Caption = "Šaulys" Then
    sns.Caption = "Žuvimis, Mergelėmis, Dvyniais"
    End If
    If SDate.Caption = "Ožiaragis" Then
    sns.Caption = "Avinu, Vėžiu, Svarstyklėmis"
    End If
    If SDate.Caption = "Vandenis" Then
    sns.Caption = "Jaučiu, Skorpionu ir Liūtu"
    End If
    If SDate.Caption = "Žuvys" Then
    sns.Caption = "Mergelėmis, Dvyniais"
    End If
    If SDate.Caption = "Avinas" Then
        jr.Caption = "Nepriklausomybė"
        End If
        If SDate.Caption = "Jautis" Then
        jr.Caption = "Produktyvumas"
        End If
        If SDate.Caption = "Dvyniai" Then
        jr.Caption = "Smalsumas"
        End If
        If SDate.Caption = "Vėžys" Then
        jr.Caption = "Mokymas"
        End If
        If SDate.Caption = "Liūtas" Then
        jr.Caption = "Saviraiška"
        End If
        If SDate.Caption = "Mergelė" Then
        jr.Caption = "Analizė"
        End If
        If SDate.Caption = "Svarstyklės" Then
        jr.Caption = "Pusiausvyros ieškojimas"
        End If
        If SDate.Caption = "Skorpionas" Then
        jr.Caption = "Įsigilinimas"
        End If
        If SDate.Caption = "Šaulys" Then
        jr.Caption = "Veržlumas"
        End If
        If SDate.Caption = "Ožiaragis" Then
        jr.Caption = "Atsinaujinimas"
        End If
        If SDate.Caption = "Vandenis" Then
        jr.Caption = "Pertvarka"
        End If
        If SDate.Caption = "Žuvys" Then
        jr.Caption = "Pasitikėjimas"
        End If
       If SDate.Caption = "Avinas" Then
        dev.Caption = "Aš esu"
        End If
        If SDate.Caption = "Jautis" Then
        dev.Caption = "Aš turiu"
        End If
        If SDate.Caption = "Dvyniai" Then
        dev.Caption = "Aš galvoju"
        End If
        If SDate.Caption = "Vėžys" Then
        dev.Caption = "Aš jaučiu"
        End If
        If SDate.Caption = "Liūtas" Then
        dev.Caption = "Aš noriu"
        End If
        If SDate.Caption = "Mergelė" Then
        dev.Caption = "Aš tikrinu"
        End If
        If SDate.Caption = "Svarstyklės" Then
        dev.Caption = "Aš svarstau"
        End If
        If SDate.Caption = "Skorpionas" Then
        dev.Caption = "Aš geidžiu"
        End If
        If SDate.Caption = "Šaulys" Then
        dev.Caption = "Aš matau"
        End If
        If SDate.Caption = "Ožiaragis" Then
        dev.Caption = "Man reikia"
        End If
        If SDate.Caption = "Vandenis" Then
        dev.Caption = "Aš žinau"
        End If
        If SDate.Caption = "Žuvys" Then
        dev.Caption = "Aš tikiu"
        End If
       If SDate.Caption = "Avinas" Then
        tll.Caption = "Plaktukas"
        End If
        If SDate.Caption = "Jautis" Then
        tll.Caption = "Pelėda"
        End If
        If SDate.Caption = "Dvyniai" Then
        tll.Caption = "Žaltys"
        End If
        If SDate.Caption = "Vėžys" Then
        tll.Caption = "Dobilas"
        End If
        If SDate.Caption = "Liūtas" Then
        tll.Caption = "Boružė"
        End If
        If SDate.Caption = "Mergelė" Then
        tll.Caption = "Žiogas"
        End If
        If SDate.Caption = "Svarstyklės" Then
        tll.Caption = "Širdis"
        End If
        If SDate.Caption = "Skorpionas" Then
        tll.Caption = "Karkvabalis"
        End If
        If SDate.Caption = "Šaulys" Then
        tll.Caption = "Pasaga"
        End If
        If SDate.Caption = "Ožiaragis" Then
        tll.Caption = "Juodas katinas"
        End If
        If SDate.Caption = "Vandenis" Then
        tll.Caption = "Raktas"
        End If
        If SDate.Caption = "Žuvys" Then
        tll.Caption = "Ryšulėlis"
       End If
    End Sub
    Private Sub Command3_Click()
    Dim Contrl As Control
    For Each Contrl In Form1.Controls
    If (TypeOf Contrl Is TextBox) Then Contrl.Text = ""
    Next Contrl
    End Sub
    Private Sub Form_Paint()
        Me.Width = Picture1.Width
        Me.Height = Picture1.Height
        Picture1.Top = 0
        Picture1.Left = 0
    End Sub

    Did i need create another command button such as play, pause, stop? If you can help me with this, i need only 1 line code with 'if and else' and all i do by my self. My first midi sounds name is aries1, second - taurus1 ....
    Last edited by Halosar7; October 10th, 2012 at 04:47 AM.

  5. #5
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: How to add midi sound in vb6

    There is the PlaySound API call which can play a sound async or sync, but as far as I know it does play .wav files and not midi...

  6. #6
    Join Date
    Jul 2005
    Posts
    1,083

    Re: How to add midi sound in vb6

    In the next code you will see that you could write all about every zodiac sign in the first "IF-THEN" where you ask for tge range of dates... so isn't neccesary to ask every time for the same zodiac sign
    in the same IF-THEN structure you could write the code to play the sound
    (here only show you the code about Avinas...)
    Code:
    '
    ' other code goes here
    '
            Dim strAux As String
            strAux = Text5.Text & Text6.Text & Text7.Text & Text8.Text
            If strAux >= "0321" And strAux <= "0420" Then 
                SDate.Caption = "Avinas"
                psavt.Caption = "Įkvėpimas ir Drąsa"
                psavn.Caption = "Impulsyvumas ir Nedisciplinuotumas"
                kri.Caption = "Kantrybės"
                trm.Caption = "Greit užsidega, greit perdega"
                Tal.Caption = "Impulsas, Veiksmas, Energija"
                Apie.Caption = " Apie tuos, kuriuos valdo impulsas"
                tp.Caption = "Liūtas, Avinas, Jautis, Šaulys, Vandenis, Žuvys"
                sns.Caption = "Vėžiu, Svarstyklėmis ir Ožiaragiu"
                jr.Caption = "Nepriklausomybė"
                dev.Caption = "Aš esu"
                tll.Caption = "Plaktukas"
                'here will go the instruction to play sound file
            End If
            If strAux >= "0421" And strAux <= "0521" Then 
                SDate.Caption = "Jautis"
                'put all about Jautis here and delete the IFs below
            End If
            If strAux >= "0522" And strAux <= "0621" Then 
                SDate.Caption = "Dvynys"
                'write all about Dvynys here
            End If
    '
    ' your other code goes here
    '
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  7. #7
    Join Date
    Oct 2012
    Posts
    59

    Re: How to add midi sound in vb6

    I see now , thanks for your advice :-) i remember that :-)
    So back to midi. I want add midi sound but i cannot find any components for midi play and midi add. Can be my vb6 dont have it those files? Mayby i need download some dll. or something.


    Code:
    If strAux >= "0321" And strAux <= "0420" Then SDate.Caption = "Avinas"
     psavt.Caption = "Įkvėpimas ir Drąsa"
     psavn.Caption = "Impulsyvumas ir Nedisciplinuotumas"
     kri.Caption = "Kantrybės"
     trm.Caption = "Greit užsidega, greit perdega"
     Tal.Caption = "Impulsas, Veiksmas, Energija"
     Apie.Caption = " Apie tuos, kuriuos valdo impulsas"
     tp.Caption = "Liūtas, Avinas, Jautis, Šaulys, Vandenis, Žuvys"
     sns.Caption = "Vėžiu, Svarstyklėmis ir Ožiaragiu"
     jr.Caption = "Nepriklausomybė"
     dev.Caption = "Aš esu"
     tll.Caption = "Plaktukas"
    If strAux >= "0421" And strAux <= "0521" Then SDate.Caption = "Jautis"
    psavt.Caption = "Atkaklumas ir Patikimumas"
    psavn.Caption = "Gobšumas ir Užsispyrimas"
    kri.Caption = "Nepriklausomybės"
    trm.Caption = "Pasėja grūdus, kai dirva paruošta"
    Tal.Caption = "Realizmas, Darbštumas, Užsispyrimas"
    Apie.Caption = "Apie tuos, kurie mėgsta skaniai pavalgyti"
    tp.Caption = "Mergelė, Ožiaragis, Žuvys, Avinas, Vėžys"
    sns.Caption = "Liūtu, Skorpionu, Vandeniu"
    jr.Caption = "Produktyvumas"
    dev.Caption = "Aš turiu"
    tll.Caption = "Pelėda"
    If strAux >= "0522" And strAux <= "0621" Then SDate.Caption = "Dvynys"
    Dont need END IF. I testet with end if and without end if. With end if program show error, but without end if it works fine
    Last edited by Halosar7; October 10th, 2012 at 11:49 AM.

  8. #8
    Join Date
    Jul 2005
    Posts
    1,083

    Re: How to add midi sound in vb6

    In post #3 I posted a link to a page with a solution...
    It's an easy one
    Here goes a small project that uses that solution
    Study it

    You only need to write the Declare part in the General Declarations with all your existing Declares
    And write the Open, Play & Close in the IF-THEN for every zodiac sign
    Attached Files Attached Files
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  9. #9
    Join Date
    Jul 2005
    Posts
    1,083

    Re: How to add midi sound in vb6

    Code:
    The If-Then-Else has 2 formats
    
    1:  IF condition THEN instruction
    
    2:  IF condition THEN
             instruction
             instruction
             instruction
        END IF
    
    You used the number 1 because only have 1 instruction
    ... now you are going to use number 2 because have more than 1 instructions
    Dont need END IF. I testet with end if and without end if. With end if program show error, but without end if it works fine
    You need to cut the IF line after the THEN and add the END IF

    Wrong
    Code:
    If strAux >= "0321" And strAux <= "0420" Then SDate.Caption = "Avinas"
    Ok
    Code:
    If strAux >= "0321" And strAux <= "0420" Then 
        SDate.Caption = "Avinas"
        psavt.Caption = "Įkvėpimas ir Drąsa"
        psavn.Caption = "Impulsyvumas ir Nedisciplinuotumas"
        kri.Caption = "Kantrybės"
        trm.Caption = "Greit užsidega, greit perdega"
        Tal.Caption = "Impulsas, Veiksmas, Energija"
        Apie.Caption = " Apie tuos, kuriuos valdo impulsas"
        tp.Caption = "Liūtas, Avinas, Jautis, Šaulys, Vandenis, Žuvys"
        sns.Caption = "Vėžiu, Svarstyklėmis ir Ožiaragiu"
        jr.Caption = "Nepriklausomybė"
        dev.Caption = "Aš esu"
        tll.Caption = "Plaktukas"
    End If
    
    If strAux >= "0421" And strAux <= "0521" Then 
        SDate.Caption = "Jautis"
        psavt.Caption = "Atkaklumas ir Patikimumas"
        psavn.Caption = "Gobšumas ir Užsispyrimas"
        kri.Caption = "Nepriklausomybės"
        trm.Caption = "Pasėja grūdus, kai dirva paruošta"
        Tal.Caption = "Realizmas, Darbštumas, Užsispyrimas"
        Apie.Caption = "Apie tuos, kurie mėgsta skaniai pavalgyti"
        tp.Caption = "Mergelė, Ožiaragis, Žuvys, Avinas, Vėžys"
        sns.Caption = "Liūtu, Skorpionu, Vandeniu"
        jr.Caption = "Produktyvumas"
        dev.Caption = "Aš turiu"
        tll.Caption = "Pelėda"
    End If
    If strAux >= "0522" And strAux <= "0621" Then 
        SDate.Caption = "Dvynys"
    Last edited by jggtz; October 10th, 2012 at 12:04 PM.
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  10. #10
    Join Date
    Oct 2012
    Posts
    59

    Re: How to add midi sound in vb6

    I did what you sugest but see this picture:

    Name:  Untitled.jpg
Views: 1228
Size:  69.5 KB

    Forget this, i spot it mistake.

    Name:  Untitled.jpg
Views: 1277
Size:  37.2 KB
    Last edited by Halosar7; October 10th, 2012 at 12:40 PM.

  11. #11
    Join Date
    Oct 2012
    Posts
    59

    Re: How to add midi sound in vb6

    Quote Originally Posted by jggtz View Post
    In post #3 I posted a link to a page with a solution...
    It's an easy one
    Here goes a small project that uses that solution
    Study it

    You only need to write the Declare part in the General Declarations with all your existing Declares
    And write the Open, Play & Close in the IF-THEN for every zodiac sign
    This program has some bug, when it run, vb stop forking. See your self.

    Name:  Untitled.jpg
Views: 1239
Size:  76.1 KB

    PROGRAM NOT RESPONDING. I not make mistake, i just copy-paste code. When i play sound program shut down.
    VB dont show any errors.

  12. #12
    Join Date
    Jul 2005
    Posts
    1,083

    Re: How to add midi sound in vb6

    And what about the small project that I attached in post #8
    Did it work ok?
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  13. #13
    Join Date
    Oct 2012
    Posts
    59

    Re: How to add midi sound in vb6

    Quote Originally Posted by jggtz View Post
    And what about the small project that I attached in post #8
    Did it work ok?

    I use your project, It works, sound play, but then program start say : not responding, and bouth programs - your project and my this zodiac. I think maybe in code is small error or what?

  14. #14
    Join Date
    Oct 2012
    Posts
    59

    Re: How to add midi sound in vb6

    So what you think whats problem may be?

  15. #15
    Join Date
    Jul 2005
    Posts
    1,083

    Re: How to add midi sound in vb6

    Are you waiting that the program play all the midi file?
    Are you trying to stop it?
    Test with a shorter file
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

Page 1 of 2 12 LastLast

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

Featured