Hi,
I'm making a program with an edit box. It's kind of like notepad, but it will not have any menus or buttons, you will control the program by entering commands in the edit box. If I want to save the text that's in the edit box I would go /s C:\file.txt <enter>
To do this I have subclassed the edit box. As soon as the user types a slash (/) I set bSlash = true and when I press enter i set bSlash = false again. While bSlash is equal true I copy every character that I type to a string, but somewhere along the path things messes up...
Code:
LRESULT CALLBACK EditProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
		case WM_KEYUP:
		{
			int iLen;
			iLen = GetWindowTextLength(hwndEdit);
			char *szText;
			szText = new char[iLen + 1];
			GetWindowText(hwndEdit, szText, iLen + 1);

			if(wParam == VK_RETURN)
			{
				bShift = false;
				ParseCommand();
			}

			if(bShift == true && wParam >= 32)
			{
				sCommand += szText[iLen - 1];
			}
			
			if(szText[iLen - 1] == '/')
			{
				bShift = true;
			}

			delete [] szText;
			break;
		}
	
		default:
		{
			break;
		}		
	}

	return CallWindowProc(wndProcOld, hWnd, uMsg, wParam, lParam);
}

void ParseCommand()
{
	MessageBox(NULL, sCommand.c_str(), "sCommand", MB_OK);
	sCommand = "";
} 


Input in the edit box: abc /s "This is a test"
Output in the MessageBox: s "Tiis s    eett"
The number of characters are right but not the caracters them selves... What is wrong?