Hi ya'll.

I have a big problem with this cell phone text editor program. It works, sometimes. I can't seem to get the output of the text correctly. I wonder if someone could point out what's wrong. If you don't have a direct answer, please do not reply because I just need a straightforward solution. Sorry, I'm too beat up already so I figured that I gave this forum a shot. Thanks.




CELLPHONEKEYBOARD.H

Code:
#pragma once

#include "resource.h"


#define MAX_LOADSTRING 100

typedef struct _STGLOBAL
{
	HINSTANCE		hInst;
	HWND			hWnd;

	TCHAR			szTitle[MAX_LOADSTRING];					// The title bar text
	TCHAR			szWindowClass[MAX_LOADSTRING];			// the main window class name

	TCHAR			szInputStr[1024];

	HWND			hEdit;

	_STGLOBAL()
	{
		ZeroMemory(szInputStr, sizeof(TCHAR)* 1024);
	}

}STGLOBAL;



#define		ID_NUMBER0			(1000 + 0)
#define		ID_NUMBER1			(1000 + 1)
#define		ID_NUMBER2			(1000 + 2)
#define		ID_NUMBER3			(1000 + 3)
#define		ID_NUMBER4			(1000 + 4)
#define		ID_NUMBER5			(1000 + 5)
#define		ID_NUMBER6			(1000 + 6)
#define		ID_NUMBER7			(1000 + 7)
#define		ID_NUMBER8			(1000 + 8)
#define		ID_NUMBER9			(1000 + 9)
#define		ID_NUMBER_AS			(1000 + 10)
#define		ID_NUMBER_SH			(1000 + 11)

#define		ID_INPUT_SCREEN			(1000 + 15)

#define		ID_INPUT_UPPERCASE		(1000 + 16)
#define		ID_INPUT_LOWERCASE		(1000 + 17)
#define		ID_INPUT_NUMERIC		(1000 + 18)
#define		ID_INPUT_SYMBOLS		(1000 + 19)

#define		ID_INPUT_UP				(1000 + 20)
#define		ID_INPUT_DOWN			(1000 + 21)
#define		ID_INPUT_LEFT			(1000 + 22)
#define		ID_INPUT_RIGHT			(1000 + 23)


extern STGLOBAL g_stGlobal;

CMOBILEEDITOR.H

Code:
#ifndef __CMOBILEEDITBOX_H__
#define __CMOBILEEDITBOX_H__

/******************************************************************************
Name : CMobileEditbox.h  (CB:Black)
Desc : ...


-Writed By Uranus at 2008-03-07  11:25:59
******************************************************************************/
#pragma once



#define		ID_CARET_SHIFT_TIMER		1000

typedef enum _eInInputType
{
	eInLowerCase = 0, eInUpperCase , eInNumeric, eInSymbols
}eInInputType;

class CMobileEditbox
{

///////////////////////////////////////////////////////////////////////////////////////
// Method
public:
	bool Create(HWND hWnd);
	int	GetLength(TCHAR* lpszStr, int nLen, SIZE& sz);		// calculate caret.
	void RenderString();									// draw string.

	void InputChar(BYTE nInput);						// input character
	void SetCaretPostion();								// set position of pixel.
	void SetInputType(eInInputType eType);					// set input type (uppercase, lowercase, number.symbols)

	void MoveCaretUP();								// caret's position move line up.
	void MoveCaretDown();								// caret's position move line down.
	void MoveCaretLeft();								// caret's position move left.
	void MoveCaretRight();								// caret's position move right.
	void MoveCaretHome();								// caret's position move 0.
	void MoveCaretEnd();								// caret's position move end.

	int  GetLinePositionFromCurrentLine();


	BOOL WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam);			// windows message process 

	inline void SetHwnd(HWND hWnd) { m_hWnd = hWnd;}

protected:
private:

///////////////////////////////////////////////////////////////////////////////////////
// Attribute
public:
	HWND				m_hWnd;
	TCHAR				m_szEdit[1024];
	RECT				m_rtDest;
					
	int					m_nCaretPosX;				// Caret coordination, X
	int					m_nCaretPosY;				// Caret coordination, Y
	int					m_nLineCount;				// current line 
					

	int					m_nInputPosition;				// current character point;
	eInInputType			m_eInType;					// input types
	BYTE				m_cInputKind;				// it's able to input 1 character of 3 character.(ex, a,b,c)
	BYTE				m_cPreviousInput;				// the previous input value.
	int					m_nTickTime;					// tick time. for shift caret
	bool					m_bIsShifted;					// states if a character has been set with the timer



protected:
private:
	

	

///////////////////////////////////////////////////////////////////////////////////////
// Constructor & Destructor
public:
	CMobileEditbox();
	virtual ~CMobileEditbox();

	void Initialize();
	void ReleaseAll();

};



#endif //__CMOBILEEDITBOX_H__
RESOURCE.H

Code:
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by CellPhoneKeyboard.rc
//

#define IDS_APP_TITLE			103

#define IDR_MAINFRAME			128
#define IDD_CELLPHONEKEYBOARD_DIALOG	102
#define IDD_ABOUTBOX			103
#define IDM_ABOUT				104
#define IDM_EXIT				105
#define IDI_CELLPHONEKEYBOARD			107
#define IDI_SMALL				108
#define IDC_CELLPHONEKEYBOARD			109
#define IDC_MYICON				2
#ifndef IDC_STATIC
#define IDC_STATIC				-1
#endif
// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS

#define _APS_NO_MFC					130
#define _APS_NEXT_RESOURCE_VALUE	129
#define _APS_NEXT_COMMAND_VALUE		32771
#define _APS_NEXT_CONTROL_VALUE		1000
#define _APS_NEXT_SYMED_VALUE		110
#endif
#endif
STDAFX.H

Code:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER				// Allow use of features specific to Windows XP or later.
#define WINVER 0x0501		// Change this to the appropriate value to target other versions of Windows.
#endif

#ifndef _WIN32_WINNT		// Allow use of features specific to Windows XP or later.                   
#define _WIN32_WINNT 0x0501	// Change this to the appropriate value to target other versions of Windows.
#endif						

#ifndef _WIN32_WINDOWS		// Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif

#ifndef _WIN32_IE			// Allow use of features specific to IE 6.0 or later.
#define _WIN32_IE 0x0600	// Change this to the appropriate value to target other versions of IE.
#endif

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>

// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>

#include <stdio.h>
#include <stdlib.h>

// TODO: reference additional headers your program requires here
continued...