Click here to Skip to main content
15,910,234 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
toxcct19-Aug-08 23:20
toxcct19-Aug-08 23:20 
GeneralRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
Mark Salsbery20-Aug-08 6:36
Mark Salsbery20-Aug-08 6:36 
GeneralRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
toxcct20-Aug-08 6:41
toxcct20-Aug-08 6:41 
GeneralRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
Mark Salsbery20-Aug-08 7:35
Mark Salsbery20-Aug-08 7:35 
GeneralRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
Cedric Moonen19-Aug-08 23:23
Cedric Moonen19-Aug-08 23:23 
QuestionRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
CPallini20-Aug-08 0:24
mveCPallini20-Aug-08 0:24 
AnswerRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
David Crow20-Aug-08 3:33
David Crow20-Aug-08 3:33 
Questionhow to implement sample code for playing sounds Pin
simon alec smith19-Aug-08 22:54
simon alec smith19-Aug-08 22:54 
I have found this code on one of the articles

How do I implement this code in mfc
to play a number of sounds at the
same time

thank v much
simon


using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace SoundPlayerBug
{
public static class SoundPlayerAsync
{
[DllImport("winmm.dll", SetLastError = true)]
public static extern bool PlaySound(byte[] ptrToSound,
System.UIntPtr hmod, uint fdwSound);

[DllImport("winmm.dll", SetLastError = true)]
public static extern bool PlaySound(IntPtr ptrToSound,
System.UIntPtr hmod, uint fdwSound);

static private GCHandle? gcHandle = null;
private static byte[] bytesToPlay = null;
private static byte[] BytesToPlay
{
get { return bytesToPlay; }
set
{
FreeHandle();
bytesToPlay = value;
}
}

public static void PlaySound(System.IO.Stream stream)
{
PlaySound(stream, SoundFlags.SND_MEMORY | SoundFlags.SND_ASYNC);
}

public static void PlaySound(System.IO.Stream stream, SoundFlags flags)
{
LoadStream(stream);
flags |= SoundFlags.SND_ASYNC;
flags |= SoundFlags.SND_MEMORY;

if (BytesToPlay != null)
{
gcHandle = GCHandle.Alloc(BytesToPlay, GCHandleType.Pinned);
PlaySound(gcHandle.Value.AddrOfPinnedObject(), (UIntPtr)0, (uint)flags);
}
else
{
PlaySound((byte[])null, (UIntPtr)0, (uint)flags);
}
}

private static void LoadStream(System.IO.Stream stream)
{
if (stream != null)
{
byte[] bytesToPlay = new byte[stream.Length];
stream.Read(bytesToPlay, 0, (int)stream.Length);
BytesToPlay = bytesToPlay;
}
else
{
BytesToPlay = null;
}
}

private static void FreeHandle()
{
if (gcHandle != null)
{
PlaySound((byte[])null, (UIntPtr)0, (uint)0);
gcHandle.Value.Free();
gcHandle = null;
}
}
}

[Flags]
public enum SoundFlags : int
{
SND_SYNC = 0x0000, // play synchronously (default)
SND_ASYNC = 0x0001, // play asynchronously
SND_NODEFAULT = 0x0002, // silence (!default) if sound not found
SND_MEMORY = 0x0004, // pszSound points to a memory file
SND_LOOP = 0x0008, // loop the sound until next sndPlaySound
SND_NOSTOP = 0x0010, // don't stop any currently playing sound
SND_NOWAIT = 0x00002000, // don't wait if the driver is busy
SND_ALIAS = 0x00010000, // name is a registry alias
SND_ALIAS_ID = 0x00110000, // alias is a predefined id
SND_FILENAME = 0x00020000, // name is file name
}
}
AnswerRe: how to implement sample code for playing sounds Pin
KarstenK19-Aug-08 23:10
mveKarstenK19-Aug-08 23:10 
JokeRe: how to implement sample code for playing sounds Pin
Rajesh R Subramanian19-Aug-08 23:22
professionalRajesh R Subramanian19-Aug-08 23:22 
GeneralRe: how to implement sample code for playing sounds Pin
simon alec smith19-Aug-08 23:31
simon alec smith19-Aug-08 23:31 
AnswerRe: how to implement sample code for playing sounds Pin
Hamid_RT20-Aug-08 2:16
Hamid_RT20-Aug-08 2:16 
QuestionDisplay an Html File Pin
vinay_K19-Aug-08 22:53
vinay_K19-Aug-08 22:53 
AnswerRe: Display an Html File Pin
Rajesh R Subramanian19-Aug-08 22:59
professionalRajesh R Subramanian19-Aug-08 22:59 
QuestionHow can remove SystemDSN programaticaly? [modified] Pin
Le@rner19-Aug-08 21:43
Le@rner19-Aug-08 21:43 
AnswerRe: How can remove SystemDSN programaticaly? Pin
Rajesh R Subramanian19-Aug-08 22:57
professionalRajesh R Subramanian19-Aug-08 22:57 
Questionerror C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
Dhiraj kumar Saini19-Aug-08 21:21
Dhiraj kumar Saini19-Aug-08 21:21 
AnswerRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
Hamid_RT19-Aug-08 21:22
Hamid_RT19-Aug-08 21:22 
GeneralRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
Stephen Hewitt19-Aug-08 21:32
Stephen Hewitt19-Aug-08 21:32 
GeneralRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
Dhiraj kumar Saini19-Aug-08 21:39
Dhiraj kumar Saini19-Aug-08 21:39 
GeneralRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
Stephen Hewitt19-Aug-08 21:40
Stephen Hewitt19-Aug-08 21:40 
AnswerRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' [modified] Pin
_AnsHUMAN_ 19-Aug-08 21:28
_AnsHUMAN_ 19-Aug-08 21:28 
QuestionRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
CPallini19-Aug-08 21:42
mveCPallini19-Aug-08 21:42 
AnswerRe: error C2039: 'QueryStringValue' : is not a member of 'CRegKey' Pin
Stephen Hewitt19-Aug-08 21:42
Stephen Hewitt19-Aug-08 21:42 
QuestionHow to post a message from MainFrm to the dialog , psl adv Pin
ptr_Electron19-Aug-08 21:19
ptr_Electron19-Aug-08 21:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.