Trayicon hint, length bug !?

delphi package - easy access to kernel objects etc.
Post Reply
brianwarming
Posts: 2
Joined: Thu Apr 02, 2009 11:54 am
Location: Denmark

Trayicon hint, length bug !?

Post by brianwarming »

I had a problem with setting and getting long trayicon hints. Then I read the madKernel.pas :
procedure TITrayIcon.SetHint(value: AnsiString);
var s1 : AnsiString;
begin
if CheckValid then begin
s1 := FNID.szTip;
StrPLCopy(FNID.szTip, value, 63);
if FVisible then begin
FNID.uFlags := NIF_TIP;
if not Shell_NotifyIcon(NIM_MODIFY, @FNID) then begin
StrPCopy(FNID.szTip, s1);
SetLastError(CErrorNo_Unknown, CErrorStr_Unknown);
end;
FNID.uFlags := 0;
end;
end;
end;
Okay, max 64 characters, but then I did a google search and found this :

From Microsoft MSDN :
szTip
A null-terminated string that specifies the text for a standard ToolTip. It can have a maximum of 64 characters, including the terminating null character.

For Windows 2000 (Shell32.dll version 5.0) and later, szTip can have a maximum of 128 characters, including the terminating null character.
and from the ShellAPI.pas (Delphi 2007) :
_NOTIFYICONDATAW = record
cbSize: DWORD;
Wnd: HWND;
uID: UINT;
uFlags: UINT;
uCallbackMessage: UINT;
hIcon: HICON;
szTip: array [0..127] of WideChar;
dwState: DWORD;
dwStateMask: DWORD;
szInfo: array [0..255] of WideChar;
uTimeout: UINT;
szInfoTitle: array [0..63] of WideChar;
dwInfoFlags: DWORD;
end;
So the szTip should be 128 characters long, right ?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

It seems that it can be either 64 or 128 characters, depending on the OS or shell32 version. So I guess madKernel should behave differently, depending on the OS/shell32 version. Will put that on my to do list. But it might take a while until I get to add that...
Post Reply