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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

win32 api call in C

Status
Not open for further replies.

sirbu

Programmer
Sep 15, 1999
15
0
0
RO
I have a dialog with an edit box written in C (à la Petzold). What I read from the edit box with GetDlgItemText function I convert to a double with an expression like:
kk = strtod(szText,&rpt);
Then I want to pass the variable kk to a MessageBox,
so I use
wsprintf(szBuffer,TEXT("Your value is : %lf"), kk);
to format a little the variable and
MessageBox(hwnd,szBuffer,"",MB_OK);
I cannot print the result. The MessageBox displays
Your value is: f
Please can anyone tell me why, what’s wrong?
If kk is an integer, everything is OK, and the messagebox works fine. But when kk is a float or double it doesn’t work.
Thanks in advance
 
I think TEXT() transform %lf in something no understandable for wsprintf.

I think it will work if you do something like next:
char strBuffer[70];
sprintf(strBuffer,"Your value is: %lf",kk);
wsprintf(szBuffer,TEXT(strBuffer));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top