Announcement

Collapse
No announcement yet.

Playing .wavs from a .rc file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Playing .wavs from a .rc file

    I guess I thought this was easy!

    Im used to a call like:
    PLAY(C:\SomeFolder\mysound.wav)

    So I read the archive and the simplist code that the guy said worked is below. Why cant i get it to work?

    Yes! You're onto something. I tried the following and it worked
    also. No need for the stringable stuff.

    sounds.rc
    ------------------------------------------------------
    howdy rcdata welcome.wav
    bubye rcdata bye.wav

    ------------------------------------------------------------
    #COMPILE EXE
    #RESOURCE "sound.pbr"
    #INCLUDE "WIN32API.INC"

    FUNCTION PBMAIN() AS LONG

    LOCAL lpWav AS BYTE PTR

    hInst&=GetModuleHandle("")
    hRes& = FindResource(hInst&,"howdy",BYVAL %RT_RCDATA)
    lpWav = LockResource(LoadResource(hInst&, hRes&))
    CALL PlaySound(BYVAL lpWav,hInst&,%SND_MEMORY OR %SND_ASYNC)
    FreeResource hRes&

    DIALOG NEW 0,"Sound Demo",,,200,100,0,0 TO hDlg&
    DIALOG SHOW MODAL hDlg&

    END FUNCTION


    ------------------
    Kind Regards
    Mike

  • #2
    I thought I had replied to this but I guess not...

    If I don't get my search done (Having connection issues) search the source code and PB/DLL forums for my function:

    PlayWavFromResource

    You should get two hits and that will show you how to do this...




    ------------------
    Scott
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      OK I got it thx Scott

      ------------------
      Kind Regards
      Mike

      Comment

      Working...
      X