Teach Yourself VC++6 Stuck on Day3

Hi everyone. I have been doing the Sam's Teach Yourself Visal C++6 in 21 days and I am stuck on Day3 already. I was able to create a simple drawing program but the second part wants me to Change the drawing cursor with 'A', 'B', and 'C' using the OnKeyDown function. The first line of code "char 1sChar" gives my 5 errors by itself. Any help would be much appreciated

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void CDay3Dlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default

         char 1sChar;     //The current character being pressed
	HCURSOR 1hCursor;  //The handel to the cursor to be displayed

	//Convert the key pressed to a character
	1sChar = char(nChar);

	//Is the character "A"
	if (1sChar == 'A')
	{
		//Load the arrow cursor
		1hCursor = AfxGetApp() ->LoadStandardCursor(IDC_ARROWu);
		//Set the screen cursor
		SetCursor(1hCursor);
         }
}


Moschops, the 5 errors for the 1st line of code are:

Compiling...
Day3Dlg.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\Day3\Day3Dlg.cpp(243) : error C2059: syntax error : 'bad suffix on number'
C:\Program Files\Microsoft Visual Studio\MyProjects\Day3\Day3Dlg.cpp(243) : warning C4091: '' : ignored on left of 'char' when no variable is declared
C:\Program Files\Microsoft Visual Studio\MyProjects\Day3\Day3Dlg.cpp(243) : error C2143: syntax error : missing ';' before 'constant'
C:\Program Files\Microsoft Visual Studio\MyProjects\Day3\Day3Dlg.cpp(245) : error C2146: syntax error : missing ';' before identifier 'sChar'
C:\Program Files\Microsoft Visual Studio\MyProjects\Day3\Day3Dlg.cpp(245) : error C2065: 'sChar' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\Day3\Day3Dlg.cpp(245) : error C2143: syntax error : missing ';' before 'tag::id'
Last edited on
What are the errors?
A variable can't start with a number. Change that to Char1 (others as well) and then try compiling.
Really, vc6 ?- that is way out of date
Hamsterman, your advice worked. I changed 1sChar to sChar1 and 1hCursor to hCursor1. I have 0 errors and I was able to assign different cursors to many different keys. Thank very much sir!
Topic archived. No new replies allowed.