I'm makng calculator and i want to make buttons and sets it's ID using for loop for quick coding but my problem is when i click the button nothing's happen. I use the CreateWindowEx inside the for loop and ID's.
int WControl(HWND hwnd, HINSTANCE hInst) { int i, IDs = 0, r = 0; int x = 10, y = 40, width = 40, height = 30; for(i = 0; i < 10; i++) { if(r == 0) { //do nothing. } else if(r == 3) { /* *when r equal to 3 set value of x by 10 *and increment the value of y by 40 *for it's new y location */ x = 10; y += 40; r = 0; //big width for number zero if(i == 9) { width = 90; } } else if(r < 3) { //each time r is < 3 increment the value of x by 50 x += 50; } CreateWindowEx(0, "button", "9 to 0", WS_CHILD | WS_VISIBLE, x, y, width, height, hwnd, (HMENU)ID_btn9 - IDs, hInst, 0); r++; IDs++; } return 0; }