一旦用户尝试停止服务,我试图显示一个消息框。
为此,我使用了 API……一旦事件发生WTSSendmessage
,我就调用了该函数……SERVICE_CONTROL_STOP
我在上面的步骤中正确吗?因为一旦用户尝试停止服务,我就没有收到消息框..
请指导我...
下面是我的代码片段::
case SERVICE_CONTROL_STOP:
WTSSendMessage = (fptr1)GetProcAddress(hinstLib, "WTSSendMessage");
BOOL ret = WTSSendMessage(WTS_CURRENT_SERVER_HANDLE, dwSession, lpszTitle, 12 ,lpszText, 7 ,MB_YESNO|MB_ICONINFORMATION, 0, &res, TRUE);
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
SetServiceStatus( serviceStatusHandle, &serviceStatus );
SetEvent( stopServiceEvent );
return;