You've not shown what the error is. Although it's obvious in this example, it still doesn't hurt to be explicit. Change function() to:
int TestDlg::function()
{
...
}
and don't forget to add the prototype to the class. Don't use SetDlgItemText(). Use ClassWizard to create a control variable (CEdit in this case) and use the SetWindowText() method to change the text.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen