Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Система";
Текущий архив: 2002.04.29;
Скачать: [xml.tar.bz2];

Вниз

как в сервисе NT создать видимое окно?   Найти похожие ветки 

 
Petrovich   (2002-01-31 14:08) [2]

MSDN:

Console and GUI applications started from a service process during a particular logon session are run on an invisible window station and desktop that are unique to that session. The window station and desktop are created automatically when the first application in the session starts; they are destroyed when the last application exits. There is no way to make these invisible desktops visible.


If you want a service in the localsystem account to interact with the logged-on user, specify the SERVICE_INTERACTIVE_PROCESS flag in the call to CreateService(). For example:

schService = CreateService(
schSCManager,
serviceName,
serviceName,
SERVICE_ALL_ACCESS,
SERVICE_INTERACTIVE_PROCESS | SERVICE_WIN32_OWN_PROCESS,
SERVICE_DEMAND_START,
SERVICE_ERROR_NORMAL,
lpszBinaryPathName,
NULL,
NULL,
NULL,
NULL,
NULL );

If you specify an account other than localsystem when using SERVICE_INTERACTIVE_PROCESS, you will get error INVALID_PARAMETER (87).

If you use CreateProcess() to launch your process and you want your service to log onto the users desktop, assign the lpdesktop parameter of the STARTUPINFO struct with "WinSta0\\Default".

Services that simply need a visible user notification can do this by calling MessageBox() with the MB_SERVICE_NOTIFICATION flag. Using the MB_DEFAULT_DESKTOP_ONLY flag works as well, but only if the user"s desktop is active. If the workstation is locked or a screen saver is running, the call will fail.

NOTE: If you are writing code for an application that can be run as either a service or an executable, you can"t use MB_SERVICE_NOTIFICATION as well as a non-NULL hwndOwner.

Any output done to a window is not displayed or made available to the application in any way. Attempts to read bits from the display results in a failure.

GUI services do not receive WM_QUERYENDSESSION/WM_ENDSESSION messages at logoff and shutdown; instead, they receive CTRL_LOGOFF_EVENT and CTRL_SHUTDOWN_EVENT events. These services are not terminated by the system at logoff.



Страницы: 1 вся ветка

Форум: "Система";
Текущий архив: 2002.04.29;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.44 MB
Время: 0.005 c
1-94502
Alexander Vasjuk
2002-04-16 11:46
2002.04.29
Условная компиляция. Приглашение к разговору.


7-94601
Albun
2002-01-31 23:33
2002.04.29
USB Программирование


1-94386
besen-ok
2002-04-17 12:00
2002.04.29
Как определить содана ли форма


14-94562
Лана Розанова
2002-03-24 11:20
2002.04.29
InstallShieldExpress для Delphi5


3-94274
КСА
2002-04-08 10:53
2002.04.29
Вертикаьлный текст в QReport





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский