Skip to main content
gamedev.net
🔒 Locked

How to?

Started by Icemage 1 reply 700+ views
Original Post
Icemage
Icemage
I was making an annoying programm where you have to press ok(on a MessageBox) for a 1000 times. If you press cancel it makes you do twise as much. If you press cancel 5 times it goes to a black screen where the mouse and close is disabled. I want to make a couter(in the title bar) that tells you what box your on. I tried this: for(int i =1000;i > 0; i--) { HRESULT hr = MesaageBox(NULL, "You can''t exit for a thousnad MessageBoxes", "%d Boxes", i, MB_OKCANCEL |MB_ICONSTOP); That didn''t work so can i do anything for this to work. Felisandria is Hot, So is Jewelaye
Felisandria is Hot, So is Jewelaye
SiCrane
SiCrane
You need to create the string to be fed as the title before the call to MessageBox. Most functions won''t accept the C style format specifiers.


char buffer[256];
for (int i = 1000; i > 0; i--) {
sprintf(buffer, "%d boxes", i);
HRESULT hr = MessageBox(NULL, "blah", buffer, MB_OKCANCEL | MB_ICONSTOP);
}
Pouya
Pouya
woaaa! SiCrane started talking again...

...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.