Click here to Skip to main content
16,008,299 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Unicode Release problem Pin
JonEngle6-Dec-05 6:49
JonEngle6-Dec-05 6:49 
Questionto find ASCII No, of each character in a string Pin
sheshidar4-Dec-05 23:12
sheshidar4-Dec-05 23:12 
AnswerRe: to find ASCII No, of each character in a string Pin
khan++4-Dec-05 23:34
khan++4-Dec-05 23:34 
GeneralRe: to find ASCII No, of each character in a string Pin
sheshidar4-Dec-05 23:57
sheshidar4-Dec-05 23:57 
AnswerRe: to find ASCII No, of each character in a string Pin
Cedric Moonen4-Dec-05 23:38
Cedric Moonen4-Dec-05 23:38 
AnswerRe: to find ASCII No, of each character in a string Pin
ThatsAlok4-Dec-05 23:48
ThatsAlok4-Dec-05 23:48 
QuestionPlaySound return value is wrong on XP? Pin
Moak4-Dec-05 23:06
Moak4-Dec-05 23:06 
GeneralRe: PlaySound return value is wrong on XP? code snippet Pin
Moak5-Dec-05 0:37
Moak5-Dec-05 0:37 
Here some code to reproduce the problem I described:

#include <mmsystem.h> // also link Winmm.lib 

void CTestsoundDlg::OnOK()  //this version does NOT work as expected on WinXP
{
    CString sOutput;
    CString sFileName = "soundfile.wav";
    
    if(!PlaySound(sFileName, NULL, SND_FILENAME + SND_ASYNC + SND_NODEFAULT))
    {
        sOutput.Format("Playing sound file '%s' failed... %s (returned %d)", 
            (LPCSTR)sFileName, GetLastError()==ERROR_SUCCESS?"OK":"ERROR", GetLastError());
    } else {
        sOutput.Format("Playing sound file '%s' sucessfull... %s (returned %d)", 
            (LPCSTR)sFileName, GetLastError()==ERROR_SUCCESS?"OK":"ERROR", GetLastError());
    }

    m_list.AddString(sOutput); // e.g. output result into an unsorted listbox
    m_list.AddString("");
}

A possible workaround that works for Win9x and WinXP, please comment.
void CTestsoundDlg::OnOK() 
{
    CString sOutput;
    CString sFileName = "soundfile.wav";
    
    SetLastError(ERROR_SUCCESS);
    PlaySound(sFileName, NULL, SND_FILENAME + SND_ASYNC + SND_NODEFAULT);
    if(GetLastError()!=ERROR_SUCCESS) //note: fix for Windows XP because SoundFile() always returns TRUE
    {
        sOutput.Format("Playing sound file '%s' failed... %s (returned %d)", 
            (LPCSTR)sFileName, GetLastError()==ERROR_SUCCESS?"OK":"ERROR", GetLastError());
    } else {
        sOutput.Format("Playing sound file '%s' sucessfull... %s (returned %d)", 
            (LPCSTR)sFileName, GetLastError()==ERROR_SUCCESS?"OK":"ERROR", GetLastError());
    }

    m_list.AddString(sOutput); // e.g. output result into an unsorted listbox
    m_list.AddString("");
}

QuestionRe: PlaySound return value is wrong on XP? Pin
David Crow5-Dec-05 3:51
David Crow5-Dec-05 3:51 
GeneralRe: PlaySound return value is wrong on XP? Pin
Moak6-Dec-05 0:06
Moak6-Dec-05 0:06 
AnswerRe: PlaySound return value is wrong on XP? Pin
normanS5-Dec-05 18:48
normanS5-Dec-05 18:48 
GeneralRe: PlaySound return value is wrong on XP? Pin
Moak6-Dec-05 0:19
Moak6-Dec-05 0:19 
GeneralRe: PlaySound return value is wrong on XP? Pin
normanS6-Dec-05 19:05
normanS6-Dec-05 19:05 
Questionarrow key on help button in C property sheet Pin
simhadri4-Dec-05 22:59
simhadri4-Dec-05 22:59 
Questionarrow key on help button in C property sheet Pin
simhadri4-Dec-05 22:56
simhadri4-Dec-05 22:56 
QuestionCan we automate Microsoft paint? Pin
Ankush Mehta4-Dec-05 22:24
Ankush Mehta4-Dec-05 22:24 
AnswerRe: Can we automate Microsoft paint? Pin
David Crow5-Dec-05 4:02
David Crow5-Dec-05 4:02 
QuestionRe: Can we automate Microsoft paint? Pin
Ankush Mehta5-Dec-05 17:49
Ankush Mehta5-Dec-05 17:49 
AnswerRe: Can we automate Microsoft paint? Pin
David Crow6-Dec-05 2:14
David Crow6-Dec-05 2:14 
Questioncalling OnDraw() from a generic class... Pin
vijayganesh4-Dec-05 21:56
vijayganesh4-Dec-05 21:56 
AnswerRe: calling OnDraw() from a generic class... Pin
khan++4-Dec-05 22:18
khan++4-Dec-05 22:18 
GeneralRe: calling OnDraw() from a generic class... Pin
vijayganesh5-Dec-05 19:07
vijayganesh5-Dec-05 19:07 
GeneralRe: calling OnDraw() from a generic class... Pin
khan++5-Dec-05 19:24
khan++5-Dec-05 19:24 
QuestionExecute Program (Ctrl + F5) doesn't give any response Pin
Boder Coder4-Dec-05 20:57
Boder Coder4-Dec-05 20:57 
AnswerRe: Execute Program (Ctrl + F5) doesn't give any response Pin
khan++4-Dec-05 22:28
khan++4-Dec-05 22:28 

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.