MessageBox() blocks the work of IPlugEffect

My plugin contains two buttons: Button1 and Button2. Button1 calls the following message box function:
MessageBox(NULL, “TEST”, “TEST”, MB_OK);

When I click Button1 I see the message box window. A strange thing happens when I close the message box window and click Button2 which is not intended to show any messages. Button2 shows exactly the same message window! More than that, if I click somewhere between the buttons, I see exactly the same message as if I clicked Button1.

In other words, all other cotrols of the plug-in are blocked after calling the MessageBox() window.

This problem always happens when the message box overlaps the Button1, however, sometimes the problem happens when the message box doesn’t overlap the Button1.

I tried to solve this problem by deriving my own IMyButton class directly from the IControl class and putting MessageBox() to the OnMouseDown() function (in order to avoid using the OnParamChange() function), but the problem persists.

I also tried to call the MessageBox() function from another thread, but the problem is there.

Replacing MessageBox() by my own window (created by means of DialogBoxIndirectParam()) also creates the same problem.

I use SKIA.

Is there a way to overcome this problem?

It’s not really clear where you are calling MessageBox().

FWIW iPlug2 has a method IGraphics::ShowMessageBox() which is what would usually be used. This calls IGraphics::ReleaseMouseCapture() before triggering the win32 MessageBox() call which might be the source of your problem.

Thank you very much! IGraphics::ShowMessageBox() works without any problems.