www.pudn.com > EndpointDetection_Pitch.zip > PerfDlg.cpp


// PerfDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Pitch.h" 
#include "PitchDlg.h" 
#include "PerfDlg.h" 
#include "ScpDlg.h" 
#include "Prompt.h" 
#include  
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
extern BYTE InstrumentNumber; 
extern int IncorrectDialogSwitch; 
extern int PerfectPlayedNote; 
int PerfectPlayedNote; 
extern int PerfectGuessedNote; 
int PerfectGuessedNote; 
 
#define PLAY_BUFFER_LENGTH 128 
#define sharp \x23  
 
extern unsigned int PerfectNoteResults[12][14]; 
extern int LowPianoNote; 
extern int HighPianoNote; 
extern char NoteTable1[]; 
extern char NoteTable2[]; 
extern char NoteDescription[]; 
extern int HighNoteForSoundBlaster; 
extern int HighNoteForRoland; 
extern int PerfectX, PerfectY, PerfectWidth, PerfectHeight; 
extern BYTE CurrentChannel; 
extern BYTE bStatus;      // Midi status byte 
extern BYTE bChannel;	   // Midi channel byte 
extern BYTE bData1;       // First midi data byte 
extern BYTE bData2;       // Second midi data byte    
extern NoteWaitTimeLength; 
extern int PreferencesPrompt; 
extern HWND myHWND; 
extern int currentDialog; 
 
MSG PerfectMessage;                                                             
     
static char PerfectPlayNoteStatus[7]; 
static int RandomNote; 
static int RandomWork = 0; 
static int LastRandomNote = 0; 
static int NoteSwitch = 1; 
static int AdjustedNote; 
static int PerfectCorrect = 0; 
static int PerfectGuesses = 0; 
static int JustResetingSwitch = 0; 
int PerfectTimerKey; 
int PerfectWaitLength = 250;    // 250 milliseconds 
int PerfectTimerWaitSwitch = 0; 
char charresultP[4]; 
char score_workP[24]; 
char PerfectFont[30]; 
int PerfectThickness; 
BOOL ResNoteA;   BOOL ResShowA; 
BOOL ResNoteAs;  BOOL ResShowAs; 
BOOL ResNoteB;   BOOL ResShowB; 
BOOL ResNoteC;   BOOL ResShowC; 
BOOL ResNoteCs;  BOOL ResShowCs; 
BOOL ResNoteD;   BOOL ResShowD; 
BOOL ResNoteDs;  BOOL ResShowDs; 
BOOL ResNoteE;   BOOL ResShowE; 
BOOL ResNoteF;   BOOL ResShowF; 
BOOL ResNoteFs;  BOOL ResShowFs; 
BOOL ResNoteG;   BOOL ResShowG; 
BOOL ResNoteGs;  BOOL ResShowGs; 
 
///////////////////////////////////////////////////////////////////////////// 
// CPerfDlg dialog 
 
CPerfDlg::CPerfDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CPerfDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CPerfDlg) 
	m_perfect_comments = _T(""); 
	m_perfect_low_note = _T(""); 
	m_perfect_high_note = _T(""); 
	m_Perfect_Low_Scroll_Position = 25;     // Default low is note C2 
	m_Perfect_High_Scroll_Position= 76;     // Default high is E6 
	m_Perfect_Scroll_Min = 1; 
	m_Perfect_Scroll_Max = 104;  
	//}}AFX_DATA_INIT 
} 
 
void CPerfDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CPerfDlg) 
	DDX_Control(pDX, IDC_PerfectTitle, m_PerfectTitle); 
	DDX_Control(pDX, IDC_PerfectPlayNote, m_PerfectPlayNote); 
	DDX_Control(pDX, IDC_PerfectScore, m_PerfectScore); 
	DDX_Control(pDX, IDC_NOTE_A, m_notea); 
	DDX_Control(pDX, IDC_NOTE_AS, m_noteas); 
	DDX_Control(pDX, IDC_NOTE_B, m_noteb); 
	DDX_Control(pDX, IDC_NOTE_C, m_notec); 
	DDX_Control(pDX, IDC_NOTE_CS, m_notecs); 
	DDX_Control(pDX, IDC_NOTE_D, m_noted); 
	DDX_Control(pDX, IDC_NOTE_DS, m_noteds); 
	DDX_Control(pDX, IDC_NOTE_E, m_notee); 
	DDX_Control(pDX, IDC_NOTE_F, m_notef); 
	DDX_Control(pDX, IDC_NOTE_FS, m_notefs); 
	DDX_Control(pDX, IDC_NOTE_G, m_noteg); 
	DDX_Control(pDX, IDC_NOTE_GS, m_notegs); 
	DDX_Control(pDX, IDC_SHOW_GS, m_showgs); 
	DDX_Control(pDX, IDC_SHOW_G, m_showg); 
	DDX_Control(pDX, IDC_SHOW_FS, m_showfs); 
	DDX_Control(pDX, IDC_SHOW_F, m_showf); 
	DDX_Control(pDX, IDC_SHOW_E, m_showe); 
	DDX_Control(pDX, IDC_SHOW_DS, m_showds); 
	DDX_Control(pDX, IDC_SHOW_D, m_showd); 
	DDX_Control(pDX, IDC_SHOW_CS, m_showcs); 
	DDX_Control(pDX, IDC_SHOW_C, m_showc); 
	DDX_Control(pDX, IDC_SHOW_B, m_showb); 
	DDX_Control(pDX, IDC_SHOW_AS, m_showas); 
	DDX_Control(pDX, IDC_SHOW_A, m_showa); 
	DDX_Text(pDX, IDC_PERFECT_COMMENTS, m_perfect_comments); 
	DDX_Text(pDX, IDC_PERFECT_LOW_NOTE, m_perfect_low_note); 
	DDX_Text(pDX, IDC_PERFECT_HIGH_NOTE, m_perfect_high_note); 
	DDX_Control(pDX, IDC_PERFECT_LOW_RANGE, m_perfect_low_range); 
	DDX_Control(pDX, IDC_PERFECT_HIGH_RANGE, m_perfect_high_range); 
	DDX_Control(pDX, IDC_GetOutOfPerfect, m_GetOutOfPerfect); 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CPerfDlg, CDialog) 
	//{{AFX_MSG_MAP(CPerfDlg) 
	ON_WM_HSCROLL() 
	ON_WM_RBUTTONDOWN() 
	ON_WM_DESTROY() 
	ON_WM_TIMER() 
	ON_BN_CLICKED(IDC_GetOutOfPerfect, OnGetOutOfPerfect) 
	ON_BN_CLICKED(IDC_PerfectScore, OnPerfectScore) 
	ON_BN_CLICKED(IDC_PerfectPlayNote, OnPerfectPlayNote) 
	ON_BN_CLICKED(IDC_NOTE_A, OnNoteA) 
	ON_BN_CLICKED(IDC_NOTE_AS, OnNoteAs) 
	ON_BN_CLICKED(IDC_NOTE_B, OnNoteB) 
	ON_BN_CLICKED(IDC_NOTE_C, OnNoteC) 
	ON_BN_CLICKED(IDC_NOTE_CS, OnNoteCs) 
	ON_BN_CLICKED(IDC_NOTE_D, OnNoteD) 
	ON_BN_CLICKED(IDC_NOTE_DS, OnNoteDs) 
	ON_BN_CLICKED(IDC_NOTE_E, OnNoteE) 
	ON_BN_CLICKED(IDC_NOTE_F, OnNoteF) 
	ON_BN_CLICKED(IDC_NOTE_FS, OnNoteFs) 
	ON_BN_CLICKED(IDC_NOTE_G, OnNoteG) 
	ON_BN_CLICKED(IDC_NOTE_GS, OnNoteGs) 
	ON_BN_CLICKED(IDC_SHOW_A, OnShowA) 
	ON_BN_CLICKED(IDC_SHOW_AS, OnShowAs) 
	ON_BN_CLICKED(IDC_SHOW_B, OnShowB) 
	ON_BN_CLICKED(IDC_SHOW_C, OnShowC) 
	ON_BN_CLICKED(IDC_SHOW_CS, OnShowCs) 
	ON_BN_CLICKED(IDC_SHOW_D, OnShowD) 
	ON_BN_CLICKED(IDC_SHOW_DS, OnShowDs) 
	ON_BN_CLICKED(IDC_SHOW_E, OnShowE) 
	ON_BN_CLICKED(IDC_SHOW_F, OnShowF) 
	ON_BN_CLICKED(IDC_SHOW_FS, OnShowFs) 
	ON_BN_CLICKED(IDC_SHOW_G, OnShowG) 
	ON_BN_CLICKED(IDC_SHOW_GS, OnShowGs) 
	ON_MESSAGE(UWM_PerfectButtonMove, OnPerfectButtonMove) 
	ON_MESSAGE(UWM_PerfectButtonLeave, OnPerfectButtonLeave) 
	ON_BN_CLICKED(IDC_PerfectTitle, OnPerfectTitle) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CPerfDlg message handlers 
 
 BOOL CPerfDlg::OnInitDialog()                                            
{ 
	CDialog::OnInitDialog(); 
	// Set the Perfect window to where it finished last time 
	MoveWindow(PerfectX, PerfectY, PerfectWidth, PerfectHeight, TRUE); 
 
	CScrollBar* pSB_Low  = (CScrollBar*) GetDlgItem(IDC_PERFECT_LOW_RANGE); 
	CScrollBar* pSB_High = (CScrollBar*) GetDlgItem(IDC_PERFECT_HIGH_RANGE);  
  pSB_Low  ->SetScrollRange(m_Perfect_Scroll_Min, m_Perfect_Scroll_Max);  
    pSB_High ->SetScrollRange(m_Perfect_Scroll_Min, m_Perfect_Scroll_Max);  
    pSB_Low  ->SetScrollPos(m_Perfect_Low_Scroll_Position);              
    pSB_High ->SetScrollPos(m_Perfect_High_Scroll_Position);             
  strncpy(NoteDescription,NoteTable1 + (m_Perfect_Low_Scroll_Position-1)*3, 3);  
    m_perfect_low_note = NoteDescription;  
	strncpy(NoteDescription,NoteTable1 + (m_Perfect_High_Scroll_Position-1)*3, 3);  
    m_perfect_high_note = NoteDescription;  
	GetDlgItem(IDC_PerfectPlayNote) ->EnableWindow(FALSE);   // No play until a note selected  
	strcpy(PerfectPlayNoteStatus,"Play"); 
	m_PerfectPlayNote.SetWindowText(PerfectPlayNoteStatus); 
	m_PerfectPlayNote.SetShade(SHS_SOFTBUMP,6,30); 
	m_PerfectPlayNote.SetTextColor(GreenColour); 
	m_PerfectPlayNote.SetFont("Signature",24,20); 
	m_GetOutOfPerfect.SetShade(SHS_SOFTBUMP,6,30); 
	m_GetOutOfPerfect.SetTextColor(RedColour); 
	m_GetOutOfPerfect.SetFont("Signature",24,20); 
	m_PerfectScore.SetShade(SHS_SOFTBUMP,6,30); 
	m_PerfectScore.SetTextColor(BlueColour); 
	m_PerfectScore.SetFont("Signature",24,20); 
 
	strcpy(PerfectFont,"Comic Sans MS"); 
	PerfectThickness = 2000; 
 
	m_notea.SetShade(SHS_METAL,8,60); 
	m_notea.SetTextColor(RedColour); 
	m_notea.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_notea.SetWindowText("A"); 
 
	m_noteas.SetShade(SHS_METAL,8,30); 
	m_noteas.SetTextColor(RedColour); 
	m_noteas.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_noteas.SetWindowText("A#"); 
 
	m_noteb.SetShade(SHS_METAL,8,30); 
	m_noteb.SetTextColor(RedColour); 
	m_noteb.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_noteb.SetWindowText("B"); 
 
	m_notec.SetShade(SHS_METAL,8,30); 
	m_notec.SetTextColor(RedColour); 
	m_notec.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_notec.SetWindowText("C"); 
 
	m_notecs.SetShade(SHS_METAL,8,30); 
	m_notecs.SetTextColor(RedColour); 
	m_notecs.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_notecs.SetWindowText("C#"); 
 
	m_noted.SetShade(SHS_METAL,8,30); 
	m_noted.SetTextColor(RedColour); 
	m_noted.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_noted.SetWindowText("D"); 
 
	m_noteds.SetShade(SHS_METAL,8,30); 
	m_noteds.SetTextColor(RedColour); 
	m_noteds.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_noteds.SetWindowText("D#"); 
 
	m_notee.SetShade(SHS_METAL,8,30); 
	m_notee.SetTextColor(RedColour); 
	m_notee.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_notee.SetWindowText("E"); 
 
	m_notef.SetShade(SHS_METAL,8,30); 
	m_notef.SetTextColor(RedColour); 
	m_notef.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_notef.SetWindowText("F"); 
 
	m_notefs.SetShade(SHS_METAL,8,30); 
	m_notefs.SetTextColor(RedColour); 
	m_notefs.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_notefs.SetWindowText("F#"); 
 
	m_noteg.SetShade(SHS_METAL,8,30); 
	m_noteg.SetTextColor(RedColour); 
	m_noteg.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_noteg.SetWindowText("G"); 
 
	m_notegs.SetShade(SHS_METAL,8,30); 
	m_notegs.SetTextColor(RedColour); 
	m_notegs.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_notegs.SetWindowText("G#"); 
 
	m_showa.SetShade(SHS_METAL,8,60); 
	m_showa.SetTextColor(RedColour); 
	m_showa.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showa.SetWindowText("A"); 
 
	m_showas.SetShade(SHS_METAL,8,30); 
	m_showas.SetTextColor(RedColour); 
	m_showas.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showas.SetWindowText("A#"); 
 
	m_showb.SetShade(SHS_METAL,8,30); 
	m_showb.SetTextColor(RedColour); 
	m_showb.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showb.SetWindowText("B"); 
 
	m_showc.SetShade(SHS_METAL,8,30); 
	m_showc.SetTextColor(RedColour); 
	m_showc.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showc.SetWindowText("C"); 
 
	m_showcs.SetShade(SHS_METAL,8,30); 
	m_showcs.SetTextColor(RedColour); 
	m_showcs.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showcs.SetWindowText("C#"); 
 
	m_showd.SetShade(SHS_METAL,8,30); 
	m_showd.SetTextColor(RedColour); 
	m_showd.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showd.SetWindowText("D"); 
 
	m_showds.SetShade(SHS_METAL,8,30); 
	m_showds.SetTextColor(RedColour); 
	m_showds.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showds.SetWindowText("D#"); 
 
	m_showe.SetShade(SHS_METAL,8,30); 
	m_showe.SetTextColor(RedColour); 
	m_showe.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showe.SetWindowText("E"); 
 
	m_showf.SetShade(SHS_METAL,8,30); 
	m_showf.SetTextColor(RedColour); 
	m_showf.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showf.SetWindowText("F"); 
 
	m_showfs.SetShade(SHS_METAL,8,30); 
	m_showfs.SetTextColor(RedColour); 
	m_showfs.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showfs.SetWindowText("F#"); 
 
	m_showg.SetShade(SHS_METAL,8,30); 
	m_showg.SetTextColor(RedColour); 
	m_showg.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showg.SetWindowText("G"); 
 
	m_showgs.SetShade(SHS_METAL,8,30); 
	m_showgs.SetTextColor(RedColour); 
	m_showgs.SetFont(PerfectFont,18,PerfectThickness,1); 
	m_showgs.SetWindowText("G#"); 
 
 
 
	m_PerfectTitle.SetShade(SHS_METAL,8,30); 
	m_PerfectTitle.SetTextColor(PurpleColour); 
	m_PerfectTitle.SetFont("Signature",64,20); 
	m_PerfectTitle.SetWindowText("Perfect Pitch"); 
 
	 
	UpdateData(FALSE); 
	KillShowCheckBoxes();  // Do not allow answers until user selects a note 
 
	currentDialog = PerfectDialog; 
 
	return TRUE;  // return TRUE  unless you set the focus to a control 
} 
 
void CPerfDlg::OnPerfectPlayNote()  
{ 
	int StopInfiniteLoop = 0; 
	int icount; 
	long MidiErr = 0; 
	CPitchDlg GetNumb; 
	CPitchDlg PlayTime; 
	 
if (strcmp(PerfectPlayNoteStatus,"Replay")) 
	{} else 
	{ 
		PerfectReplayNotes(); 
		goto PlayNoteFinalExit; 
	} 
	// While note is played and before an answer is ticked, 
	//  disable the note check boxes 
	JustResetingSwitch = 1; 
    m_notea.EnableWindow(FALSE); 
    m_noteas.EnableWindow(FALSE); 
    m_noteb.EnableWindow(FALSE); 
    m_notec.EnableWindow(FALSE); 
    m_notecs.EnableWindow(FALSE); 
    m_noted.EnableWindow(FALSE); 
    m_noteds.EnableWindow(FALSE); 
    m_notee.EnableWindow(FALSE); 
    m_notef.EnableWindow(FALSE); 
    m_notefs.EnableWindow(FALSE); 
    m_noteg.EnableWindow(FALSE); 
    m_notegs.EnableWindow(FALSE); 
	// Clear any values in tick boxes 
	ClearShowTicks(); 
	JustResetingSwitch = 0; 
TopOfNoteSearch: 
	StopInfiniteLoop++; 
	if (LowPianoNote < HighPianoNote) 
		{RandomNote = GetNumb.GetARandomNumber(LowPianoNote,HighPianoNote);}  
	else 
		{RandomNote = GetNumb.GetARandomNumber(HighPianoNote,LowPianoNote);} ; 
//   If user only is checking one note(God knows why, we could end up rejecting  
//    all random notes, so after 50 attempts, we will allow an equal note. 
	if ((RandomNote == LastRandomNote) & (StopInfiniteLoop > 50)) 
		{goto BypassNotTheSameCheck;}; 
	 
	if ((RandomNote == LastRandomNote) & (LowPianoNote != HighPianoNote)) 
		{goto TopOfNoteSearch;};   //  Not two in a row please, unless no range 
    //  Get description from Note Table 
BypassNotTheSameCheck: 
    strncpy(NoteDescription,NoteTable1 + (RandomNote)*3, 3);  
    AdjustedNote = ((RandomNote+3)%12) + 1; 
    if(ResNoteA & (AdjustedNote == 1)) 
    	{goto NoteFound;} 
    if(ResNoteAs &  (AdjustedNote == 2)) 
    	{goto NoteFound;} 
    if(ResNoteB &  (AdjustedNote == 3)) 
    	{goto NoteFound;} 
    if(ResNoteC &  (AdjustedNote == 4)) 
    	{goto NoteFound;} 
    if(ResNoteCs &  (AdjustedNote == 5)) 
    	{goto NoteFound;} 
    if(ResNoteD &  (AdjustedNote == 6)) 
    	{goto NoteFound;} 
    if(ResNoteDs & (AdjustedNote == 7)) 
    	{goto NoteFound;} 
    if(ResNoteE & (AdjustedNote == 8)) 
    	{goto NoteFound;} 
    if(ResNoteF & (AdjustedNote == 9)) 
    	{goto NoteFound;} 
    if(ResNoteFs & (AdjustedNote == 10)) 
    	{goto NoteFound;} 
    if(ResNoteG & (AdjustedNote == 11)) 
    	{goto NoteFound;} 
    if(ResNoteGs & (AdjustedNote == 12)) 
    	{goto NoteFound;} 
	if (StopInfiniteLoop < 250) {goto TopOfNoteSearch;}; 
 
	goto PlayNoteProblem; 
// We have found a random note which is also in users selection list 
NoteFound: 
	//char debug_note_comment[14]; 
	//strcpy(debug_note_comment,"Note is "); 
    //strcat(debug_note_comment,NoteDescription); 
    //m_perfect_comments = debug_note_comment; 
	//UpdateData(FALSE); 
	MidiErr = PlayPerfectNote(RandomNote); 
	goto PlayNoteExit; 
 
PlayNoteProblem: 
    UpdateData(FALSE); 
	MessageBox("Please select a note that falls within the range!!!");      
	for (icount = 1;icount < 13; icount++) 
		{A_Selection_Clicked_Routine(icount);}; 
	KillShowCheckBoxes(); 
    m_perfect_comments = "";   // Wipe out last comment 
    UpdateData(FALSE); 
    //  Allow play to be done. 
    GetDlgItem(IDC_PerfectPlayNote) ->EnableWindow(TRUE);              
	strcpy(PerfectPlayNoteStatus,"Play"); 
	m_PerfectPlayNote.SetWindowText(PerfectPlayNoteStatus); 
    EnableSelectionCheckBoxes(); 
    goto PlayNoteFinalExit; 
// Now we can enable all the selection boxes and the show check boxes the user selected 
//  and disable the play button until the user responds 
PlayNoteExit: 
	for (icount = 1;icount < 13; icount++) 
		{A_Selection_Clicked_Routine(icount);}; 
	EnableShowCheckBoxes(); 
    m_perfect_comments = "";   // Wipe out last comment 
    UpdateData(FALSE); 
    //  Allow replay to be done. 
	strcpy(PerfectPlayNoteStatus,"Replay"); 
	m_PerfectPlayNote.SetWindowText(PerfectPlayNoteStatus); 
    KillSelectionCheckBoxes(); 
PlayNoteFinalExit: 
    LastRandomNote = RandomNote; 
} 
 
void CPerfDlg::PerfectReplayNotes()  
{ 
	long MidiErr = 0; 
    MidiErr = PlayPerfectNote(RandomNote); 
} 
 
BEGIN_EVENTSINK_MAP(CPerfDlg, CDialog) 
    //{{AFX_EVENTSINK_MAP(CPerfDlg) 
//	ON_EVENT(CPerfDlg, IDC_PERFECT_SCORE, -605 /* MouseDown */, OnMouseDown, VTS_I2 VTS_I2 VTS_I4 VTS_I4) 
//	ON_EVENT(CPerfDlg, IDC_PERFECT_SCORE, -605 /* MouseDown */, OnMouseUp, VTS_I2 VTS_I2 VTS_I4 VTS_I4) 
	//}}AFX_EVENTSINK_MAP 
END_EVENTSINK_MAP() 
 
 
 
 
void CPerfDlg::OnGetOutOfPerfect()  
{	CDialog::OnOK();	 
} 
 
void CPerfDlg::A_Selection_Clicked_Routine(int LocalNoteSwitch) 
{	//  If any check boxes are true, allow PlayNote button to be pushed 
	UpdateData(TRUE); 
	// Am creating a variable with the value as have not found a way 
	//  to directly test if a checkbox is on. 
 	ResNoteA = m_notea.GetCheck();     ResNoteAs = m_noteas.GetCheck(); 
	ResNoteB = m_noteb.GetCheck();     ResNoteC = m_notec.GetCheck(); 
	ResNoteCs = m_notecs.GetCheck();   ResNoteD = m_noted.GetCheck(); 
	ResNoteDs = m_noteds.GetCheck();   ResNoteE = m_notee.GetCheck(); 
	ResNoteF = m_notef.GetCheck();     ResNoteFs = m_notefs.GetCheck(); 
	ResNoteG = m_noteg.GetCheck();     ResNoteGs = m_notegs.GetCheck(); 
	strcpy(PerfectPlayNoteStatus,"Play"); 
	m_PerfectPlayNote.SetWindowText(PerfectPlayNoteStatus); 
	if (ResNoteA  | ResNoteAs | ResNoteB | ResNoteC  | ResNoteCs | ResNoteD | 
		ResNoteDs | ResNoteE  | ResNoteF | ResNoteFs | ResNoteG  | ResNoteGs )	                                    
			{                                                                     
			GetDlgItem(IDC_PerfectPlayNote) ->EnableWindow(TRUE);               
			} 
	else 
			{ 
			GetDlgItem(IDC_PerfectPlayNote) ->EnableWindow(FALSE);              
			}; 
 
	// Now set the colours for both sets of notes 
	if (ResNoteA) 
	{ 
		m_notea.SetTextColor(GreenColour); 
		m_showa.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_notea.SetTextColor(RedColour); 
		m_showa.SetTextColor(RedColour); 
	} 
 
	if (ResNoteAs) 
	{ 
		m_noteas.SetTextColor(GreenColour); 
		m_showas.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_noteas.SetTextColor(RedColour); 
		m_showas.SetTextColor(RedColour); 
	} 
 
	if (ResNoteB) 
	{ 
		m_noteb.SetTextColor(GreenColour); 
		m_showb.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_noteb.SetTextColor(RedColour); 
		m_showb.SetTextColor(RedColour); 
	} 
 
	if (ResNoteC) 
	{ 
		m_notec.SetTextColor(GreenColour); 
		m_showc.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_notec.SetTextColor(RedColour); 
		m_showc.SetTextColor(RedColour); 
	} 
 
	if (ResNoteCs) 
	{ 
		m_notecs.SetTextColor(GreenColour); 
		m_showcs.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_notecs.SetTextColor(RedColour); 
		m_showcs.SetTextColor(RedColour); 
	} 
 
	if (ResNoteD) 
	{ 
		m_noted.SetTextColor(GreenColour); 
		m_showd.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_noted.SetTextColor(RedColour); 
		m_showd.SetTextColor(RedColour); 
	} 
 
	if (ResNoteDs) 
	{ 
		m_noteds.SetTextColor(GreenColour); 
		m_showds.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_noteds.SetTextColor(RedColour); 
		m_showds.SetTextColor(RedColour); 
	} 
 
	if (ResNoteE) 
	{ 
		m_notee.SetTextColor(GreenColour); 
		m_showe.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_notee.SetTextColor(RedColour); 
		m_showe.SetTextColor(RedColour); 
	} 
	if (ResNoteF) 
	{ 
		m_notef.SetTextColor(GreenColour); 
		m_showf.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_notef.SetTextColor(RedColour); 
		m_showf.SetTextColor(RedColour); 
	} 
 
	if (ResNoteFs) 
	{ 
		m_notefs.SetTextColor(GreenColour); 
		m_showfs.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_notefs.SetTextColor(RedColour); 
		m_showfs.SetTextColor(RedColour); 
	} 
 
	if (ResNoteG) 
	{ 
		m_noteg.SetTextColor(GreenColour); 
		m_showg.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_noteg.SetTextColor(RedColour); 
		m_showg.SetTextColor(RedColour); 
	} 
 
	if (ResNoteGs) 
	{ 
		m_notegs.SetTextColor(GreenColour); 
		m_showgs.SetTextColor(GreenColour); 
	} 
	else 
	{ 
		m_notegs.SetTextColor(RedColour); 
		m_showgs.SetTextColor(RedColour); 
	} 
 
 
} 
 
void CPerfDlg::A_Note_Clicked_Routine(int LocalNoteSwitch) 
{ 
    // I think this routine is also entered when I turn off a check box. 
    // So I have set JustResetingSwitch to 1 when I don't really want to come here. 
    char note_comment[14]; 
	if (JustResetingSwitch == 0) 
	{	 
		strcpy(note_comment,"Note was "); 
    	strcat(note_comment,NoteDescription); 
        //  Now add to PerfectNoteResults matrix 
        //  AdjustedNote is the first index as it represents a true index(relative to one) 
        //   into the rows. 
        PerfectNoteResults[AdjustedNote-1][0]++; //  This increases the total for note played  
 		if (AdjustedNote == LocalNoteSwitch) 
			{ 
				PerfectCorrect++; m_perfect_comments = "Correct"; 
				PerfectNoteResults[AdjustedNote-1][1]++;  //  This increases the total for note played correctly 
			} 
		else 
			{ 
				m_perfect_comments = note_comment; 
				// Popup a prompt dialog if he asked for it in preferences 
 
				if (PreferencesPrompt == 1)  
				{ 
					PerfectPlayedNote = RandomNote; 
					PerfectGuessedNote = LocalNoteSwitch ; 
					CPrompt AskUser; 
					AskUser.DoModal(); 
				}; 
			}; 
		 
        PerfectNoteResults[AdjustedNote-1][LocalNoteSwitch+1]++;  //  This increases the total for which note the user guessed 
		UpdateData(FALSE); 
		GetDlgItem(IDC_PerfectPlayNote) ->EnableWindow(TRUE);   // Let user play another note  
		strcpy(PerfectPlayNoteStatus,"Play"); 
		m_PerfectPlayNote.SetWindowText(PerfectPlayNoteStatus); 
		//  Disable show boxes until note is played 
		KillShowCheckBoxes(); 
		EnableSelectionCheckBoxes(); 
		PerfectGuesses++; 
		//ClearShowTicks(); 
	}	 
} 
void CPerfDlg::OnPerfectScore()  
{ 
	// TODO: Add your control notification handler code here 
CScPDlg dlg; 
char score_message[64]; 
char score_analysis[1681]; 
char charwork[12]; 
char *pcharwork; 
char note_work[64] = ""; 
  
	//CFont MyFont; 
	//MyFont.CreateFont   (25,0,0,0,400, 
	//					FALSE,FALSE,0,ANSI_CHARSET, 
	//					OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, 
	//					DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS, 
	//					"Courier New"); 
	//GetDlgItem(IDC_PERFECT_SCORE_DETAILS) ->SetFont(&MyFont); 
	strcpy(score_message, "You have answered "); 
	itoa(PerfectCorrect,charresultP,10); 
	strcat(score_message,charresultP); 
	strcat(score_message," correctly out of "); 
	itoa(PerfectGuesses,charresultP,10); 
	strcat(score_message,charresultP); 
	strcat(score_message," attempts."); 
	dlg.m_perfect_score_summary = score_message; 
 
	strcpy(score_analysis,""); 
	for (int i = 0; i < 12; i++) 
		{ 
	    if (PerfectNoteResults[i][0] != 0) 
	    	{ 
	    	strcpy(note_work,""); strcpy(charwork,""); 
	    	strncpy(charwork,NoteTable2 + ((i)*2) +1, 1);   // is this a hex 23? 
	    	if (charwork == " ") 
	    		{strncpy(note_work,NoteTable2 + (i)*2, 1);}        // white key 
	    	else 
	    		{strncpy(note_work,NoteTable2 + (i)*2, 2);} ;    // black key 
	    		    
			strcat(score_analysis,note_work);               
			strcat(score_analysis,"("); 
			itoa(PerfectNoteResults[i][0],charwork,10); 
			strcat(score_analysis,charwork); 
			strcat(score_analysis,") "); 
		 
			strcat(score_analysis,"Correct("); 
			itoa(PerfectNoteResults[i][1],charwork,10); 
			strcat(score_analysis,charwork); 
			strcat(score_analysis,")  "); // End of correct info 
		 
			for (int j = 2; j < 14; j++)    //  Go through each columns results 
				{ 
	    			if (PerfectNoteResults[i][j] != 0) 
		    			{ 
		    				if (i+2 != j) 
		    				{ 
		    					strcpy(note_work,""); strcpy(charwork,""); 
	    						pcharwork = &charwork[0]; 
	    						strncpy(charwork,NoteTable2 + (j-2)*2 +1, 1);   // is this a space? 
	    						 
	    						if (*pcharwork == ' ') 
	    							{strncpy(note_work,NoteTable2 + (j-2)*2, 1); 
	    							 strncpy(note_work+1,"\0",1); 
	    							} 
	    						else 
	    							{strncpy(note_work,NoteTable2 + (j-2)*2,2);};     
								strcat(score_analysis,note_work);               
								strcat(score_analysis,"("); 
								itoa(PerfectNoteResults[i][j],charwork,10); 
								strcat(score_analysis,charwork); 
								strcat(score_analysis,") "); 
                        	} 
                        } 
		    	}		    	 
			strcat(score_analysis,"\n\n"); 
			} 
		}	//  End of dumping guess results 
	dlg.m_perfect_score_details = score_analysis; 
	//UpdateData(FALSE); 
	 
	//   Save the results in a file for trend statistics 
	//CFile ResultsFile; 
	//ResultsFile.Open("PPITCH.TND", 
	//					CFile::modeCreate|CFile::modeWrite); 
	//ResultsFile.Write(PerfectNoteResults,12*14*4); 
	//ResultsFile.Close; 
 
	dlg.DoModal(); 
 
} 
 
void CPerfDlg::EnableSelectionCheckBoxes()              
{ 
	GetDlgItem(IDC_NOTE_A) ->EnableWindow(TRUE);                            
	GetDlgItem(IDC_NOTE_AS) ->EnableWindow(TRUE);                           
	GetDlgItem(IDC_NOTE_B) ->EnableWindow(TRUE);                            
	GetDlgItem(IDC_NOTE_C) ->EnableWindow(TRUE);                            
	GetDlgItem(IDC_NOTE_CS) ->EnableWindow(TRUE);                          
	GetDlgItem(IDC_NOTE_D) ->EnableWindow(TRUE);                            
	GetDlgItem(IDC_NOTE_DS) ->EnableWindow(TRUE);                           
 	GetDlgItem(IDC_NOTE_E) ->EnableWindow(TRUE);                           
	GetDlgItem(IDC_NOTE_F) ->EnableWindow(TRUE);                           
 	GetDlgItem(IDC_NOTE_FS) ->EnableWindow(TRUE);                          
	GetDlgItem(IDC_NOTE_G) ->EnableWindow(TRUE);                            
	GetDlgItem(IDC_NOTE_GS) ->EnableWindow(TRUE);                           
  
} 
 
void CPerfDlg::EnableShowCheckBoxes()              
{ 
	if (ResNoteA)                              
			{GetDlgItem(IDC_SHOW_A) ->EnableWindow(TRUE);};                      
	if (ResNoteAs)                             
			{GetDlgItem(IDC_SHOW_AS) ->EnableWindow(TRUE);};                     
	if (ResNoteB)                              
			{GetDlgItem(IDC_SHOW_B) ->EnableWindow(TRUE);};                      
	if (ResNoteC)                              
			{GetDlgItem(IDC_SHOW_C) ->EnableWindow(TRUE);};                      
	if (ResNoteCs)                             
			{GetDlgItem(IDC_SHOW_CS) ->EnableWindow(TRUE);};                     
	if (ResNoteD)                              
			{GetDlgItem(IDC_SHOW_D) ->EnableWindow(TRUE);};                      
	if (ResNoteDs)                             
			{GetDlgItem(IDC_SHOW_DS) ->EnableWindow(TRUE);};                     
	if (ResNoteE)                              
			{GetDlgItem(IDC_SHOW_E) ->EnableWindow(TRUE);};                      
	if (ResNoteF)                              
			{GetDlgItem(IDC_SHOW_F) ->EnableWindow(TRUE);};                      
	if (ResNoteFs)                            
			{GetDlgItem(IDC_SHOW_FS) ->EnableWindow(TRUE);};                     
	if (ResNoteG)                              
			{GetDlgItem(IDC_SHOW_G) ->EnableWindow(TRUE);};                      
	if (ResNoteGs)                             
			{GetDlgItem(IDC_SHOW_GS) ->EnableWindow(TRUE);};                     
} 
 
void CPerfDlg::KillShowCheckBoxes() 
{ 
	GetDlgItem(IDC_SHOW_A) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_SHOW_AS) ->EnableWindow(FALSE);                          
	GetDlgItem(IDC_SHOW_B) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_SHOW_C) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_SHOW_CS) ->EnableWindow(FALSE);                          
	GetDlgItem(IDC_SHOW_D) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_SHOW_DS) ->EnableWindow(FALSE);                          
	GetDlgItem(IDC_SHOW_E) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_SHOW_F) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_SHOW_FS) ->EnableWindow(FALSE);                          
	GetDlgItem(IDC_SHOW_G) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_SHOW_GS) ->EnableWindow(FALSE);                          
}  
 
void CPerfDlg::KillSelectionCheckBoxes() 
{ 
	GetDlgItem(IDC_NOTE_A) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_NOTE_AS) ->EnableWindow(FALSE);                          
	GetDlgItem(IDC_NOTE_B) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_NOTE_C) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_NOTE_CS) ->EnableWindow(FALSE);                          
	GetDlgItem(IDC_NOTE_D) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_NOTE_DS) ->EnableWindow(FALSE);                          
	GetDlgItem(IDC_NOTE_E) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_NOTE_F) ->EnableWindow(FALSE);                          
	GetDlgItem(IDC_NOTE_FS) ->EnableWindow(FALSE);                          
	GetDlgItem(IDC_NOTE_G) ->EnableWindow(FALSE);                           
	GetDlgItem(IDC_NOTE_GS) ->EnableWindow(FALSE);                          
}  
 
void CPerfDlg::ClearShowTicks() 
{ 
	m_showa.EnableWindow(FALSE); 
	m_showas.EnableWindow(FALSE); 
	m_showb.EnableWindow(FALSE); 
	m_showc.EnableWindow(FALSE); 
	m_showcs.EnableWindow(FALSE); 
	m_showd.EnableWindow(FALSE); 
	m_showds.EnableWindow(FALSE); 
	m_showe.EnableWindow(FALSE); 
	m_showf.EnableWindow(FALSE); 
	m_showfs.EnableWindow(FALSE); 
	m_showg.EnableWindow(FALSE); 
	m_showgs.EnableWindow(FALSE); 
} 
 
void CPerfDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)  
{ 
	int iCurrent; 
	//  PScrollBar is a pointer to the control being updated 
    //  pSB_Low and pSB_High are the pointers to the two range scroll bars 
 
	CScrollBar* pSB_Low  = (CScrollBar*) GetDlgItem(IDC_PERFECT_LOW_RANGE); 
	CScrollBar* pSB_High = (CScrollBar*) GetDlgItem(IDC_PERFECT_HIGH_RANGE);  
    // Get the current position 
    iCurrent = pScrollBar->GetScrollPos();                               
		 
	switch (nSBCode) 
		{ 
		case SB_THUMBPOSITION:                                                 
		pScrollBar->SetScrollPos (nPos);                                       
		break; 
		 
        case SB_LINERIGHT: 
                // Increase current position by 1 (if possible) 
                iCurrent = iCurrent + 1; 
                if ( iCurrent >= m_Perfect_Scroll_Max ) 
                     iCurrent = m_Perfect_Scroll_Max; 
                // Set scroll bar to its new position. 
                pScrollBar->SetScrollPos ( iCurrent );                   
                break; 
 
          case SB_LINELEFT: 
                // Decrease current position by 1 (if possible) 
                iCurrent = iCurrent - 1; 
                if ( iCurrent <= m_Perfect_Scroll_Min ) 
                     iCurrent = m_Perfect_Scroll_Min; 
                // Set scroll bar to its new position. 
                pScrollBar->SetScrollPos ( iCurrent );                   
                break; 
 
          case SB_PAGERIGHT: 
                 // Increase scroll bar by an octave(if possible). 
                iCurrent = iCurrent + 12; 
                if ( iCurrent >= m_Perfect_Scroll_Max ) 
                     iCurrent = m_Perfect_Scroll_Max; 
                // Set scroll bar to its new position. 
                pScrollBar->SetScrollPos ( iCurrent );                   
                break; 
 
          case SB_PAGELEFT: 
                // Decrease scroll bar by an octave(if possible). 
                iCurrent = iCurrent - 12; 
                if ( iCurrent <= m_Perfect_Scroll_Min ) 
                     iCurrent = m_Perfect_Scroll_Min; 
                // Set scroll bar to its new position. 
                pScrollBar->SetScrollPos ( iCurrent );                   
                break; 
 
          case SB_THUMBTRACK:                                            
               // Set scroll bar to its new position. 
               pScrollBar->SetScrollPos ( nPos );                        
               break; 
          } 
 
    // Update the caption of the label.		   
	if (pScrollBar == (CScrollBar*) pSB_Low) 
		  {	strncpy(NoteDescription,NoteTable1 + (iCurrent-1)*3, 3);  
    	  	m_perfect_low_note = NoteDescription;  
    	  	LowPianoNote = iCurrent;	} 
    else 
		  {	strncpy(NoteDescription,NoteTable1 + (iCurrent-1)*3, 3);  
    	  	m_perfect_high_note = NoteDescription;  
    	  	HighPianoNote = iCurrent;	} ; 
	UpdateData(FALSE);      
 
	CDialog::OnHScroll(nSBCode, nPos, pScrollBar); 
} 
 
void CPerfDlg::OnRButtonDown(UINT nFlags, CPoint point)  
{ 
	// Display the pop up menu section on right mouse button down 
	// Have to find out where our dialog is presently sitting 
CRect rect; 
CPoint TL;  
	int x; int y; 
	GetWindowRect(&rect); 
	TL = rect.TopLeft();  
	PerfectX = TL.x;  PerfectY = TL.y; 
	x = point.x + PerfectX + 20; y = point.y + PerfectY + 17; 
	CPitchDlg PopupTime;  
	PopupTime.ProcessPopupMenu(x,y); 
		 
	CDialog::OnRButtonDown(nFlags, point); 
} 
 
 
void CPerfDlg::OnDestroy()  
{ 
	CDialog::OnDestroy(); 
	 
	// Grab the screen location at end for the registry 
	CRect rect; 
	GetWindowRect(&rect); 
	CPoint TL; 
	TL = rect.TopLeft();  
	PerfectX = TL.x;  PerfectY = TL.y; 
	rect.NormalizeRect(); 
	PerfectWidth = rect.Width(); PerfectHeight = rect.Height(); 
} 
 
void CPerfDlg::OnTimer(UINT nIDEvent)  
{	 
	PerfectTimerWaitSwitch = 1; 
	CDialog::OnTimer(nIDEvent); 
} 
 
void CPerfDlg::DoPerfectWait(int PerfectWaitTimeInMilliseconds) 
{ 
	PerfectTimerWaitSwitch = 0; 
//  default is a value of 5 which would be made into 25 milliseconds 
	PerfectTimerKey = SetTimer(1, PerfectWaitTimeInMilliseconds, NULL);                           
	ASSERT(PerfectTimerKey !=0); 
//  Wait until the timer changes RelativeTimerWaitSwitch to non zero.  
//  The PeekMessage will allow the message through 
	while (PerfectTimerWaitSwitch == 0)                                                   
		{if(::PeekMessage(&PerfectMessage, NULL, 0, 0, PM_REMOVE))                    
			{                                                                     
			::TranslateMessage(&PerfectMessage);                                         
			::DispatchMessage(&PerfectMessage);                                          
			}  
        }; 
	KillTimer(PerfectTimerKey);                                                      
} 
 
long CPerfDlg::PlayPerfectNote(int NoteNumber) 
{ 
	CPitchDlg abc; 
	long NoteError = 0; 
	// Send instrument 
	bStatus   = MIDI_PROGRAM_CHANGE; 
	bChannel  = CurrentChannel; 
	bData1    = InstrumentNumber; 
	bData2    = '\x00';  // Not used 
	abc.SendShortMessage(); 
	bStatus   = MIDI_NOTE_ON; 
	bChannel  = CurrentChannel; 
	bData1    = NoteNumber;   
	bData2    = '\x7f';	 // Volume 
	abc.SendShortMessage(); 
	DoPerfectWait(NoteWaitTimeLength); 
	bStatus   = MIDI_NOTE_OFF; 
	bChannel  = CurrentChannel; 
	bData1    = NoteNumber;   
	bData2    = '\x00';	 // Volume 
	abc.SendShortMessage(); 
    return (NoteError); 
} 
 
void CPerfDlg::OnNoteA()  
{ 
	NoteSwitch = 1; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
void CPerfDlg::OnNoteAs()  
{ 
	NoteSwitch = 2; 
	A_Selection_Clicked_Routine(NoteSwitch);	 
} 
 
void CPerfDlg::OnNoteB()  
{ 
	NoteSwitch = 3; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnNoteC()  
{ 
	NoteSwitch = 4; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnNoteCs()  
{ 
	NoteSwitch = 5; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnNoteD()  
{ 
	NoteSwitch = 6; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnNoteDs()  
{ 
	NoteSwitch = 7; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnNoteE()  
{ 
	NoteSwitch = 8; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnNoteF()  
{ 
	NoteSwitch = 9; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnNoteFs()  
{ 
	NoteSwitch = 10; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnNoteG()  
{ 
	NoteSwitch = 11; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnNoteGs()  
{ 
	NoteSwitch = 12; 
	A_Selection_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowA()  
{ 
	NoteSwitch = 1; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowAs()  
{ 
	NoteSwitch = 2; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
void CPerfDlg::OnShowB()  
{ 
	NoteSwitch = 3; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowC()  
{ 
	NoteSwitch = 4; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowCs()  
{ 
	NoteSwitch = 5; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowD()  
{ 
	NoteSwitch = 6; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowDs()  
{ 
	NoteSwitch = 7; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowE()  
{ 
	NoteSwitch = 8; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowF()  
{ 
	NoteSwitch = 9; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
void CPerfDlg::OnShowFs()  
{ 
	NoteSwitch = 10; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowG()  
{ 
	NoteSwitch = 11; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnShowGs()  
{ 
	NoteSwitch = 12; 
	A_Note_Clicked_Routine(NoteSwitch); 
} 
 
void CPerfDlg::OnPerfectButtonMove(UINT nFlags, CPoint point)  
{ 
 
	if (myHWND == m_PerfectScore.GetSafeHwnd() ) 
	{ 
		itoa(PerfectCorrect,charresultP,10); 
		strcpy(score_workP,charresultP); 
		strcat(score_workP,"  of "); 
		itoa(PerfectGuesses,charresultP,10); 
		strcat(score_workP,charresultP); 
		m_PerfectScore.SetWindowText(score_workP); 
		m_PerfectScore.SetFont("Signature",24,20); 
		m_PerfectScore.SetTextColor(PurpleColour); 
		UpdateData(FALSE); 
	} 
	 
  CDialog::OnMouseMove(nFlags, point); 
} 
 
void CPerfDlg::OnPerfectButtonLeave(WPARAM, LPARAM) 
{ 
	if (myHWND == m_PerfectScore.GetSafeHwnd() ) 
	{ 
		m_PerfectScore.SetWindowText("Score"); 
		m_PerfectScore.SetTextColor(GreenColour); 
		m_PerfectScore.SetShade(SHS_METAL,6,30); 
		UpdateData(FALSE); 
	} 
	 
} 
 
 
 
void CPerfDlg::OnPerfectTitle()  
{ 
	// TODO: Add your control notification handler code here 
	 
}