in C i am trying to do a simple encryption that gets the ASCII value of the character then doubles it and subtracts 25 then to decrypt adds 25 and divides by 2 but it does not seem to be working here is the relevant code.I am using Dev C++ and am just learning the WIN32 API so i have copied and modified most of this code from a tutorial. Code: case IDC_MAIN_EDIT: { int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_MAIN_EDIT)); if(len > 0) { int i,j; char* buf; buf = (char*)malloc( len + 1); GetDlgItemText(hwnd, IDC_MAIN_EDIT, buf, len + 1); //... do stuff with text ... for (i=0;i<len;i++) { j = buf[i]; // if(j >> 1 > 255) j = (j * 2)^ (1/2); buf[i] =j; } SetDlgItemText(hwnd, IDC_MAIN_ENC,buf ); GlobalFree((HANDLE)buf); } else SetDlgItemText(hwnd, IDC_MAIN_ENC,"" ); } break; case IDC_MAIN_ENC: { int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_MAIN_ENC)); if(len > 0) { int i,j; char* buf; buf = (char*)malloc( len + 1); GetDlgItemText(hwnd, IDC_MAIN_ENC, buf, len + 1); //... do stuff with text ... for (i=0;i<len;i++) { j = buf[i]; // if((j << 1)>255) j = j ^ 2 /2; buf[i] =j; } SetDlgItemText(hwnd, IDC_MAIN_EDIT,buf ); GlobalFree((HANDLE)buf); } else SetDlgItemText(hwnd, IDC_MAIN_EDIT,"" ); } break; Thanks