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

Вниз

TaskbarCreated   Найти похожие ветки 

 
velsi   (2003-04-17 12:38) [0]

Люди, подскажите, как отловить сообщение TaskbarCreated, которое посылает windows, когда пользователь залогировался?

Заранее всем спасибо


 
Игорь Шевченко   (2003-04-17 12:49) [1]

var MyMsg : Cardinal;

MyMsg := RegisterWindowMessage ("TaskbarCreated");

В оконной процедуре или в методе DefaultHandler обрабатывать это сообщение.


 
velsi   (2003-04-17 16:45) [2]

А можно примерчик? А то совсем туго =)


 
Игорь Шевченко   (2003-04-17 17:00) [3]

Можно. В MSDN поиск по слову TaskbarCreated как раз и примерчик есть:)


 
velsi   (2003-04-17 17:35) [4]

Удалено модератором
Примечание: Offtopic


 
velsi   (2003-04-18 11:20) [5]

Делаю так....

procedure TForm1.FormCreate(Sender: TObject);
...
Application.OnMessage :=AppEvents1Message;
...

procedure TForm1.AppEvents1Message(var Msg: tagMSG; var Handled: Boolean);
var
uTaskBarRecreate: uint;
begin
uTaskBarRecreate := RegisterWindowMessage("TaskbarCreated");
if MSg.Message = uTaskBarRecreate then
begin
....
end;
end;

Ничего не получается =(


 
Игорь Шевченко   (2003-04-18 11:30) [6]

А как у тебя при этом Explorer перезапускается, когда твоя форма работает ?


 
velsi   (2003-04-18 12:26) [7]

Это все делается в сервисе, который грузиться в режиме Autо ... когда юзел логируется, то по идее, прога должна отловить сообщение TaskBarCreated и обновить иконку в трее ...


 
Игорь Шевченко   (2003-04-18 13:35) [8]

Summary
When developing a Windows NT service, it may be desirable for the service to create a notification icon in the taskbar"s notification area to notify the logged on user of the state of the service.



More Information
Notification icons are added, modified and deleted using the Shell_NotifyIcon API. Since Shell_NotifyIcon relies on windows messaging to communicate with the taskbar, there are some limitations on calling Shell_NotifyIcon from a service.

Services run on a desktop separate from the interactive desktop. One restriction on desktops is that window messages cannot be sent between desktops which would prevent Shell_NotifyIcon from communicating with the taskbar. In order to avoid this restriction the service needs access to the interactive desktop. This can be accomplished by using the SERVICE_INTERACTIVE_PROCESS flag when installing the service, by calling CreateService, or changing the service"s configuration, by calling ChangeServiceConfig.

Once the service has access to the interactive desktop, the service must know when to call Shell_NotifyIcon to create the notification icon. Assuming that the taskbar has already been created, the service can call Shell_NotifyIcon when the service starts. A problem occurs if the taskbar has not been created, for example when there is no user logged on interactively. In this case, Shell_NotifyIcon fails to create a notification icon. The service would then need to be notified when the taskbar is created so it can successfully call Shell_NotifyIcon. A notification is sent in the form of a registered window message, "TaskbarCreated", that is broadcast to all top-level windows when the taskbar is created. The service can then create the notification icon when handling this message.

An alterative approach to creating the notification icon from a service would be to create a second application that is started when a user logs on the system. This application would create the notification icon and communicate with the service through some IPC mechanism or with the Service Control Manager to determine the state of the service.

Windows NT 4.0 only: The "TaskbarCreated" message is only sent on shell version 4.70 and later. Earlier versions of the shell do not send this notification. Shell versions prior to 4.70 can be updated by installing Internet Explorer 4.x with the Desktop Update.

Additional query words:

Keywords: kbLib kbOSWinNT400 kbOSWin2000 kbSDKPlatform kbSDKWin32 kbShellGrp kbGrpDSUser kbDSupport
Issue Type: kbhowto
Technology: kbAudDeveloper kbWin32sSearch kbWin32API



 
velsi   (2003-04-18 14:24) [9]

Вот нашел Си-шный код.. щас думаю, как его вставить

LRESULT CALLBACK WndProc(HWND hWnd, UINT uMessage, WPARAM wParam,
LPARAM lParam)
{
static UINT s_uTaskbarRestart;

switch(uMessage)
{
case WM_CREATE:
s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
break;

default:
if(uMessage == s_uTaskbarRestart)
AddTaskbarIcons();
break;
}

return DefWindowProc(hWnd, uMessage, wParam, lParam);
}



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

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

Наверх





Память: 0.46 MB
Время: 0.009 c
1-60254
alexus
2003-06-05 17:04
2003.06.19
Интерактивное добавление компонентов на форму


1-60165
tasman
2003-06-06 06:51
2003.06.19
Динамическое назначение event у компоненты NMPop3 (из FastNet)


14-60416
AlexRush
2003-05-28 11:51
2003.06.19
Природа человеческого разума


6-60298
korvet
2003-04-18 10:55
2003.06.19
Простая функция PING


1-60148
Alex-21
2003-06-05 21:46
2003.06.19
MainMenu





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский