语言

Menu
Sites
Language
Crash experienced while launching MessageBox in Thread

Hi,

Tried to launch a message box in my MyThread Class as below:

Object*
MyThread::Run(void)
{
	AppLog("@ MyThread::Run(void)");

	MessageBox messageBox;
	messageBox.Construct(L"MessageBox Title", L"MessageBox Sample Code.", MSGBOX_STYLE_OK, 10000);

	int modalResult = 0;

	messageBox.ShowAndWait(modalResult);

	return null;
}

Soon after thread instance created and started, application crashed. Cant we launch MessageBox using threads in my UiApp ?

Regards,

Anil

响应

1 回复
tizendevteam T

Actually, UI framework does not support thread-safe. So, if you want to show the MessageBox, you can use SenUserEvent and OnUserReceivedN. Messagebox should be shown in OnUserReceovedN of main-thread.