Thread: sndPlaySound() and LockResource()

  1. #1
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856

    sndPlaySound() and LockResource()

    I'm using a function called PlayResource() (found in MSDN) that takes the name of a wave resource and plays it. The function does this:
    FindResource();
    LoadResource();
    LockResource();
    sndPlaySound();
    FreeResource();

    The sound could be potentially played very frequently and I think it would be better to just load/lock the resource once at program start then play when necessary and free on shutdown. I don't know if that's something that I should do though as I'm unfamiliar with all the ramifications of all the functions involved.

    What do you think?

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    It is better, in this case, to save the resource to a temporary file (use SizeofResource to get the resource's size) and load it from there.

Popular pages Recent additions subscribe to a feed