我是想做个托盘,在最小化后变成托盘,可是总是出问题
procedure TForm1.AddIco;
var
nid: TNotifyIconData;
begin
nid.cbSize := sizeof(nid);
nid.Wnd := Handle;
nid.uID := 0;
nid.hIcon := Application.Icon.Handle;
nid.szTip := 'test';
nid.uCallbackMessage := MY_MESSAGE;
nid.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
if not Shell_NotifyIcon(NIM_ADD, @nid) then
begin
ShowMessage('error');
Application.Terminate;
end;
end;
procedure TForm1.WMSysCommand(var msg: TMessage);
begin
if msg.WParam=SC_MINIMIZE then
begin
AddIco;
Form1.Hide;
inherited;
end else
Inherited;
end;