lol so I'm working on this useless program to convert text to litelite 1337, but that's not the important part. I'm in a life and death battle of syntax with this thing. I'm using DEv-c++ and this is my code. everything but the trans() works. I'm sure i'm doing this really badly but I'd appreciate any constructive criticism. Ty in advance :)
Code:char* wtoc(char* Dest, TCHAR* Source, int SourceSize ) { for(int i = 0; i < 512; i++) Dest[i] = (CHAR) Source[i]; //wcstombs(strTo,strFrom, SIZE); return Dest; } void tran(char *mytext[]) { char returner[512]; int i = 0; while( i < 512 ) { if( *mytext[i] == 'a') { returner[i] = '@'; } if( *mytext[i] == 'b') { returner[i] = 'B'; } if( *mytext[i] == 'c') { returner[i] = '('; } if( *mytext[i] == 'd') { returner[i] = 'Ð'; } if( *mytext[i] == 'e') { returner[i] = '3'; } if( *mytext[i] == 'f') { returner[i] = 'F'; } if( *mytext[i] == 'g') { returner[i] = 'G'; } i += 1; } *mytext = returner; } LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static HWND hwndEdit; HDC hdc; PAINTSTRUCT ps; RECT rect; static TCHAR szText[512] = ""; switch (message) /* handle the messages */ { case WM_CREATE: hwndEdit = CreateWindow(TEXT("edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 10, 10, 500, 20, hwnd, (HMENU) ID_EDIT, ((LPCREATESTRUCT) lParam)->hInstance, NULL); case WM_COMMAND: if(LOWORD(wParam) == ID_EDIT) { if(HIWORD(wParam) == EN_ERRSPACE || HIWORD(wParam) == EN_MAXTEXT) MessageBox(hwnd, TEXT("Edit control out of space!"), "tranny", MB_OK | MB_ICONSTOP); if(HIWORD(wParam) == EN_UPDATE) { GetWindowText(hwndEdit, szText, 511); InvalidateRect(hwnd, NULL, TRUE); } } return 0; case WM_PAINT: hdc = BeginPaint(hwnd, &ps); GetClientRect(hwnd, &rect); char *text; wtoc(text, szText, 512); tran(&text); DrawText(hdc, text, -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); EndPaint(hwnd, &ps); return 0; //blah return 0; }


Reply With Quote


Bookmarks