Simsons
Simsons

Reputation: 12745

How Can I execute my code on MessageBox Ok click

This might be very simple but I am new to MFC.

I have a messagebox:

MessageBox("Do You Want to Save the Configuration Changes","NDS",1);

which have Ok and Cancel option. I want to write my code on click of OK

Upvotes: 1

Views: 2491

Answers (2)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799062

Check if the return value is IDOK, and execute your code if it is.

Upvotes: 0

Moo-Juice
Moo-Juice

Reputation: 38810

if(MessageBox("Blah", "NDS", 1) == IDOK)
{
   // they hit okay
}

http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx

Upvotes: 7

Related Questions