![]()
I want to get some input from the user, put it in an array, and then display what they are typing on the screen. I'm using TextOut to do part of this, but am unable to figure out a way to update the output as the user fills the array.
When the user hits the enter key, I want to display what was entered, add one to it, and display the new number.
I would be grateful for any help anyone can give me.
Code://message handler (window procedure) long CALLBACK WindowProc(HWND hwnd,UINT message, WPARAM wParam,LPARAM lParam) { HDC hdc; hdc = GetDC(hwnd); char * entstr = "Enter an Integer"; TextOut(hdc, 280, 150, entstr, strlen(entstr)); char * plus = "+ 1 ="; char USERstr[11]; USERstr[0] = 0; char strptr[11]; strptr[0] = 0; int count = 280; switch(message) { case WM_ACTIVATEAPP: ActiveApp=wParam; break; case WM_CREATE: break; case WM_KEYDOWN: //keyboard hit if(wParam >= 48 && wParam <= 57 && wParam != VK_RETURN) { USERstr[0] = wParam; TextOut(hdc, count, 250 ,USERstr, 1); strcat(strptr, USERstr); count = count + 10; } if(wParam == VK_RETURN) { TextOut(hdc, 350, 400, strptr, strlen(strptr)); TextOut(hdc, 390, 400, plus, strlen(plus)); } if(wParam == VK_ESCAPE)DestroyWindow(hwnd);break; case WM_DESTROY: //end of game if(lpDirectDrawObject!=NULL){ //if DD object exists if(lpPrimary!=NULL) //if primary surface exists lpPrimary->Release(); //release primary surface lpDirectDrawObject->Release(); //release DD object } ShowCursor(TRUE); //show the mouse cursor PostQuitMessage(0); //and exit break; default: //default window procedure return DefWindowProc(hwnd,message,wParam,lParam); } //switch(message) return 0L; } //WindowProc



LinkBack URL
About LinkBacks



