Print a variable in status toolbar

Go To StackoverFlow.com

-1

I want to print the content of an int variable on a status toolbar in my program. I know for fact that this variable has a maximum size of 15 let's say and the user enters correctly only 12 of them then I want to print something like that:

Correctly inputed 12/15 attributes.

I know I can print text on status bars

SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM) "Input Completed, Exporting Output Completed.");

and I also know I can print arrays of variables. But I don't know how to print both of them in a style similar to something like this:

printf("Correctly inputed %d/15 attributes", Attributes);

Note that this variable will change constantly but I only want to change the status bar when the user presses a specific button.

2012-04-04 18:31
by Theocharis K.
At least Downvote me but help me, give me a hint - Theocharis K. 2012-04-04 19:02


3

You can use sprintf() to print formatted output to a character array.

char buffer [256];
sprintf(buffer, "Correctly input %d/15 attributes", Attributes);
SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)buffer);
2012-04-04 19:50
by David Heffernan
Ads