Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > C/C++: Системное программирование и WinAPI > ToolTip в SystemTray


Автор: ElcnU 16.5.2006, 15:11
Вопросик таков: как вывести тултип рядом со своей иконкой в трее? (тултип желательно с кнопкой закрытия) и как соответственно спрятать/закрыть выведенный тултип? 

Автор: Pulse69 17.5.2006, 09:24
Вот кусок статьи из MSDN Magazine. Должно помочь. Привёл бы свой код, да некогда, sorry.
      
One of the flags in NOTIFYICONDATA.uFlags is NIF_TIP, used to set the ordinary, mouseover tooltip. A new flag (available where _WIN32_IE >= 0x0500), NIF_INFO, lets you display a balloon tip. In other words, to display a balloon tip, you must call Shell_NotifyIcon with NIF_INFO. The text goes in szInfo, and you can put a title in szInfoTitle. You can even specify a timeout value in NOTIFYICONDATA.uTimeout: Windows dispatches your balloon automatically after the specified number of milliseconds elapses.
      To show how it all works in practice, I modified the CTrayIcon and the TrayTest sample from my February 1999 MSJ column.
      To implement the balloons, CTrayIcon gets a new method called ShowBalloonTip that comes in two overloaded flavors: you can give it either a text string or resource ID. The resource ID option loads the string and calls the text version, which looks like this: 

BOOL CTrayIcon::ShowBalloonTip(LPCTSTR szMsg,
  LPCTSTR szTitle, UINT uTimeout, DWORD dwInfoFlags)
{
  m_nid.cbSize=sizeof(NOTIFYICONDATA);
  m_nid.uFlags = NIF_INFO;
  m_nid.uTimeout = uTimeout;
  m_nid.dwInfoFlags = dwInfoFlags;
  strcpy(m_nid.szInfo,szMsg ? szMsg : _T(""));
  strcpy(m_nid.szInfoTitle,szTitle ? szTitle : _T(""));
  return Shell_NotifyIcon(NIM_MODIFY, &m_nid);
}

 

Автор: ElcnU 17.5.2006, 10:51
Спасибо! всё работает,как никогда ) 

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)