CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14
  1. #1
    Join Date
    Jul 2007
    Posts
    16

    Question How to add background music to VB6?

    I have written a small aplication in VB6, and would like to add backgorund sounds to it, how do i do that?

    (i tried uFMOD i found while googling, but i cannot get it to work)

    I would like to be able to use .XM and .MOD music in my project.

    Any help is greately aprecitated!

    Thanx for reading!

    p.s.
    I would like the music resource to be compiled in my exe (so i can distribute it as one standalone file)!

  2. #2
    Join Date
    May 2007
    Posts
    42

    Re: How to add background music to VB6?

    Look into resource files
    If this post was helpful please rate it
    If it wasn't for C, we would be using BASI, PASAL and OBOL.

  3. #3
    Join Date
    Jul 2007
    Posts
    16

    Re: How to add background music to VB6?

    Quote Originally Posted by ~Paul~
    Look into resource files
    I dont understand what you mean?

    Please explain.

    (if you are refering to uFMOD - i did all as instructed by readme.txt but it does not work for me, even the examples suplied by the package dont work)

  4. #4
    Join Date
    May 2007
    Posts
    42

    Re: How to add background music to VB6?

    How big is the music file?
    If this post was helpful please rate it
    If it wasn't for C, we would be using BASI, PASAL and OBOL.

  5. #5
    Join Date
    Jul 2007
    Posts
    16

    Re: How to add background music to VB6?

    normally between 30 to 60 KB, but i do have few files large as 1MB.

    Can you help me add background music in my exe without need for any thirdparty dlls?

  6. #6
    Join Date
    May 2007
    Posts
    42

    Re: How to add background music to VB6?

    Some are to big, so it would be best to include them in a folder. Then using the Multimedia control simply play the music file when you wish
    If this post was helpful please rate it
    If it wasn't for C, we would be using BASI, PASAL and OBOL.

  7. #7
    Join Date
    Jul 2007
    Posts
    16

    Re: How to add background music to VB6?

    You did not help in any way, and you have not read my question

    I want to have just one file "name.exe" with music included - no folders, no externals dll's etc.. (except vb6 standard dll everyone has anyway)

    Does anyone else know something about how to add music to play in background while program is running?

    Any help is apreciated!

  8. #8
    Join Date
    May 2005
    Location
    Estonia
    Posts
    235

    Re: How to add background music to VB6?

    READ THIS:
    http://www.codeguru.com/forum/showthread.php?t=400075

    EDIT. thats you who answered there, anyway there is example for you.
    Rate my post if i it was useful!

  9. #9
    Join Date
    Jul 2007
    Posts
    16

    Re: How to add background music to VB6?

    Thanks but i cannot use dlls, it must be one exe file without dlls.

    I did try your link, and it wont work as i have too ols dll version, but that does not mater now.

    I finaly got uFMOD to work, but i'm still havin trouble with inserting my .RES file instead of one from example folder, im not sure how to solve it until now.

    Thanks for your effort!

  10. #10
    Join Date
    May 2005
    Location
    Estonia
    Posts
    235

    Re: How to add background music to VB6?

    http://tagatuba.planet.ee/failid/ufmodres.zip

    You must change the .RC file, edit the filename and maybe ID if you want.
    Then you must compile the RC file (i compiled with VC++ 6.0) and then you will get the .RES file.

    You must include it into your project.
    And it will compile into EXE.

    Result: standalone EXE with music
    Rate my post if i it was useful!

  11. #11
    Join Date
    Jul 2007
    Posts
    16

    Re: How to add background music to VB6?

    I did everything the same way as you described, only i used VB 6.0 not VC++.

    In original example name of respource is 10 and id is 1 and when i create .RES file i get name "CUSTOM" and ID 101 - i can change the id to correct one but i canot get name 10 without quotation marks as in original example, no mather what i type it always adds quotation marks - i beleve this to be the main problem in my case.

    I will try to find VC++ 6.0 and try with its resource builder.

    I go take look at that link you typed.

    Thanx for help!

  12. #12
    Join Date
    Jul 2007
    Posts
    16

    Re: How to add background music to VB6?

    Quote Originally Posted by Chriss777
    ..
    I go take look at that link you typed.

    Well here it is when i open your example and resource in VB resource editor it shows estonian language, id:555 and name 10 without quotation marks, exactly as in original example.

    I did 2 things:

    1.) added my own music - it got name "CUSTOM" and id:101
    2.) i duplicated your resource and gave it id:557

    now when i call to play ID:555 or ID:557 it all works fine, but when i try to play ID:101 it does nothing.

    Can you please try using VB res.editor to reproduce what you did with VC++ compiler?

    Or even beter explain how did you build your .RES file?

    (i just clicked add custom resource, pointed to my .XM file and saved it - file looks normal - opens in other resource viewers etc..)

  13. #13
    Join Date
    May 2005
    Location
    Estonia
    Posts
    235

    Re: How to add background music to VB6?

    Don't use VB for resource compiling. Use VC++ for this.

    EXAMPLE:

    1) open MINI.RC in notepad
    2) change ID to 101
    3) change filename in quotes to blabla.xm
    Now MINI.RC file looks like this below
    101 RCDATA "blabla.xm"
    4) open MINI.RC with VC++
    5) File->Save as-> (Save as Type 32-bit resource file)
    6) now you have MINI.RES file with BLABLA.XM inside with ID 101
    You see that MINI.RES is same size as XM file: 652KB
    7) open test.vbp in VB
    8) in Resource Manager click the button that has Folder image on it.
    Thats the "Open resource file" button
    9) Choose the MINI.RES file
    10) NOW YOU WILL SEE THAT RESOURCE NAME IS 10 and ID is 101.

    11) Now make some changes: If uFMOD_PlaySong(101, etc, etc create EXE and try.

    http://tagatuba.planet.ee/failid/WinMM.zip
    Rate my post if i it was useful!

  14. #14
    Join Date
    Jul 2007
    Posts
    16

    Re: How to add background music to VB6?

    THANKS a LOT!!!

    It works now, but there is another thing - you cant compile to P-code if using musics - it just wont play - i just say it for the record!

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