#include "Dialog.h"
#include "resource.h" 

extern HWND hDlgModeless;
HWND t_hDlg = NULL;
WNDPROC OldWndProc1 = NULL;
WNDPROC OldWndProc2 = NULL;
WNDPROC OldWndProc3 = NULL;
WNDPROC OldWndProc4 = NULL;
WNDPROC OldWndProc5 = NULL;
WNDPROC OldWndProc6 = NULL;
WNDPROC OldWndProc7 = NULL;
WNDPROC OldWndProc8 = NULL;
WNDPROC OldWndProc9 = NULL;
WNDPROC OldWndProc10 = NULL;
WNDPROC OldWndProc11 = NULL;
WNDPROC OldWndProc12 = NULL;
WNDPROC OldWndProc13 = NULL;
WNDPROC OldWndProc14 = NULL;
extern HWND hwnd;
extern int version_now;
extern char workpath[MAX_PATH];   
extern char absolutepath[MAX_PATH];
extern byte resByte[2731][16384];
extern int resByteLen[2731];
int keyascii[14];
extern Game game;
extern int KeyLeft0;
extern int KeyUp0;
extern int KeyRight0;
extern int KeyDown0;

int mapType = 0;
int mapIdx = 0;
int tileType  = 0;
int width = 0;
int height = 0;
int starX =0 ;
int starY =0;

PAINTSTRUCT psD;
HDC hdcD;
HDC hdcMap;
HBITMAP hbmpD;


void LoadTileDialog(int idx,int i ,HBITMAP &hbmp);
void ShowMapPicInDialog(HDC hdc,int idx,int mapType,int mapIdx);

LRESULT CALLBACK MapProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	
	

	switch (message)
	{
	case WM_INITDIALOG:
		{
			HWND hstatic = GetDlgItem(hDlg,IDC_MAPIMG);
			/*LoadImageA(hstatic, "bmp.bmp",   
                IMAGE_BITMAP,   
                100,   
                50,   
                LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE)); 
				*/

			mapType = game.gameMap.scriptEng.map.mapType;
			mapIdx = game.gameMap.scriptEng.map.mapIdx;
			tileType = game.gameMap.scriptEng.map.tileType;
			width = game.gameMap.scriptEng.map.width;
			height = game.gameMap.scriptEng.map.height;
			starX = 0;
			starY =0;
			hdcD = GetDC(hDlg);
			hdcMap = CreateCompatibleDC(hdcD);
			
			hbmpD =(HBITMAP)LoadImage(NULL, "Res\\logo.sbp", IMAGE_BITMAP,0,0, LR_LOADFROMFILE);
			SelectObject(hdcMap,hbmpD);

			InvalidateRect(hDlg,NULL,false);
			return TRUE;
		}
	case WM_PAINT:
		if(mapType<=0)break;
		hdcD = BeginPaint(hDlg, &psD);
		
		ShowMapPicInDialog(hdcD,tileType,mapType,mapIdx);

		EndPaint(hDlg, &psD);
		break;
	
	case WM_COMMAND:

		if (LOWORD(wParam)==IDC_BUTTONUP) 
		{
			starY--;
			if(starY<0)starY = 0;
			InvalidateRect(hDlg,NULL,false);
			return TRUE;
		}
		else if (LOWORD(wParam)==IDC_BUTTONDOWN) 
		{
			starY++;
			if(starY>(height-40))starY = (height-40);
			if(starY<0)starY = 0;
			InvalidateRect(hDlg,NULL,false);
			return TRUE;
		}
		else if (LOWORD(wParam)==IDC_BUTTONLEFT) 
		{
			starX--;
			if(starX<0)starX = 0;
			InvalidateRect(hDlg,NULL,false);
			return TRUE;
		}
		else if (LOWORD(wParam)==IDC_BUTTONRIGHT) 
		{
			starX++;
			if(starX>(width-40))starX = (width-40);
			if(starX<0)starX = 0;
			InvalidateRect(hDlg,NULL,false);
			return TRUE;
		}
		else if (LOWORD(wParam)==IDOK) 
		{
			EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}
		else if (LOWORD(wParam)==IDCANCEL) 
		{

			EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}
		break;
	}
	return FALSE;
}

void ShowMapPicInDialog(HDC hdc,int idx,int mapType,int mapIdx)
{
	int resnum = GetResNum(RES_MAP,mapType,mapIdx);

	int width = 0;
	int height = 0;
	byte mapByte[20000];
	int mapByteLen= 0;
	int b = 0;
	
	

	width = resByte[resnum][16];
	height = resByte[resnum][17];

	for(int a = 18 ; a < resByteLen[resnum] ;a++)
	{
		if(resByte[resnum][a]>=128)
		{
			mapByte[b] = resByte[resnum][a] - 128;
		}
		else
		{
			mapByte[b] = resByte[resnum][a];
		}
		a++;
		b++;
	}
	mapByteLen = b;
	
	
	int maxX = height>40?40:height;
	int maxY = width>40?40:width;

	for(int g=0;g<maxX;g++)
	{
		for(int h=0;h<maxY;h++)
		{
			LoadTileDialog(idx,mapByte[width * (g +starY)+ h + starX],hbmpD);	
			HBITMAP oldhbmp=(HBITMAP)SelectObject(hdcMap, hbmpD);
			
			BitBlt(hdc, TILEPICWIDTH*h+8, TILEPICHEIGHT*g, TILEPICWIDTH, TILEPICHEIGHT, hdcMap, 0, 0, SRCCOPY);
			//StretchBlt(hdc,TILEPICWIDTH*2*h+8, TILEPICHEIGHT*2*g, TILEPICWIDTH*2, TILEPICHEIGHT*2, hdcMap, 0, 0,TILEPICWIDTH,TILEPICHEIGHT, SRCCOPY);
			
			SelectObject(hdcMap, oldhbmp);
			DeleteObject(hbmpD);
			DeleteObject(oldhbmp);
		}
	}



}

void LoadTileDialog(int idx,int i ,HBITMAP &hbmp)
{
	
	PicConverter picConverter;
	hbmp = picConverter.BytesToHBitmap(RES_TIL,1,idx,i);

}


LRESULT CALLBACK AboutProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
{


	switch (message)
	{
	case WM_INITDIALOG:
		{
			HFONT hfont_static  = CreateFont(15,0,0,0,FW_NORMAL,0,FALSE,FALSE, 
				GB2312_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
				DEFAULT_QUALITY,FIXED_PITCH|FF_MODERN,"隶书"); 

			HFONT hfont_static1  = CreateFont(12,0,0,0,FW_NORMAL,0,TRUE,FALSE, 
				GB2312_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
				DEFAULT_QUALITY,FIXED_PITCH|FF_MODERN,"宋体"); 

			char word[200];
			sprintf_s(word,"天际边伏魔引擎（原天际边步步高A系列RPG游戏windows模拟平台(SkyRPGSim)） ver%d.%02d\n天际边工作室 荣誉出品",version_now%1000/100,version_now - version_now/100*100);
			HWND hstatic = GetDlgItem(hDlg,IDC_STATICA);
			SetWindowText(hstatic , word) ;
			SendMessage(hstatic,  WM_SETFONT,  (WPARAM)hfont_static,  (LPARAM)TRUE);  //***
			DeleteObject(hstatic);


			//  设置字体
			HWND hwnd_static1  =  GetDlgItem(hDlg,  IDC_STATIC1);  //***
			SendMessage(hwnd_static1,  WM_SETFONT,  (WPARAM)hfont_static,  (LPARAM)TRUE);  //***
			DeleteObject(hwnd_static1);
			HWND hwnd_static2  =  GetDlgItem(hDlg,  IDC_STATIC2);  //***
			SendMessage(hwnd_static2,  WM_SETFONT,  (WPARAM)hfont_static,  (LPARAM)TRUE);  //***
			DeleteObject(hwnd_static2);
			HWND hwnd_static3  =  GetDlgItem(hDlg,  IDC_STATIC3);  //***
			SendMessage(hwnd_static3,  WM_SETFONT,  (WPARAM)hfont_static1,  (LPARAM)TRUE);  //***

			//DeleteObject(hwnd_static3);
			HWND hwnd_static4  =  GetDlgItem(hDlg,  IDC_STATIC4);  //***
			SendMessage(hwnd_static4,  WM_SETFONT,  (WPARAM)hfont_static1,  (LPARAM)TRUE);  //***

			DeleteObject(hwnd_static4);


			return TRUE;
		}
	case   WM_CTLCOLORSTATIC:   
		{
			//   改变文本颜色和背景颜色   
			HWND hwnd_static3  =  GetDlgItem(hDlg,  IDC_STATIC3);
			HWND hwnd_static4  =  GetDlgItem(hDlg,  IDC_STATIC4);

			if((HWND)lParam   ==   hwnd_static3||(HWND)lParam   ==   hwnd_static4)   
			{   
				//SetTextColor((HDC)wParam,   0xff0000);   //***   
				SetTextColor((HDC)wParam,RGB(0,0,255));
			}   
			else   
			{   
				SetTextColor((HDC)wParam,   GetSysColor(COLOR_WINDOWTEXT));   
			}   
			DeleteObject(hwnd_static3);
			DeleteObject(hwnd_static4);
			SetBkColor((HDC)wParam,   GetSysColor(COLOR_BTNFACE));   
			SetWindowLong(hDlg,   DWL_MSGRESULT,   (LONG)TRUE);   
			return   (LRESULT)GetSysColorBrush(COLOR_BTNFACE);   
		}
	case WM_MOUSEMOVE:
		{
			int _MouseEndX = (int)(LOWORD(lParam));
			int _MouseEndY = (int)(HIWORD(lParam));
			RECT m_rect;
			RECT m_rect1;
			HWND hwnd_static3  =  GetDlgItem(hDlg,  IDC_STATIC3);
			GetWindowRect(hwnd_static3,&m_rect); 
			GetWindowRect(hDlg,&m_rect1); 
			int left = m_rect.left-m_rect1.left;
			int right = m_rect.right-m_rect1.left;
			int top = m_rect.top-m_rect1.top-25;
			int bottom = m_rect.bottom-m_rect1.top-25;

			if (_MouseEndX>left && _MouseEndX<right&&_MouseEndY<bottom&&_MouseEndY>top)
			{
				HCURSOR hCursor;  
				hCursor = ::LoadCursor ( NULL, IDC_HAND );  
				::SetCursor ( hCursor );  
			}
			DeleteObject(hwnd_static3);
			HWND hwnd_static4  =  GetDlgItem(hDlg,  IDC_STATIC4);
			GetWindowRect(hwnd_static4,&m_rect); 
			GetWindowRect(hDlg,&m_rect1); 
			left = m_rect.left-m_rect1.left;
			right = m_rect.right-m_rect1.left;
			top = m_rect.top-m_rect1.top-25;
			bottom = m_rect.bottom-m_rect1.top-25;
			if (_MouseEndX>left && _MouseEndX<right&&_MouseEndY<bottom&&_MouseEndY>top)
			{
				HCURSOR hCursor;  
				hCursor = ::LoadCursor ( NULL, IDC_HAND );  
				::SetCursor ( hCursor );  
			}
			DeleteObject(hwnd_static4);
			break;
		}
	case WM_LBUTTONUP:
		{
			int _MouseEndX = (int)(LOWORD(lParam));
			int _MouseEndY = (int)(HIWORD(lParam));
			RECT m_rect;
			RECT m_rect1;
			HWND hwnd_static3  =  GetDlgItem(hDlg,  IDC_STATIC3);
			GetWindowRect(hwnd_static3,&m_rect); 
			GetWindowRect(hDlg,&m_rect1); 
			int left = m_rect.left-m_rect1.left;
			int right = m_rect.right-m_rect1.left;
			int top = m_rect.top-m_rect1.top-25;
			int bottom = m_rect.bottom-m_rect1.top-25;

			if (_MouseEndX>left && _MouseEndX<right&&_MouseEndY<bottom&&_MouseEndY>top)
			{
				ShellExecute(hwnd,"open","http://www.skysidestudio.com",NULL,NULL,SW_SHOW );
			}
			DeleteObject(hwnd_static3);
			HWND hwnd_static4  =  GetDlgItem(hDlg,  IDC_STATIC4);
			GetWindowRect(hwnd_static4,&m_rect); 
			GetWindowRect(hDlg,&m_rect1); 
			left = m_rect.left-m_rect1.left;
			right = m_rect.right-m_rect1.left;
			top = m_rect.top-m_rect1.top-25;
			bottom = m_rect.bottom-m_rect1.top-25;
			if (_MouseEndX>left && _MouseEndX<right&&_MouseEndY<bottom&&_MouseEndY>top)
			{
				ShellExecute(hwnd,"open","http://sim.skysidestudio.com",NULL,NULL,SW_SHOW );
			}
			DeleteObject(hwnd_static4);
		}
		break;
	case WM_COMMAND:

		if (LOWORD(wParam)==IDOK) 
		{


			EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}
		else if (LOWORD(wParam)==IDCANCEL) 
		{

			EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}

		break;
	}
	return FALSE;
}


LRESULT CALLBACK WindowCfgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	char workpath[MAX_PATH];   
    GetModuleFileName(NULL,(LPSTR)workpath,sizeof(workpath));   
	char *p = strrchr(workpath, '\\');  
	*p=0x00;  
	char absolutepath[MAX_PATH];
	sprintf_s(absolutepath,"%s\\%s",workpath,STARTINIPATH);

	switch (message)
	{
	case WM_INITDIALOG:
		{CheckRadioButton(hDlg,IDC_RADIO1,IDC_RADIO2,IDC_RADIO1);
		HWND heditWidth = GetDlgItem(hDlg,IDC_EDIT1);
		int widthx = GetPrivateProfileInt("Startup", "Width", 800, absolutepath );
		char width[11];
		sprintf_s(width,"%d",widthx);
		SetWindowText(heditWidth , width) ;
		DeleteObject(heditWidth);
		HWND heditHeight = GetDlgItem(hDlg,IDC_EDIT2);
		int heighty = GetPrivateProfileInt("Startup", "Height", 600, absolutepath );
		char height[11];
		sprintf_s(height,"%d",heighty);
		SetWindowText(heditHeight , height) ;
		DeleteObject(heditHeight);


		return TRUE;
		}

	case WM_COMMAND:

		if (LOWORD(wParam)==IDOK) 
		{

			if(IsDlgButtonChecked(hDlg,IDC_RADIO1))
			{

				WritePrivateProfileString("StartUp", "Screen", "0", absolutepath );
			}
			if(IsDlgButtonChecked(hDlg,IDC_RADIO2))
			{

				WritePrivateProfileString("StartUp", "Screen", "1", absolutepath );
			}
			char width[11]; 
			char height[11];  
			HWND heditWidth = GetDlgItem(hDlg,IDC_EDIT1);
			HWND heditHeight = GetDlgItem(hDlg,IDC_EDIT2);
			GetWindowText(heditWidth,width,10);
			GetWindowText(heditHeight,height,10);
			WritePrivateProfileString("StartUp", "Width",width,  absolutepath );
			WritePrivateProfileString("StartUp", "Height",height, absolutepath );
			DeleteObject(heditWidth);
			DeleteObject(heditHeight);
			MessageBox(hDlg,"设置成功，请重启游戏！","提示",NULL);
			EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}
		else if (LOWORD(wParam)==IDCANCEL) 
		{

			EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}
		else if(LOWORD(wParam)==IDC_EDIT1)
		{
			if(HIWORD(wParam)== EN_CHANGE)
			{
				char width[11]; 
				char height[11];  
				int widthx = 0;
				int heighty = 0;
				HWND heditWidth = GetDlgItem(hDlg,IDC_EDIT1);
				HWND heditHeight = GetDlgItem(hDlg,IDC_EDIT2);
				GetWindowText(heditWidth,width,10);
				widthx = atoi(width);
				heighty =(int) (((double)widthx) / 5.0 * 3.0)+30;
				sprintf_s(height,"%d",heighty);
				SetWindowText(heditHeight , height) ;
				DeleteObject(heditWidth);
				DeleteObject(heditHeight);
			}
		}
		break;
	}
	return FALSE;
}


/*LRESULT CALLBACK KeyCfgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	char workpath[MAX_PATH];   
    GetModuleFileName(NULL,(LPSTR)workpath,sizeof(workpath));   
	char *p = strrchr(workpath, '\\');  
	*p=0x00;  
	char absolutepath[MAX_PATH];
	sprintf_s(absolutepath,"%s\\%s",workpath,STARTINIPATH);

	switch (message)
	{
	case WM_INITDIALOG:
		{
			char str[][20]={"","","","","","","","","BackSpace","","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};
			HWND hedit1 = GetDlgItem(hDlg,IDC_EDIT1);
			int key1 = GetPrivateProfileInt("Key", "Return", 13, absolutepath );
			SetWindowText(hedit1 , str[key1]) ;
			DeleteObject(hedit1);

			HWND hedit2 = GetDlgItem(hDlg,IDC_EDIT2);
			int key2 = GetPrivateProfileInt("Key", "Esc", 27, absolutepath );
			SetWindowText(hedit2 , str[key2]) ;
			DeleteObject(hedit2);

			HWND hedit3 = GetDlgItem(hDlg,IDC_EDIT3);
			int key3 = GetPrivateProfileInt("Key", "Up", 38, absolutepath );
			SetWindowText(hedit3 , str[key3]) ;
			DeleteObject(hedit3);
			HWND hedit4 = GetDlgItem(hDlg,IDC_EDIT4);
			int key4 = GetPrivateProfileInt("Key", "Down", 40, absolutepath );
			SetWindowText(hedit4 , str[key4]) ;
			DeleteObject(hedit4);
			HWND hedit5 = GetDlgItem(hDlg,IDC_EDIT5);
			int key5 = GetPrivateProfileInt("Key", "Left", 37, absolutepath );
			SetWindowText(hedit5 , str[key5]) ;
			DeleteObject(hedit5);
			HWND hedit6 = GetDlgItem(hDlg,IDC_EDIT6);
			int key6 = GetPrivateProfileInt("Key", "Right", 39, absolutepath );
			SetWindowText(hedit6 , str[key6]) ;
			DeleteObject(hedit6);
			HWND hedit7 = GetDlgItem(hDlg,IDC_EDIT7);
			int key7 = GetPrivateProfileInt("Key", "PageUp", 33, absolutepath );
			SetWindowText(hedit7 , str[key7]) ;
			DeleteObject(hedit7);
			HWND hedit8 = GetDlgItem(hDlg,IDC_EDIT8);
			int key8 = GetPrivateProfileInt("Key", "PageDown", 34, absolutepath );
			SetWindowText(hedit8 , str[key8]) ;
			DeleteObject(hedit8);
			HWND hedit9 = GetDlgItem(hDlg,IDC_EDIT9);
			int key9 = GetPrivateProfileInt("Key", "Insert", 45, absolutepath );
			SetWindowText(hedit9 , str[key9]) ;
			DeleteObject(hedit9);
			HWND hedit10 = GetDlgItem(hDlg,IDC_EDIT10);
			int key10 = GetPrivateProfileInt("Key", "Delete", 46, absolutepath );
			SetWindowText(hedit10 , str[key10]) ;
			DeleteObject(hedit10);
			HWND hedit11 = GetDlgItem(hDlg,IDC_EDIT11);
			int key11 = GetPrivateProfileInt("Key", "Home", 36, absolutepath );
			SetWindowText(hedit11 , str[key11]) ;
			DeleteObject(hedit11);
			HWND hedit12 = GetDlgItem(hDlg,IDC_EDIT12);
			int key12 = GetPrivateProfileInt("Key", "End", 35, absolutepath );
			SetWindowText(hedit12 , str[key12]) ;
			DeleteObject(hedit12);
			HWND hedit13 = GetDlgItem(hDlg,IDC_EDIT13);
			int key13 = GetPrivateProfileInt("Key", "Repeat", 82, absolutepath );
			SetWindowText(hedit13 , str[key13]) ;
			DeleteObject(hedit13);
			HWND hedit14 = GetDlgItem(hDlg,IDC_EDIT14);
			int key14 = GetPrivateProfileInt("Key", "AutoWalk", 78, absolutepath );
			SetWindowText(hedit14 , str[key14]) ;
			DeleteObject(hedit14);

			return TRUE;
		}

	case WM_COMMAND:

		if (LOWORD(wParam)==IDOK) 
		{
			MessageBox(hDlg,"敬请期待","",NULL);
			EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}
		else if (LOWORD(wParam)==IDCANCEL) 
		{

			EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}
		break;
	}
	return FALSE;
}*/

LRESULT CALLBACK KeyCfgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	char str[][20]={"","","","","","","","","BackSpace","","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch (message)
	{
	case WM_INITDIALOG:
		{
			
			t_hDlg = hDlg;
			HWND hedit1 = GetDlgItem(hDlg,IDC_EDIT1);
			OldWndProc1 = (WNDPROC)SetWindowLong(hedit1, GWL_WNDPROC, (LONG)NewWndProc1);
			int key1 = GetPrivateProfileInt("Key", "Return", 13, absolutepath );
			SetWindowText(hedit1 , str[key1]) ;
			keyascii[0]=key1;
			HWND hedit2 = GetDlgItem(hDlg,IDC_EDIT2);
			OldWndProc2 = (WNDPROC)SetWindowLong(hedit2, GWL_WNDPROC, (LONG)NewWndProc2);
			int key2 = GetPrivateProfileInt("Key", "Esc", 27, absolutepath );
			SetWindowText(hedit2 , str[key2]) ;
			keyascii[1]=key2;

			HWND hedit3 = GetDlgItem(hDlg,IDC_EDIT3);
			OldWndProc3 = (WNDPROC)SetWindowLong(hedit3, GWL_WNDPROC, (LONG)NewWndProc3);
			int key3 = GetPrivateProfileInt("Key", "Up", 38, absolutepath );
			SetWindowText(hedit3 , str[key3]) ;
			keyascii[2]=key3;
			HWND hedit4 = GetDlgItem(hDlg,IDC_EDIT4);
			OldWndProc4 = (WNDPROC)SetWindowLong(hedit4, GWL_WNDPROC, (LONG)NewWndProc4);
			int key4 = GetPrivateProfileInt("Key", "Down", 40, absolutepath );
			SetWindowText(hedit4 , str[key4]) ;
			keyascii[3]=key4;
			HWND hedit5 = GetDlgItem(hDlg,IDC_EDIT5);
			OldWndProc5 = (WNDPROC)SetWindowLong(hedit5, GWL_WNDPROC, (LONG)NewWndProc5);
			int key5 = GetPrivateProfileInt("Key", "Left", 37, absolutepath );
			SetWindowText(hedit5 , str[key5]) ;
			keyascii[4]=key5;
			HWND hedit6 = GetDlgItem(hDlg,IDC_EDIT6);
			OldWndProc6 = (WNDPROC)SetWindowLong(hedit6, GWL_WNDPROC, (LONG)NewWndProc6);
			int key6 = GetPrivateProfileInt("Key", "Right", 39, absolutepath );
			SetWindowText(hedit6 , str[key6]) ;
			keyascii[5]=key6;
			HWND hedit7 = GetDlgItem(hDlg,IDC_EDIT7);
			OldWndProc7 = (WNDPROC)SetWindowLong(hedit7, GWL_WNDPROC, (LONG)NewWndProc7);
			int key7 = GetPrivateProfileInt("Key", "PageUp", 33, absolutepath );
			SetWindowText(hedit7 , str[key7]) ;
			keyascii[6]=key7;
			HWND hedit8 = GetDlgItem(hDlg,IDC_EDIT8);
			OldWndProc8 = (WNDPROC)SetWindowLong(hedit8, GWL_WNDPROC, (LONG)NewWndProc8);
			int key8 = GetPrivateProfileInt("Key", "PageDown", 34, absolutepath );
			SetWindowText(hedit8 , str[key8]) ;
			keyascii[7]=key8;

			HWND hedit9 = GetDlgItem(hDlg,IDC_EDIT9);
			OldWndProc9 = (WNDPROC)SetWindowLong(hedit9, GWL_WNDPROC, (LONG)NewWndProc9);
			int key9 = GetPrivateProfileInt("Key", "Insert", 45, absolutepath );
			SetWindowText(hedit9 , str[key9]) ;
			keyascii[8]=key9;
			HWND hedit10 = GetDlgItem(hDlg,IDC_EDIT10);
			OldWndProc10 = (WNDPROC)SetWindowLong(hedit10, GWL_WNDPROC, (LONG)NewWndProc10);
			int key10 = GetPrivateProfileInt("Key", "Delete", 46, absolutepath );
			SetWindowText(hedit10 , str[key10]) ;
			keyascii[9]=key10;
			HWND hedit11 = GetDlgItem(hDlg,IDC_EDIT11);
			OldWndProc11 = (WNDPROC)SetWindowLong(hedit11, GWL_WNDPROC, (LONG)NewWndProc11);
			int key11 = GetPrivateProfileInt("Key", "Home", 36, absolutepath );
			SetWindowText(hedit11 , str[key11]) ;
			keyascii[10]=key11;
			HWND hedit12 = GetDlgItem(hDlg,IDC_EDIT12);
			OldWndProc12 = (WNDPROC)SetWindowLong(hedit12, GWL_WNDPROC, (LONG)NewWndProc12);
			int key12 = GetPrivateProfileInt("Key", "End", 35, absolutepath );
			SetWindowText(hedit12 , str[key12]) ;
			keyascii[11]=key12;
			HWND hedit13 = GetDlgItem(hDlg,IDC_EDIT13);
			OldWndProc13 = (WNDPROC)SetWindowLong(hedit13, GWL_WNDPROC, (LONG)NewWndProc13);
			int key13 = GetPrivateProfileInt("Key", "Repeat", 82, absolutepath );
			SetWindowText(hedit13 , str[key13]) ;
			keyascii[12]=key13;
			HWND hedit14 = GetDlgItem(hDlg,IDC_EDIT14);
			OldWndProc14 = (WNDPROC)SetWindowLong(hedit14, GWL_WNDPROC, (LONG)NewWndProc14);
			int key14 = GetPrivateProfileInt("Key", "AutoWalk", 78, absolutepath );
			SetWindowText(hedit14 , str[key14]) ;
			keyascii[13]=key14;
			return TRUE;
		}

	case WM_COMMAND:

		if (LOWORD(wParam)==IDC_OK) 
		{
			


			char t_t[3+1];
			sprintf(t_t,"%d",keyascii[0]);
			WritePrivateProfileString("Key", "Return", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[1]);
			WritePrivateProfileString("Key", "Esc", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[2]);
			WritePrivateProfileString("Key", "Up", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[3]);
			WritePrivateProfileString("Key", "Down", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[4]);
			WritePrivateProfileString("Key", "Left", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[5]);
			WritePrivateProfileString("Key", "Right", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[6]);
			WritePrivateProfileString("Key", "PageUp", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[7]);
			WritePrivateProfileString("Key", "PageDown", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[8]);
			WritePrivateProfileString("Key", "Insert", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[9]);
			WritePrivateProfileString("Key", "Delete", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[10]);
			WritePrivateProfileString("Key", "Home", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[11]);
			WritePrivateProfileString("Key", "End", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[12]);
			WritePrivateProfileString("Key", "Repeat", t_t, absolutepath );
			sprintf(t_t,"%d",keyascii[13]);
			WritePrivateProfileString("Key", "AutoWalk", t_t, absolutepath );
			MessageBox(hDlg,"设置成功，请重启游戏！","提示",NULL);
			DestroyWindow (hDlg);
			//EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}
		else if (LOWORD(wParam)==IDC_CANCEL) 
		{

			DestroyWindow (hDlg);
			//EndDialog(hDlg,LOWORD(wParam));
			return TRUE;
		}
		else if(LOWORD(wParam)==IDC_EDIT1)
		{
			if(HIWORD(wParam)== EN_CHANGE)
			{

			}
		}
		break;


	}
	return FALSE;
}

LRESULT CALLBACK NewWndProc1(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT1);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[0]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc1, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT2);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[1]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc2, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc3(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT3);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[2]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc3, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc4(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT4);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[3]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc4, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc5(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT5);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[4]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc5, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc6(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT6);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[5]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc6, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc7(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT7);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[6]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc7, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc8(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT8);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[7]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc8, hWnd, message, wParam, lParam);
}

LRESULT CALLBACK NewWndProc9(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT9);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[8]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc9, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc10(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT10);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[9]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc10, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc11(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT11);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[10]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc11, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc12(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT12);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[11]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc12, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc13(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT13);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[12]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc13, hWnd, message, wParam, lParam);
}


LRESULT CALLBACK NewWndProc14(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char str[146][20]={"","","","","","","","","BackSpace","Tab","","","","Return","","","Shift","Ctrl","Alt","Pause","CapsLock","","","","","","","Esc","","","","","Space","PageUp","PageDown","End","Home","LeftArrow","UpArrow","RightArrow","DownArrow","","*","+","'","Insert","Delete","/","0","1","2","3","4","5","6","7","8","9","",";","","=","","","","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","","","~","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","","","","","","","","","","","","","","","","","","","","","NumLock","SckLock"};

	switch(message)
	{
	case WM_KEYDOWN:
		{
			HWND heditKey = GetDlgItem(t_hDlg,IDC_EDIT14);
			if(wParam>145)
			{
				break;
			}
			SetWindowText(heditKey , str[wParam]);
			keyascii[13]=wParam;
		}
		break;

	default:
		break;
	}
	return CallWindowProc(OldWndProc14, hWnd, message, wParam, lParam);
}
