InputCallback::SetMonitorFunction / CMD_EXIT / INPUT_REJECT does not work when closing with system menu close icon

Hello,

 As a user we want to show a OK / Cancel custom dialog box when closing Microstation. When click cancel, Microstation must remain opened.

We implemented this as fallows:

InputCallback::SetMonitorFunction(monitorFunction, InputMonitorFilter::MONITOR_ALL);

InputFilterReturnValue monitorFunction(Inputq_element* queueElementP) {
		
		if (queueElementP->u.cmd.command == CMD_EXIT
			|| queueElementP->u.cmd.command == CMD_EXIT_NOUC
			|| queueElementP->u.cmd.command == CMD_CLOSE_DESIGN
			) {
			int res = MessageBox(NULL, L"Realy Close ?", L"Custom Addin", MB_OKCANCEL | MB_ICONQUESTION);
			if (res == CANCEL_BUTTON) {
				return INPUT_REJECT;
			}
		}
		return INPUT_ACCEPT;
	}

This works fine when the user exit Microstation with key in command (EXIT or QUIT) or main menu File -> Exit or File ->Close Design

BUT, this does not work when closing Microstation with sytem menu close icon (X icon). When user click  the close icon, Microstation main window closes prematurely , the custom dialog box is showing and when the user click cancel, microstation.exe process is still running, but there is no Microstation window opened anymore. One must kill the process from task manager. When clicking OK, microstation.exe process is terminanted as expected.

Why this behavior is different than key in commands, are we missing Something in the code or is this a BUG or is there another way to implement this ?

Microstation Version : CONNECT Update 13

Microstation SDK : SDK Update 13

Parents Reply Children
No Data