c++ - Can't change MFC Button Caption -
int firstbutton = idc_button1; for(int = firstbutton; < firstbutton + 16; ++i) { cwnd *pb = getdlgitem(i); for(int j = 0; j < 16; ++j) { pb->setwindowtextw((lpctstr)(sztest[j])); } } i want change button caption dynamically.
when in use setwindowtextw static text "static txt" works well,
but char array (in case sztest), captions are'nt changed
am coded wrong type casting?
the inner loop in code doesn't make sens me. want this:
char sztest[] = "0123456789abcdef" ; int firstbutton = idc_button1; (int = firstbutton; < firstbutton + 16; ++i) { cwnd *pb = getdlgitem(i); cstring str(sztest[i]) ; pb->setwindowtext(str); } with piece of code, first button contain "0", second contain "1" etc.
Comments
Post a Comment