🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #12806

Re: Hooking to Windows ToolTips

#12806
From: Marc
Date: Tue, 18 Nov 2003 14:02
78 lines
4027 bytes
Hi

Thanks Remy, I am getting closer to the goal.

I am running windows XP and I am capable of detecting a 
tooltip is about to be shown, from the bottom task bar.
Using the SetWindowsHookEx() and WM_NOTIFY i get the 
TTN_SHOW message.  I don't get the TTN_GETDISPINFO or 
TTN_NEEDTEXT.  The message that is recieved, comes from the
TaskBar so when I ask for the handle of the window, I get
the TaskBar handle not the tooltip handle.  

Can I somehow retrieve the tooltip handle, to modify its
Text.

Thanks
Marc

Ps Here is what I tried to modify the text:
The pTTTW pointer text part is invalid
void OnNotify(IN CWPSTRUCT *pPreMsg)
{
    OFNOTIFY *pOFN = (OFNOTIFY*)pPreMsg->lParam; 

    NMHDR *pNMHDR;
    pNMHDR = (NMHDR*)pPreMsg->lParam;

    if (pNMHDR->code == TTN_SHOW)
    {
//      MessageBox(0,"TTN_SHOW","TTN_SHOW", MB_OK);
        TOOLTIPTEXT* pTTTW = reinterpret_cast<TOOLTIPTEXT*>( pPreMsg->lParam );
        UINT nID = static_cast<UINT>( pNMHDR->idFrom );
   
        RECT rcWnd;   
        GetWindowRect(pPreMsg->hwnd, &rcWnd);

        char Buffer[512];
        wsprintf(Buffer,"Top:%d  Left:%d  Bottom:%d  Right:%d \r\n", rcWnd.top, rcWnd.left, rcWnd.bottom, rcWnd.right);
        OutputDebugString(Buffer);
    }


"Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote:
>
>"Marc" <remove_Bukwheat@axess.com> wrote in message
>news:3fb8e5d5$1@newsgroups.borland.com...
>
>> The class subclassing also doesn't seem to work.
>
>You cannot subclass external windows.  If you want to intercept messages
>from other applications, then you must use a message hook dll via
>SetWindowsHookEx().
>
>> What I am trying to do, is trap the fact that a tooltip is
>> about to be displayed, and modify the text of it, and maybe
>> even its location if needed.  I already have achieved this
>> with system menus, but can't do it with tooltips.  Where does
>> widows do its messaging for tooltips?
>
>Tooltips are handled on a per-application, per-window basis.  Each
>individual application creates and displays its own tooltip windows when
>appropriate, like any other window.
>
>However, even that is not standardized.  VCL apps, for example, handle
>tooltips very differently than, say, VB or VC++.  The VCL uses its own
>standalone THintWindow class, which has nothing to do with the native
>tooltip features provided by the Win32 API.  In fact, the VCL has no concept
>of the API tooltips at all.  On the other hand, those applications that do
>use true API tooltips will most likely receive a WM_NOTIFY message
>containing either a TTN_GETDISPINFO or TTN_NEEDTEXT notification just prior
>to displaying the tooltip, so you can try looking for those notifications in
>your message hook.
>
>
>Gambit
>
>
Technical Details
Message-ID: <3fba3491$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fb3ef78$1@newsgroups.borland.com> <3fb3f737@newsgroups.borland.com> <3fb4ec69$1@newsgroups.borland.com> <3fb5015f$1@newsgroups.borland.com> <3fb514e5$1@newsgroups.borland.com> <3fb522c0$1@newsgroups.borland.com> <3fb8e5d5$1@newsgroups.borland.com> <3fb90c0a@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,77f5c963a5b23dbd
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-11-18 07:10:33 PST
From: "Marc" <remove_Bukwheat@axess.com>
Sender: "Marc" <remove_Bukwheat@axess.com>
Reply-To: "Marc" <remove_Bukwheat@axess.com>
Subject: Re: Hooking to Windows ToolTips
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 138.11.254.204     
X-Forwarded-For: unknown
References: <3fb3ef78$1@newsgroups.borland.com> <3fb3f737@newsgroups.borland.com> <3fb4ec69$1@newsgroups.borland.com> <3fb5015f$1@newsgroups.borland.com> <3fb514e5$1@newsgroups.borland.com> <3fb522c0$1@newsgroups.borland.com> <3fb8e5d5$1@newsgroups.borland.com> <3fb90c0a@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <3fba3491$2@newsgroups.borland.com>
Date: 18 Nov 2003 07:02:41 -0700
X-Trace: newsgroups.borland.com 1069167761 207.105.83.66 (18 Nov 2003 07:02:41 -0700)
Lines: 79
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail