Hi for all!
I want to cut last word in the string and then reflect it on the CStatic-component.
The function "cutting_space", as far as I understand must do cutting of spaces:
I put result of "cutting_space" into the CStatic with the following code:Code:char *cutting_space(const char *source) { int i,k; char *ds; for(i=strlen(source)-1;i>=0;i--) if(source[i]==' ') { ds=new char[i]; strncpy(ds,source,i); if(i>=1 && source[i-1]!=' ') { k=10; break; } }; if (k!=10) { ds=new char[strlen(source)]; strncpy(ds,source,strlen(source)); } return(ds); };
And I have a kind ofCode:CRect rcwin(0,0,200,70), rcstat; rcstat.left=0; rcstat.right=rcwin.right-rcwin.left; rcstat.top=0; rcstat.bottom=40; MyStatic = new CStatic(); char *r="ASDASDASDASDASDASDASDASASDASDASD sdfsdf sdf sdf sfa a ret eirh oiughofdihodiuoifudhgoidfghofgsdfghsoihgphwq[yqpiperuhpfdfsfwerwerwerwerwerwerrrrrrrrrrrrrrrrrrrrrrrrr"; char *we=cutting_space(r); if (MyStatic!=NULL) MyStatic->Create("XXX",WS_CHILD|WS_VISIBLE|SS_CENTER|SS_CENTERIMAGE,rcstat,this); CSize ts=MyStatic->GetDC()->GetTextExtent(we); rcwin.right=ts.cx+4*GetSystemMetrics(SM_CXFRAME); MoveWindow(rcwin,WM_PAINT); int rcwidth=rcwin.right-rcwin.left, rcheight=rcwin.bottom-rcwin.top; MyStatic->MoveWindow(0,0,rcwidth-2*GetSystemMetrics(SM_CXFIXEDFRAME),40,WM_PAINT); MyStatic->CenterWindow(this); this->CenterWindow(NULL); MyStatic->SetWindowText(we); this->SetWindowText("as");
Help, please...![]()




:
Reply With Quote