🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #707

Re: IE6: Changing tooltip on my own toolbar button

#707
From: GIZMO
Date: Thu, 21 Sep 2006 11:29
91 lines
4253 bytes
Brian wrote:
> Any ideas how to make this happen?
IE takes text of the tooltip equal caption buttons, find its button and
change her caption
only for example ...

STDMETHODIMP TMyButtonImpl::Exec(const GUID *pCmdGroup, DWORD nCmdID,
DWORD nCmdExecOpt,
								  VARIANTARG *pvaIn, VARIANTARG *pvaOut)
{
    HWND hwndIEFrame(NULL);
	m_pWebBrowser2->get_HWND((long*)&hwndIEFrame);
    char classname[80];

    HWND hWndReBar = FindRebar(hwndIEFrame);
    if(!hWndReBar) return S_OK;
    int nCount = (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L);
    for (int i = 0; i < nCount; i++)
    {
        REBARBANDINFO rbbi = { sizeof(REBARBANDINFO), RBBIM_CHILD |
RBBIM_STYLE};
        BOOL bRet = (BOOL)::SendMessage(hWndReBar, RB_GETBANDINFO, i,
(LPARAM)&rbbi);
        if (bRet && rbbi.hwndChild)
        {
            ::GetClassName(rbbi.hwndChild, classname, 80);
            if (strcmp(classname, "ToolbarWindow32") == 0)
            {
                int ButtonCount = ::SendMessage((HWND) rbbi.hwndChild,
(UINT) TB_BUTTONCOUNT, 0, 0);
                for (int j = 0; j < ButtonCount; j++)
                {
                    char lpszText[100];
                    TBBUTTON tb;
                    ::SendMessage((HWND) rbbi.hwndChild, (UINT)
TB_GETBUTTON, (WPARAM) (int) j, (LPARAM) (LPARAM) (LPTBBUTTON) &tb);
                    ::SendMessage((HWND) rbbi.hwndChild, (UINT)
TB_GETBUTTONTEXT, (WPARAM) (int) tb.idCommand, (LPARAM) (LPTSTR)
lpszText);
                   // this is given only for example
                    if (strcmp(lpszText, "Direct") == 0)
                    {
                        TBBUTTONINFO tbi;
                        tbi.cbSize  = sizeof(TBBUTTONINFO);
                        tbi.dwMask = TBIF_TEXT;
                        tbi.pszText = "Use a proxy server";
                        ::SendMessage((HWND) rbbi.hwndChild, (UINT)
TB_SETBUTTONINFO, (WPARAM) (int) tb.idCommand, (LPARAM)
(LPTBBUTTONINFO)&tbi);

                        break;
                    }
                    else if (strcmp(lpszText, "Use a proxy server") ==
0)
                    {
                        TBBUTTONINFO tbi;
                        tbi.cbSize  = sizeof(TBBUTTONINFO);
                        tbi.dwMask = TBIF_TEXT;
                        tbi.pszText = "Direct";
                        ::SendMessage((HWND) rbbi.hwndChild, (UINT)
TB_SETBUTTONINFO, (WPARAM) (int) tb.idCommand, (LPARAM)
(LPTBBUTTONINFO)&tbi);

                        break;
                    }
                }
            }

        }
    }

    return S_OK;
}

HWND TMyButtonImpl::FindRebar(HWND hwndStart)
{
	HWND hwndFound=NULL;
	if (((hwndFound =
		FindWindowEx(hwndStart, NULL, REBARCLASSNAME, NULL)) != NULL))
		return hwndFound;

	HWND hwndEnum=NULL;
	while ((hwndEnum = FindWindowEx(hwndStart, hwndEnum, NULL, NULL)) !=
NULL){
		if ((hwndFound = FindRebar(hwndEnum)) != NULL)
			return hwndFound;
	}

	return NULL;
}
Technical Details
Message-ID: <1158838144.928427.167170@m73g2000cwd.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!m73g2000cwd.googlegroups.com!not-for-mail
References: <4501dfa4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,910a533dcf609655
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!m73g2000cwd.googlegroups.com!not-for-mail
From: "GIZMO" <_gizmo@mail.ru>
Newsgroups: borland.public.cppbuilder.internet.web
Subject: Re: IE6: Changing tooltip on my own toolbar button
Date: 21 Sep 2006 04:29:04 -0700
Organization: http://groups.google.com
Lines: 92
Message-ID: <1158838144.928427.167170@m73g2000cwd.googlegroups.com>
References: <4501dfa4$1@newsgroups.borland.com>
NNTP-Posting-Host: 195.201.33.209
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1158838150 6072 127.0.0.1 (21 Sep 2006 11:29:10 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 21 Sep 2006 11:29:10 +0000 (UTC)
In-Reply-To: <4501dfa4$1@newsgroups.borland.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 ps2.laes.ru:3128 (squid/2.5.STABLE7)
Complaints-To: groups-abuse@google.com
Injection-Info: m73g2000cwd.googlegroups.com; posting-host=195.201.33.209;
   posting-account=UAEsuw0AAAA2lJ1aYaDTjGKzQEXNTxzW