Article View: borland.public.cppbuilder.nativeapi
Article #5668ToolTip Notify ?
From: Sasan
Date: Tue, 02 Aug 2005 05:05
Date: Tue, 02 Aug 2005 05:05
118 lines
4782 bytes
4782 bytes
Hello,
I want do something when user click on link in tooltip but
i have not know how can grab this message (click on link) ?
I test TTN_LINKCLICK in ToolTip wndproc but no result !
can help me about this notify TTN_LINKCLICK ?
Best regards,
M.T
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifdef STRICT
OLDWNDPROC WNDPROC
#else
OLDWNDPROC FARPROC
#endif
OLDWNDPROC TTDefWndProc;
//---------------------------------------------------------------------------
// ToolTip Window procedure
//
LRESULT CALLBACK TTWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
lParam)
{
LRESULT lRes;
if ( uMsg == WM_NOTIFY )
{
LPNMHDR lp = (LPNMHDR) lParam;
if ( lp->code == TTN_LINKCLICK )
SendMessage(GetParent(hwnd), WM_NOTIFY, wParam, lParam);
}
lRes = CallWindowProc(TTDefWndProc, hwnd, uMsg, wParam, lParam);
return lRes;
}
//---------------------------------------------------------------------------
// Create ToolTip
//
bool __fastcall TToolTip::Create()
{
bool bRes = false;
try
{
DWORD dwExStyle, dwStyle;
dwExStyle = WS_EX_TOPMOST;
if ( FRtl ) dwExStyle |= WS_EX_RIGHT | WS_EX_RTLREADING;
dwStyle = WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP;
if ( FBalloon ) dwStyle |= TTS_BALLOON;
if ( FClose ) dwStyle |= TTS_CLOSE;
if ( FHToolTip )
if ( !DestroyWindow(FHToolTip) )
throw Exception("ERROR - In destroy window.");
FHToolTip = CreateWindowEx( dwExStyle,
TOOLTIPS_CLASS,
NULL,
dwStyle,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
FHParent,
0,
HInstance,
NULL );
if ( FHToolTip != 0 )
{
TTDefWndProc = (OLDWNDPROC) GetWindowLong(FHToolTip,
GWL_WNDPROC);
if ( TTDefWndProc )
{
if ( !SetWindowLong(FHToolTip, GWL_WNDPROC, (LONG)
TTWndProc) )
throw Exception("ERROR - In assign window procedure.");
}
else
throw Exception("ERROR - In get window procedure.");
UINT uFlags;
uFlags = TTF_SUBCLASS | TTF_ABSOLUTE;
if ( FTracking ) uFlags |= TTF_TRACK;
if ( FTransparent ) uFlags |= TTF_TRANSPARENT;
if ( FRtl ) uFlags |= TTF_RTLREADING;
if ( FCenter ) uFlags |= TTF_CENTERTIP;
SetWindowPos(FHToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE |
SWP_NOSIZE |
SWP_NOACTIVATE);
FTInfo.cbSize = sizeof(TOOLINFO);
FTInfo.uFlags = uFlags;
FTInfo.hinst = HInstance;
}
else
throw Exception("ERROR - In create window.");
bRes = true;
}
catch(Exception & e)
{
Application->ShowException(&e);
}
return bRes;
}
//---------------------------------------------------------------------------
// Form1 Window procedure (Parent of ToolTip)
//
void __fastcall TForm1::WndProc(Messages::TMessage &Message)
{
if (Message.Msg == WM_NOTIFY)
{
LPNMHDR lp = (LPNMHDR) Message.LParam;
if ( lp->code == TTN_LINKCLICK)
{
////////////////////////////
// Do my code but never happend
}
}
TForm::WndProc(Message);
}
Technical Details
Message-ID:
<42eeff0c@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7cccfbb0a45ed729,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Sasan" <sasan_vm@yahoo.com> From: "Sasan" <sasan_vm@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: ToolTip Notify ? Date: Tue, 2 Aug 2005 09:35:18 +0430 Lines: 120 Organization: Computer Center City X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2055 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2055 NNTP-Posting-Host: 217.219.90.152 Message-ID: <42eeff0c@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1122959116 217.219.90.152 (1 Aug 2005 22:05:16 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail