Fórum Balloon ToolTips no TaskBar? (Sem usar componente) #334869
18/12/2006
0
hwndToolTips = CreateWindow(TOOLTIPS_CLASS,
NULL,
WS_POPUP | TTS_NOPREFIX | TTS_BALLOON,
0, 0,
0, 0,
NULL, NULL,
g_hinst,
NULL);
if (hwndTooltip)
{
// Do the standard ToolTip coding.
TOOLINFO ti;
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_TRANSPARENT | TTF_CENTERTIP;
ti.hwnd = hwnd;
ti.uId = 0;
ti.hinst = NULL;
ti.lpszText = LPSTR_TEXTCALLBACK;
GetClientRect(hwnd, &ti.rect);
SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM) &ti );
NOTIFYICONDATA IconData = ;
IconData.cbSize = SIZEOF(IconData);
IconData.hWnd = hwndNI;
IconData.uFlags = NIF_INFO;
HRESULT hr = StringCchCopy(IconData.szInfo, ARRAYSIZE(IconData.szInfo), TEXT("Your message text goes here."));
if(FAILED(hr))
{
// TODO: Write an error handler in case the call to StringCchCopy fails.
}
IconData.uTimeout = 15000; // in milliseconds
Shell_NotifyIcon(NIM_MODIFY, &IconData);
}O código acima seria para mostrar um BaloonTool no tray, não estou conseguindo converter este código para Delphi (7).
Alguem teria a solução, ou outro código sem que haja a necessidade de se utilizar componentes?
Weber
Curtir tópico
+ 0
Responder
Posts
18/12/2006
Weber
Pra quem interessar: :D
uses
Commctrl;
TTimeoutOrVersion = record
case Integer of // 0: Before Win2000; 1: Win2000 and up
0: (uTimeout: UINT);
1: (uVersion: UINT); // Only used when sending a NIM_SETVERSION message
end;
TNotifyIconDataEx = record
cbSize: DWORD;
hWnd: HWND;
uID: UINT;
uFlags: UINT;
uCallbackMessage: UINT;
hIcon: HICON;
szTip: array[0..127] of AnsiChar; // Previously 64 chars, now 128
dwState: DWORD;
dwStateMask: DWORD;
szInfo: array[0..255] of AnsiChar;
TimeoutOrVersion: TTimeoutOrVersion;
szInfoTitle: array[0..63] of AnsiChar;
dwInfoFlags: DWORD;
{$IFDEF _WIN32_IE_600}
guidItem: TGUID; // Reserved for WinXP; define _WIN32_IE_600 if needed
{$ENDIF}
end;
procedure ShowBallonToolTip(Titulo, Mensagem: String);
var
IconData: TNotifyIconDataEx;
begin
IconData.cbSize := SizeOf(TNotifyIconDataEx);
IconData.hWnd := TrayIcon.Wnd;
IconData.uId := TrayIcon.uID;
IconData.uCallbackMessage := TrayIcon.uCallbackMessage;
IconData.uFlags := $00000010;
StrLCopy(IconData.szInfo, PChar(Mensagem), SizeOf(IconData.szInfo)-1);
StrLCopy(IconData.szInfoTitle, PChar(Titulo), SizeOf(IconData.szInfoTitle)-1);
IconData.TimeoutOrVersion.uTimeout := 10000;
IconData.dwInfoFlags := $00000001;
Shell_NotifyIcon(NIM_MODIFY, @IconData);
end;
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)