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

Вниз

Можно ли сделать Hint у TrayIcon больше 128 символов?   Найти похожие ветки 

 
Sergant   (2004-01-20 11:33) [0]

Столкнулся с такой проблемой: в Hint у TrayIcon нельзя загнать больше 128(7) символов. Есть какие-то альтернативные способы? Т.е. необходило, чтобы при наведении курсора мыши на иконку в трее появлялась подсказка, в которой може т содержаться больше 128 знаков?


 
Юрий Зотов   (2004-01-20 12:29) [1]

Согласно MSDN, в стандартном варианте этого сделать нельзя. Но для версии Shell32.dll от 5.0 и выше можно сделать tooltip длиной 256 символов в стиле balloon. Вот описание структуры NOTIFYICONDATA в MSDN (особо важная для сабжа информация выделена жирным).

typedef struct _NOTIFYICONDATA {
DWORD cbSize;
HWND hWnd;
UINT uID;
UINT uFlags;
UINT uCallbackMessage;
HICON hIcon;
TCHAR szTip[64];
DWORD dwState; //Version 5.0
DWORD dwStateMask; //Version 5.0
TCHAR szInfo[256]; //Version 5.0
union {
UINT uTimeout; //Version 5.0
UINT uVersion; //Version 5.0
} DUMMYUNIONNAME;
TCHAR szInfoTitle[64]; //Version 5.0
DWORD dwInfoFlags; //Version 5.0
} NOTIFYICONDATA, *PNOTIFYICONDATA;

Members

cbSize
Size of this structure, in bytes.

hWnd
Handle to the window that will receive notification messages associated with an icon in the taskbar status area. The Shell uses hWnd and uID to identify which icon on which to operate when Shell_NotifyIcon is invoked.

uID
Application-defined identifier of the taskbar icon. The Shell uses hWnd and uID to identify which icon on which to operate when Shell_NotifyIcon is invoked. You can have multiple icons associated with a single hWnd by assigning each a diffent uID.

uFlags
Array of flags that indicate which of the other members contain valid data. This member can be a combination of the following: Flag Description
NIF_ICON The hIcon member is valid.
NIF_MESSAGE The uCallbackMessage member is valid.
NIF_TIP The szTip member is valid.
NIF_STATE The dwState and dwStateMask members are valid.
NIF_INFO Use a balloon-style ToolTip instead of a standard ToolTip. The szInfo, uTimeout, szInfoTitle, and dwInfoFlags members are valid.

uCallbackMessage
Application-defined message identifier. The system uses this identifier to send notifications to the window identified in hWnd. These notifications are sent when a mouse event occurs in the bounding rectangle of the icon, or when the icon is selected or activated with the keyboard. The wParam parameter of the message contains the identifier of the taskbar icon in which the event occurred. The lParam parameter holds the mouse or keyboard message associated with the event. For example, when the mouse cursor moves over a taskbar icon, lParam is set to WM_MOUSEMOVE. See the Taskbar guide chapter for further discussion.

hIcon
Handle to the icon to be added, modified, or deleted.

szTip
Pointer to a NULL-terminated string with the text for a standard ToolTip. It can have a maximum of 64 characters including the terminating NULL. For Version 5.0 and later, szTip can have a maximum of 128 characters, including the terminating NULL.

dwState
Version 5.0. State of the icon. There are two flags that can be set independently: Flag Description
NIS_HIDDEN The icon is hidden.
NIS_SHAREDICON The icon is shared.

dwStateMask
Version 5.0. A value that specifies which bits of the state member will be retrieved or modified. For example, setting this member to NIS_HIDDEN will cause only the item"s hidden state to be retrieved.

szInfo
Version 5.0. Pointer to a NULL-terminated string with the text for a balloon-style ToolTip. It can have a maximum of 255 characters.
To remove the ToolTip, set the NIF_INFO flag in uFlags and set szInfo to an empty string.

uTimeout
The timeout value, in milliseconds, for a balloon-style ToolTip. The system enforces minimum and maximum timeout values. uTimeout values that are too large are set to the maximum value and values that are too small default to the minimum value. The system minimum and maximum timeout values are currently set at 10 seconds and 30 seconds, respectively. These values may change in future versions of Windows. See the remarks for further discussion of uTimeout. Union with uVersion.

uVersion
Version 5.0. Specifies whether the Shell notify icon interface should use Windows 95 or Windows 2000 behavior. This member is only employed when using Shell_NotifyIcon to send an NIM_VERSION message. Union with uTimeout. Value Description
0 Use the Windows 95 behavior.
NOTIFYICON_VERSION Use the Windows 2000 behavior.

szInfoTitle
Version 5.0. Pointer to a NULL-terminated string containing a title for a balloon ToolTip. This title will be in boldface, and placed above the text. It can have a maximum of 63 characters.


dwInfoFlags
Version 5.0. Flags that can be set to add an icon to a balloon ToolTip. It will be placed to the left of the title. If the szTitleInfo member is zero-length, the icon will not be shown. Flag Description
NIIF_WARNING A warning icon.
NIIF_ERROR An error icon.
NIIF_INFO An information icon.

Remarks

If you set the NIF_INFO flag in the uFlags member, the standard ToolTip, will be replaced by a balloon ToolTip. For more discussion of balloon ToolTips, see the ToolTip Controls chapter.

No more than one balloon ToolTip at at time will be displayed for the taskbar. If an application attempts to display a ToolTip when one is already being displayed, the ToolTip will not appear until the existing balloon ToolTip has been visible for at least the system minum timeout value. For example, a balloon ToolTip with uTimeout set to 30 seconds has been visible for seven seconds when another application attempts to display a balloon ToolTip. If the system minimum timeout is ten seconds, the first ToolTip will be displayed for an additional three seconds before being replaced by the second ToolTip.

Note that several members of this structure are only supported for Shell32.dll versions 5.0 and later. To enable these members, include the following in your header:

#define _WIN32_IE 0x0500

However, you must initialize the structure with its size. If you use the size of the currently defined structure, the application may not run with the earlier versions of Shell32.dll, which expect a smaller structure. You can run your application on pre-5.0 versions of Shell32.dll by defining the appropriate version number (see Shell and Common Controls Versions). However, this may cause problems if your application also needs to run on systems with more recent versions.

Your application can remain compatible with all Shell32.dll versions while still using the current header files by setting the size of the NOTIFYICONDATA structure appropriately. Before initializing the structure, use the DllGetVersion function to determine which Shell32.dll version is installed on the system. If it is version 5.0 or greater, initialize the cbSize member with:

nid.cbSize = sizeof(NOTIFYICONDATA);
Setting cbSize to this value will enable all the version 5.0 enhancements. For earlier versions, the size of the pre-5.0 structure is given by the NOTIFYICONDATA_V1_SIZE constant. Initialize the cbSize member with:

nid.cbSize = NOTIFYICONDATA_V1_SIZE;
Using this value for cbSize will allow your application to use NOTIFYICONDATA with earlier Shell32.dll versions, although without the version 5.0 enhancements.


 
Sergant   (2004-01-20 18:52) [2]

Блин, 256 тоже мало. А как сделать так, чтобы при наведении курсора на иконку в трее выплывало окно(форма), на которой в ListBox то, что мне нужно?


 
Юрий Зотов   (2004-01-20 18:59) [3]

> Sergant (20.01.04 18:52) [2]

При наведении курсора на иконку Ваша программа получит сообщение. Обрабатывать его Вы можете как угодно. Хоть форму покажите, хоть слона на экране нарисуйте.



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

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

Наверх





Память: 0.47 MB
Время: 0.01 c
1-2102
Grugan
2004-01-21 20:34
2004.02.02
Microsoft Outlook


1-2139
UbiVak
2004-01-19 15:31
2004.02.02
Ищу


14-2331
Aleksej
2004-01-11 13:25
2004.02.02
DELPHI


14-2306
DiamondShark
2004-01-11 21:17
2004.02.02
Смертоносный арсенал Саддама


11-2050
TimNew
2003-05-18 01:27
2004.02.02
как установить фокус





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