how to set ID's inside the for loop

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.


#define ID_btn0 1001 #define ID_btn1 1002 #define ID_btn2 1003 #define ID_btn3 1004 #define ID_btn4 1005 #define ID_btn5 1006 #define ID_btn6 1007 #define ID_btn7 1008 #define ID_btn8 1009 #define ID_btn9 1010

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; }
No line breaks? Do you really expect us to read that? =P
sorry i type it using cp and new here sorry
closed account (zb0S216C)
Duplicate: http://www.cplusplus.com/forum/general/52707/

Wazzak
Topic archived. No new replies allowed.