Hi friends, here's my 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...

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?

why not just put an int there, and you can juse use RECT instead of initRecArea

unsigned int cnt;

	for (next=45, cnt=48;next<=255;next+=30, cnt++)	{
		OnCreate(hwnd,cs,RECT(205,45,55,20),(HMENU)cnt);
	}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.