What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » What is the best way to play sounds using C++?

What is the best way to play sounds using C++?
Author: Message:
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
O.P. What is the best way to play sounds using C++?
I want to write a small family of similar Msg+ plugins, all of which play sounds based on commands. Each plugin will have a different set of sounds.

At the moment, I am playing with a small, one-sound plugin, which will form the basis of the others. When I exclude the code to play the sound, the plugin compiles and runs correctly. However, when I use the PlaySound() function, it won't compile, even though I have got all the correct #include's as specified by the VC++6 online documentation and MSDN. I keep on getting error LNK2001.

Am I doing the right thing? Or should I use a different method? I can post the function call, complete with arguments, if that'll help.
[Image: spartaafk.png]
11-18-2003 12:28 AM
Profile PM Web Find Quote Report
optimism_
Senior Member
****

Avatar
Ctrl+Alt+Del - Tragically l337

Posts: 521
Reputation: 8
38 / Male / –
Joined: Jul 2003
RE: What is the best way to play sounds using C++?
Link errors: are you linking to the right library as well? check the docs for PlaySound as to which lib this would be
HTTP 404 - Signature Not Found
11-18-2003 09:39 PM
Profile E-Mail PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
O.P. RE: What is the best way to play sounds using C++?
I'm sure Im using the correct header files, as specified in the VC++ documentation, and the MSDN. However, I just cannot get it to compile. Have you got any tricks or hacks to get it to work properly?
[Image: spartaafk.png]
11-18-2003 10:50 PM
Profile PM Web Find Quote Report
optimism_
Senior Member
****

Avatar
Ctrl+Alt+Del - Tragically l337

Posts: 521
Reputation: 8
38 / Male / –
Joined: Jul 2003
RE: What is the best way to play sounds using C++?
not just the header files, the libraries as well. as far as i recall, you set these in project options (alt+f7) on the linker tab - the name of the lib to use will be in the docs at the same place as it says what headers to use
HTTP 404 - Signature Not Found
11-18-2003 10:53 PM
Profile E-Mail PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
O.P. RE: What is the best way to play sounds using C++?
Bloody documentation.

Thanks: I've not used VC++ much: in fact, I've only just started using it so I can write the plugins I want to write. I would have used Visual Basic, but plugins vreated using VB require a fancy installation or they won't work.

(Note to self: RTFM!)

EDIT: Pity you can't do a /sdoh in the forum :D

This post was edited on 11-18-2003 at 11:05 PM by RaceProUK.
[Image: spartaafk.png]
11-18-2003 11:04 PM
Profile PM Web Find Quote Report
Patchou
Messenger Plus! Creator
*****

Avatar

Posts: 8607
Reputation: 201
43 / Male / Flag
Joined: Apr 2002
RE: What is the best way to play sounds using C++?
from memory.. try
#pragma comment(lib, "winmm.lib")

it should help :)
Patchou

This post was edited on 11-19-2003 at 09:19 PM by Patchou.
[Image: signature2.gif]
11-19-2003 02:18 AM
Profile PM Web Find Quote Report
optimism_
Senior Member
****

Avatar
Ctrl+Alt+Del - Tragically l337

Posts: 521
Reputation: 8
38 / Male / –
Joined: Jul 2003
RE: What is the best way to play sounds using C++?
if it doesnt, go to the project settings (alt+f7) linker tab and add winmm.lib (?) to the list of thinks like user32.lib etc
HTTP 404 - Signature Not Found
11-19-2003 08:41 AM
Profile E-Mail PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
O.P. RE: What is the best way to play sounds using C++?
Adding winmm.lib to the link list in the (alt-f7) dialog worked, but now I just have to figure out how to use pointers properly. Hopefully, I'll have the first of the plugins ready by the end of the month.
[Image: spartaafk.png]
11-19-2003 03:24 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On