On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Re: Play .wav from .res with Windows Media Player control...
That doesn't seem to work. I created the .rc file with theSound as my id, and then created the .RES file. I called it, as your example states to, replacing the "/1" with "/theSound", yet it does not work. It doesn't even provide an error. I tried several different sound ID's, but to no avail. I'm using Windows 7.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Re: Play .wav from .res with Windows Media Player control...
BTW: The example I posted is for the older style WMP.
If you can't get the URL to work for the newer WMP (as Bonnie posted) you probably will have to first convert the res data to a byte array and then save it to a file then set the URL to that file
Last edited by jmsrickland; Jul 17th, 2015 at 03:12 PM.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Re: Play .wav from .res with Windows Media Player control...
Just FYI: The app has to be compiled to use the "res" protocol, correct? Not my area of expertise, but App.ExeName doesn't really exist until the app is compiled. Not sure whether OP is using on compiled copy or not.
Insomnia is just a byproduct of, "It can't be done"
Re: Play .wav from .res with Windows Media Player control...
You can run from IDE as long as there is a Compiled copy in the folder but that is not the problem. I have only been able to get it to work from a disk file.
Last edited by jmsrickland; Jul 17th, 2015 at 03:01 PM.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Re: Play .wav from .res with Windows Media Player control...
LaVolpe: I tested your theory and it does not seem to matter whether it is compiled or not.
jms: I tried your code and it doesn't seem to work, either. Also, I'd really rather not convert it to a file and then save it to disk. Doing so would defeat the purpose of using the .res file.
Re: Play .wav from .res with Windows Media Player control...
My method works its just you need to use earlier version of WMP
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Re: Play .wav from .res with Windows Media Player control...
Maybe you can show us exactly the line you used to try to run it from the res file?
In the mean time, if you can find a way to play a file by a byte array, you can always use LoadResData() to return a byte array. And as a last resort, write the byte array to a file & pass the path/file name to WMP
Insomnia is just a byproduct of, "It can't be done"
I've also used it without adding the "App.Path" part and used "WAVE" instead of "CUSTOM". No difference.
And if I'm going to write the information to a file (which I'm trying to stay away from), I mind as well just use the .wav files instead of combining them into a .res file.
Last edited by jmsrickland; Jul 17th, 2015 at 07:17 PM.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Re: Play .wav from .res with Windows Media Player control...
Yes, it matches exactly. I would think it would cause a path/file error if not. And yes, I would really like to use WMP. If this is not possible, (which it is beginning to seem, as I can't find an answer anywhere) I will probably just go ahead and include the actual .wav files and just call it from WMP that way. I hate to do that, but oh well.
as before, but this time it worked. And it DOES need to be compiled before it will work. I'm really not sure why it worked this time and not before. Very strange. Anyway, thank you all.
Re: [RESOLVED] Play .wav from .res with Windows Media Player control...
It won't cause a path/file error; it just won't play
Last edited by jmsrickland; Jul 17th, 2015 at 09:36 PM.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
as before, but this time it worked. And it DOES need to be compiled before it will work. I'm really not sure why it worked this time and not before. Very strange. Anyway, thank you all.
Good, happy it works for you but still I cannot get .URL to read res data to work for me and I am using newer version of WMP or my version is still not the latest. I'm using wmp.dll version 9.0.0.4503
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.