The conventional methods to show message box are MessageBox()/AfxMessageBox(). But is it useful if we want to display messages from a service/an application running in session 0? Yes you can but it is not convenient. The developer has to enable interactive services.
There is an alternative method which uses WTSSendMessage() .
DWORD dwSession = WTSGetActiveConsoleSessionId();
DWORD dwResponse = 0;
LPWSTR lpwszMessage = L"Hellow VC++ From Session 0";
WTSSendMessage(WTS_CURRENT_SERVER_HANDLE, dwSession,L"",0, lpwszMessage, wcslen(lpwszMessage)* sizeof(wchar_t), 0, 0, &dwResponse, FALSE);
There is an alternative method which uses WTSSendMessage() .
DWORD dwSession = WTSGetActiveConsoleSessionId();
DWORD dwResponse = 0;
LPWSTR lpwszMessage = L"Hellow VC++ From Session 0";
WTSSendMessage(WTS_CURRENT_SERVER_HANDLE, dwSession,L"",0, lpwszMessage, wcslen(lpwszMessage)* sizeof(wchar_t), 0, 0, &dwResponse, FALSE);
No comments:
Post a Comment