This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Strange compile errors


Strange compile errors

Postby Daywalker » Jun 27, 2001 @ 12:39pm

If im putting something like this in my sourcecode (using eMB 3.0):<br><br><br>sndPlaySound("sound.wav", SND_LOOP | SND_FILENAME); <br><br><br><br>I get this error:<br><br><br>error C2664: 'sndPlaySoundW' : cannot convert parameter 1 from 'char [10]' to 'const unsigned short *'<br><br><br>If im programming with VC++ 6.0 for Windows 95... (using PlaySound), everything works fine.<br>The problem also appears with MessageBoxes.<br>What's the problem?
User avatar
Daywalker
pm Member
 
Posts: 15
Joined: Jun 26, 2001 @ 5:58pm


Re: Strange compile errors

Postby Moose or Chuck » Jun 27, 2001 @ 12:45pm

You can't name a wav file like that. You have to use something like: MAKEINTRESOURCE(IDR_WAVE1).<br>(in which case you imported the wave into your resource file and gave it that ID in the resource's header file)<br>Last modification: Moose Master - 06/27/01 at 09:45:45
Moose or Chuck
 


Re: Strange compile errors

Postby Moose or Chuck » Jun 27, 2001 @ 12:46pm

But I can't get playsound to work at all. It gives me some linking error whenever I try. (also getting rid of new bug). See my other thread (Linking Error), I need some help on that.
Moose or Chuck
 


Re: Strange compile errors

Postby Malmer » Jun 27, 2001 @ 1:20pm

All your base are belong to us
User avatar
Malmer
pm Member
 
Posts: 768
Joined: Apr 26, 2001 @ 5:15pm
Location: Sweden


Re: Strange compile errors

Postby Moose or Chuck » Jun 27, 2001 @ 1:24pm

Moose or Chuck
 


Re: Strange compile errors

Postby jongjungbu » Jun 27, 2001 @ 1:28pm

User avatar
jongjungbu
Not JongJongBu
 
Posts: 3112
Joined: Jun 19, 2001 @ 4:22am
Location: USA


Re: Strange compile errors

Postby jongjungbu » Jun 27, 2001 @ 1:32pm

User avatar
jongjungbu
Not JongJongBu
 
Posts: 3112
Joined: Jun 19, 2001 @ 4:22am
Location: USA


Re: Strange compile errors

Postby Dan East » Jun 27, 2001 @ 6:27pm

As Fredrick basically said, you need to pass a UNICODE string instead of ASCII. You can place an L in front of the string, but I greatly prefer using the _T( "" ) macro instead because it follows standard C syntax which looks and makes more sense than using the L macro. The following are are methods of forcing the compiler to convert a string to unicode:<br>_T( "my string" ), L"my string", _TEXT( "my string" )<br>Using the L macro is also more "dangerous" in that it always converts to a Unicode string. _T and _TEXT will only convert the string if you are building a Unicode app, which makes your code more portable. If you use the L macro then you should not use _t functions. You should use the _w family instead since you are specifically using only wide-character strings.<br><br>You do not use the SND_FILENAME flag. sndPlaySound will load the file if that is what your string refers to.<br><br>Dan East<br><br>Friggen smileys: Last modification: Dan East - 06/27/01 at 15:27:48
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: Strange compile errors

Postby jongjungbu » Jun 27, 2001 @ 6:28pm

So yer pretty much saying my sample code was right!!! :D
User avatar
jongjungbu
Not JongJongBu
 
Posts: 3112
Joined: Jun 19, 2001 @ 4:22am
Location: USA


Re: Strange compile errors

Postby Dan East » Jun 27, 2001 @ 6:49pm

Yep, sorry JJB, I basically said exactly what you did. As Moose will tell you, I'm good at that. ;)<br><br>Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Re: Strange compile errors

Postby Moose or Chuck » Jun 27, 2001 @ 7:01pm

And now that the question is answered by Dan there will be no more replies to this thread.<br>Either Dan is really good at answering questions, or he has a disease we don't know about.
Moose or Chuck
 


Re: Strange compile errors

Postby jongjungbu » Jun 27, 2001 @ 7:04pm

I will reply anyway.<br>Heh. That is okay by me Dan. I'm just enjoying that you have confirmed what I posted. Then I can say..."In your Face!" <br><br>umm, i just dont know who i can say that to though.
User avatar
jongjungbu
Not JongJongBu
 
Posts: 3112
Joined: Jun 19, 2001 @ 4:22am
Location: USA


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron