Menelaos Vergis

I want to get the Wnd of a toolbar Button and it is not possible.

I create a CToolBar object and it is working corectly but when i want to get the Wnd of button it returns NULL.

CToolBar m_wndEditBar;

m_wndEditBar.GetDlgItem(ID_ESTIMATOR) == NULL
and
((CMainFrame *) AfxGetMainWnd())->GetDlgItem(ID_ESTIMATOR) == NULL

How can I get the Wnd of a ToolBar Button






Re: Visual C++ General I can't get the Wnd of a toolbar button

alex.m

I don't think toolbars keep separate window handlers for each button;

CToolBar itself is a CWnd derived with a valid window handler, after calling Create / LoadToolBar.

What are you trying to do

Clues:

http://msdn2.microsoft.com/en-us/library/69wz6ea1(VS.80).aspx





Re: Visual C++ General I can't get the Wnd of a toolbar button

Menelaos Vergis


I was afraid of that. I want to insert custom tooltips to Toolbars and it is not possible. Custom tooltips can addTool to a Wnd or to a CRect.

If I cannot find the Wnd of the toolbar¡¯s Button then I will have to use CRect instead. This is not very good approach because Toolbars are movable and the CRects must be updated after every move. Excluding this, getting the CRect of a toolbar¡¯s button is not working all the time correctly.

You can check out the reason that I want Custom Tooltips at this thread:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=2370457&SiteID=1






Re: Visual C++ General I can't get the Wnd of a toolbar button

Pintu Shukla


See i will Suggest you Different method instead of doing all of this it's good if you use TBBUTTON structure to create your Toolbar Button so easily you can handle your ToolTip Etc. and Second thing each button has a ID then what's the problem you also can get Handle of window by it's ID .

Thanx





Re: Visual C++ General I can't get the Wnd of a toolbar button

alex.m

Menelaos, I still don't understand why your regular tooltips do not work.
Can you explain a bit more what you are doing (.net, MFC, Win32)

But supposing that you have to manually setup a tooltip control for a toolbar, the rectangles are in client coordinates, so you don't have to update anything when the toolbar is docked / moved.





Re: Visual C++ General I can't get the Wnd of a toolbar button

Menelaos Vergis

I am writing on MFC with VisualStudio 2005. We have created a 3D viewer with OpenGL. We are showing the 3D viewer in its own window but we have ¡°attach" it to our mainframe (when it is moving or resizing we resize the OpenGL window [we must use it in a different wnd]).

Left and over of the OpenGL wnd there are Toolbars and when a tooltip from the toolbar must be shown over the OpenGL wnd it is hidden under it.

This was not happening before Common Controls 6.0.

Isn't a silly reason that our 3rd Version at year 2007 have still the old controls !

The CRects there are in client coordinates but I have place the tooltips obj in mainfrm. It is a good idea to make my own class delivered from CToolbar and place in there the tooltips obj so I will have no problem after move/dock the toolbar.

Thank you and I hope this will work and allot of work for my self to recreate all the tootips.





Re: Visual C++ General I can't get the Wnd of a toolbar button

alex.m


This might help you.

http://msdn2.microsoft.com/en-us/library/td0hze6f(VS.80).aspx


I still suspect that the way your OpenGL window is attached could be the source be the problem. Wouldn't it be nicer to have a quick look at you windows attributes (styles and extended styles) and hierarchy rather than deriving all your toolbars
May be Spy++ can be helpful here.




Re: Visual C++ General I can't get the Wnd of a toolbar button

Menelaos Vergis

Thanks for your concern and your advices but this came to a dead end. I will not make my own tooltips because in Vista there is no problem with the Common Controls 6.0. This Bug exists only in winXP and we will wait for them to grow older and people pass to Vista but even then there will be many users of WinXP.

Our Application ¡°Shiny Glows¡± in Windows Vista when we use CC6.0 but we have to wait some time since our customers can enjoy ¡°aero¡±.