I guess this is a general C question... here's my code..
Code:
OnCreate(hwnd,cs,initRecArea(480,45,55,20),(HMENU)IDCE_SINGLELINE5);
OnCreate(hwnd,cs,initRecArea(480,105,55,20),(HMENU)IDCE_SINGLELINE7);
OnCreate(hwnd,cs,initRecArea(480,135,55,20),(HMENU)IDCE_SINGLELINE8);
OnCreate(hwnd,cs,initRecArea(480,165,55,20),(HMENU)IDCE_SINGLELINE9);
OnCreate(hwnd,cs,initRecArea(480,195,55,20),(HMENU)IDCE_SINGLELINE10);
OnCreate(hwnd,cs,initRecArea(480,225,55,20),(HMENU)IDCE_SINGLELINE11);
OnCreate(hwnd,cs,initRecArea(480,255,55,20),(HMENU)IDCE_SINGLELINE12);
Since all these lines are a repetition except the second argument of initRecArea() which increments by 30, and last argument of OnCreate() which only has the last character changing, i would prefer looping this code as follows...
Code:
char cnt;
for (next=45, cnt=48;next<=255;next+=30, cnt++) {
sprintf(buffer,"%s%d","IDCE_SINGLELINE",cnt);
OnCreate(hwnd,cs,initRecArea(205,45,55,20),(HMENU)buffer);
}
but buffer is a string not a symbolic constant... How do i treat it as a constant? Or any other solutions to this?