Trayicon hint, length bug !?

delphi package - easy access to kernel objects etc.

Trayicon hint, length bug !?

Postby brianwarming » Thu Apr 02, 2009 1:57 pm

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 ?
brianwarming
 
Posts: 2
Joined: Thu Apr 02, 2009 11:54 am
Location: Denmark

Postby madshi » Thu Apr 23, 2009 11:59 am

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...
madshi
Site Admin
 
Posts: 9472
Joined: Sun Mar 21, 2004 5:25 pm


Return to madKernel

Who is online

Users browsing this forum: No registered users and 3 guests

cron