mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 10:03:56 +01:00
fix: tray icons' text was garbage
This commit is contained in:
parent
4fe544514a
commit
a9f954e9b1
@ -129,7 +129,7 @@ object optionsFrm: ToptionsFrm
|
|||||||
object Label7: TLabel
|
object Label7: TLabel
|
||||||
Left = 251
|
Left = 251
|
||||||
Top = 349
|
Top = 349
|
||||||
Width = 299
|
Width = 430
|
||||||
Height = 28
|
Height = 28
|
||||||
Hint = 'You also need to right click on the folder, then restrict access'
|
Hint = 'You also need to right click on the folder, then restrict access'
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
@ -161,7 +161,7 @@ object optionsFrm: ToptionsFrm
|
|||||||
WordWrap = True
|
WordWrap = True
|
||||||
end
|
end
|
||||||
object Label8: TLabel
|
object Label8: TLabel
|
||||||
Left = 336
|
Left = 345
|
||||||
Top = 20
|
Top = 20
|
||||||
Width = 28
|
Width = 28
|
||||||
Height = 14
|
Height = 14
|
||||||
|
|||||||
21
traylib.pas
21
traylib.pas
@ -35,25 +35,26 @@ type
|
|||||||
TM_ERROR = NIIF_ERROR
|
TM_ERROR = NIIF_ERROR
|
||||||
);
|
);
|
||||||
|
|
||||||
TNotifyIconDataEx = record
|
TNotifyIconData = record
|
||||||
cbSize: DWORD;
|
cbSize: DWORD;
|
||||||
wnd: HWND;
|
wnd: HWND;
|
||||||
uID: UINT;
|
uID: UINT;
|
||||||
uFlags: UINT;
|
uFlags: UINT;
|
||||||
uCallbackMessage: UINT;
|
uCallbackMessage: UINT;
|
||||||
hIcon: HICON;
|
hIcon: HICON;
|
||||||
szTip: array [0..127] of AnsiChar;
|
szTip: array [0..127] of Char;
|
||||||
dwState: DWORD;
|
dwState: DWORD;
|
||||||
dwStateMask: DWORD;
|
dwStateMask: DWORD;
|
||||||
szInfo: array[0..255] of AnsiChar;
|
szInfo: array[0..255] of Char;
|
||||||
uVersion: UINT;
|
uVersion: UINT;
|
||||||
szInfoTitle: array[0..63] of AnsiChar;
|
szInfoTitle: array[0..63] of Char;
|
||||||
dwInfoFlags: DWORD;
|
dwInfoFlags: DWORD;
|
||||||
|
hBaloonIcon: HICON;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TmyTrayIcon=class
|
TmyTrayIcon=class
|
||||||
private
|
private
|
||||||
icondata: TNotifyIconDataEx;
|
icondata: TNotifyIconData;
|
||||||
shown: boolean;
|
shown: boolean;
|
||||||
procedure wndProc(var Message: TMessage);
|
procedure wndProc(var Message: TMessage);
|
||||||
procedure notify(ev:TtrayEvent);
|
procedure notify(ev:TtrayEvent);
|
||||||
@ -114,8 +115,8 @@ end;
|
|||||||
procedure TmyTrayIcon.update();
|
procedure TmyTrayIcon.update();
|
||||||
begin
|
begin
|
||||||
if shown then
|
if shown then
|
||||||
if not Shell_NotifyIcon(NIM_MODIFY, @icondata) then
|
if not Shell_NotifyIconW(NIM_MODIFY, @icondata) then
|
||||||
Shell_NotifyIcon(NIM_ADD, @icondata);
|
Shell_NotifyIconW(NIM_ADD, @icondata);
|
||||||
end; { update }
|
end; { update }
|
||||||
|
|
||||||
procedure TmyTrayIcon.setIcon(icon:Ticon);
|
procedure TmyTrayIcon.setIcon(icon:Ticon);
|
||||||
@ -141,7 +142,7 @@ begin
|
|||||||
s:=stringReplace(s,'&','&&',[rfReplaceAll]);
|
s:=stringReplace(s,'&','&&',[rfReplaceAll]);
|
||||||
if length(s) > maxTipLength then setlength(s,maxTipLength);
|
if length(s) > maxTipLength then setlength(s,maxTipLength);
|
||||||
if string(icondata.szTip) = s then exit;
|
if string(icondata.szTip) = s then exit;
|
||||||
strPLCopy(icondata.szTip, ansiString(s), sizeOf(icondata.szTip)-1);
|
strPLCopy(icondata.szTip, s, sizeOf(icondata.szTip)-1);
|
||||||
update();
|
update();
|
||||||
end; // setTip
|
end; // setTip
|
||||||
|
|
||||||
@ -200,8 +201,8 @@ case kind of
|
|||||||
TM_INFO: icondata.dwInfoFlags:=NIIF_INFO;
|
TM_INFO: icondata.dwInfoFlags:=NIIF_INFO;
|
||||||
else icondata.dwInfoFlags:=NIIF_NONE;
|
else icondata.dwInfoFlags:=NIIF_NONE;
|
||||||
end;
|
end;
|
||||||
strPLCopy(icondata.szInfo, ansiString(msg), sizeOf(icondata.szInfo)-1);
|
strPLCopy(icondata.szInfo, msg, sizeOf(icondata.szInfo)-1);
|
||||||
strPLCopy(icondata.szInfoTitle, ansiString(title), sizeOf(icondata.szInfoTitle)-1);
|
strPLCopy(icondata.szInfoTitle, title, sizeOf(icondata.szInfoTitle)-1);
|
||||||
icondata.uVersion:=round(secondsTimeout*1000);
|
icondata.uVersion:=round(secondsTimeout*1000);
|
||||||
icondata.uFlags := icondata.uFlags or NIF_INFO;
|
icondata.uFlags := icondata.uFlags or NIF_INFO;
|
||||||
update();
|
update();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user