Question Messagebox

The trueSpace scripting question messagebox can be hidden behind the main display. This is a solution to that problem.

// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox
function Question(strText)
{
	var nSecondsToWait = -1;
	var strTitle = "Question";
	// values are hexadecimal
	var MB_YESNO = 4;
	var MB_SYSTEMMODAL = 4096;//1000L force on top
	var MB_ICONQUESTION = 32;//20L question mark symbol

	var nType = MB_YESNO+MB_SYSTEMMODAL+MB_ICONQUESTION;
	var IDYES = 6;
	var IDNO = 7;

	var shell = new ActiveXObject("WScript.shell");
	var button = shell.Popup (strText, nSecondsToWait, strTitle, nType);

	if(button == IDYES) return true;
	return false;
}

if(!Question("Special mesh processing\nDo you wish to continue?")) {
params.ConValue("abort") = 1;
return;
}

Leave a Reply

Your email address will not be published.