Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formated edition

Status
Not open for further replies.

simmeone

Programmer
Mar 16, 2000
29
DE
Hello,

I have a problem in my Windows App. I want a formated edition in a Edit Window. In ANSI C it is easy for example:

for ( int i = 0; i < 100; i++ )
printf ( &quot;%d\n&quot;, i );

on screen appear: 1
2
3

and so on.

The same I want in a Edit Window in my Windows app, but it don't works, I try the following:

hwndTest = GetDlgItem ( hwnd, IDC_TEST );
for ( i = 0; i < 20; i++ )
{
_itoa ( i, temp, 10 );
strcpy ( buffer, temp );
strcat ( buffer, &quot;\n&quot; );
strcat ( buffer, temp );

SetWindowText ( hwndTest, buffer );
}

But &quot;i&quot; appear only one time (the last i also 19) Why ? What's not correct in my source ?

Have anyone a idea ?

Thanks SiM
[sig][/sig]
 
Instead of an Edit box why not use a ListBox and then use the member function AddString? Also the list box can add a scroll if necessary.

for (i = 1; i < 20; i++) {
CString szI;
szI.Format(&quot;%i&quot;, i);
m_ctlListBox.AddString(szI);
}
Also you only get 19 because your loop terminates at i < 20. If you want 20 then use < 21 or <= 20.

HTH,

JC [sig][/sig]
 
Hi,

the for-loop is not the problem, that is all ok. Your description is for MFC, I need this in Win32 API.

Can u say me, how it looks like there ?

SiM [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top