#include <windows.h>
#include "10TEAM.h"
#define export extern "C" __declspec(dllexport)

export double Message(char* caption, char* text, double icon, double buttons)
{
	/* Icon of message */
	int icon_no = int(icon); // Changing type of variable to INT. GM operate double, now it's converted to INT.
	UINT icon_name; // Value of this variable is a name of icon.
	switch (icon_no)
	{
		case 1: icon_name = MB_ICONEXCLAMATION; break; // If icon_no is equal 1, then icon is "EXCLAMATION"
		case 2: icon_name = MB_ICONINFORMATION; break; // If icon_no is equal 2, then icon is "INFORMATION"
		case 3: icon_name = MB_ICONQUESTION; break; // If icon_no is equal 3, then icon is "QUESTION"
		case 4: icon_name = MB_ICONSTOP; break; // If icon_no is equal 4, then icon is "STOP"
		default: icon_name = MB_ICONINFORMATION; // Default icon name is "INFORMATION"
	}
	/* --------------- */
	/* Buttons of message */
	int buttons_no = int(buttons); // Changing type of variable to INT. GM operate double, now it's converted to INT.
	UINT buttons_name; // Value of this variable is a name of buttons.
	switch (buttons_no)
	{
		case 1: buttons_name = MB_ABORTRETRYIGNORE; break; // If buttons_no is equal 1, then buttons are "Abort, Retry, Ignore"
		case 2: buttons_name = MB_CANCELTRYCONTINUE; break; // If buttons_no is equal 2, then buttons are "Cancel, Try again, Continue"
		case 3: buttons_name = MB_OK; break; // If buttons_no is equal 4, then button is "Ok"
		case 4: buttons_name = MB_OKCANCEL; break; // If buttons_no is equal 5, then buttons are "Ok, Cancel"
		case 5: buttons_name = MB_RETRYCANCEL; break; // If buttons_no is equal 6, then buttons are "Retry, Cancel"
		case 6: buttons_name = MB_YESNO; break; // If buttons_no is equal 7, then buttons are "Yes, No"
		case 7: buttons_name = MB_YESNOCANCEL; break; // If buttons_no is equal 8, then buttons are "Yes, No, Cancel
		default: buttons_name = MB_OK;
	}
	/* ------------------- */
	/* Show message */
	int msg = MessageBox(0, text, caption, icon_name | buttons_name); // Show message
	switch (msg)
	{
		case 1: return 1; break; // OK
		case 2: return 2; break; // CANCEL
		case 3: return 3; break; // ABORT
		case 4: return 4; break; // RETRY
		case 5: return 5; break; // IGNORE
		case 6: return 6; break; // YES
		case 7: return 7; break; // NO
		case 10: return 8; break; // TRY AGAIN
		case 11: return 9; break; // COUNTINUE
		default: return 0;
	}
	/* ----------- */
}