Thread View: borland.public.cppbuilder.internet.web
2 messages
2 total messages
Started by Brian
Fri, 08 Sep 2006 21:24
IE6: Changing tooltip on my own toolbar button
Author: Brian
Date: Fri, 08 Sep 2006 21:24
Date: Fri, 08 Sep 2006 21:24
11 lines
1373 bytes
1373 bytes
I've created a toolbar button for IE6 that changes the proxy settings from 'Direct' to 'Use a proxy server' and back again. What I'd like to do is change the mouseover tooltip to show the action that will happen when the toolbar button is pressed (i.e. if the proxy server is currently set to direct then the tooltip should say 'Set proxy server to ON'). Any ideas how to make this happen? Changing the registry setting SOFTWARE\\Microsoft\\Internet Explorer\\Extensions\\guid\\MenuText only affects the tooltip when you restart IE...
Re: IE6: Changing tooltip on my own toolbar button
Author: GIZMO
Date: Thu, 21 Sep 2006 11:29
Date: Thu, 21 Sep 2006 11:29
91 lines
4253 bytes
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;
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads