The Mad Butcher
May 1st, 1998, 07:55 AM
I had the problem with the toolbar class that if i moved a toolbar, the old
window still remained on screen. This was because the old window never was
removed after a move.. Which only could mean that the WM_WINDOWPOSCHANGING message was not handled (correctly). After retrieving the latest version of the source (Toolbar_105.zip) and some searching I found that there was a function implemented for handling the WM_WINDOWPOSCHANGING message, but the message was never handled by MFC.. Then i looked at the message map for MFC in NGenericToolBar.cpp and... My thoughts where right.. The message was not handled by MFC 'cause it was not in the message map!
Here is how to fix it..
In the file NGenericToolBar.cpp, near line 35 the message map is declared.
Here there is something forgotten (! The WM_WINDOWPOSCHANGING is NOT handled !)
This the message mas as it should be:
BEGIN_MESSAGE_MAP(CNGenericToolBar,CToolBar)
//{{AFX_MSG_MAP(CNGenericToolBar)
ON_WM_CONTEXTMENU()
ON_WM_DESTROY()
ON_WM_PAINT()
ON_WM_NCCALCSIZE()
ON_WM_NCPAINT()
ON_WM_NCHITTEST()
ON_WM_WINDOWPOSCHANGING() // TMB! This one is realy needed but wasn't there!
//}}AFX_MSG_MAP
ON_COMMAND(IDM_BUTTONSONLY,OnButtonsOnly)
ON_COMMAND(IDM_BUTTONSANDTEXT,OnTextAndButtons)
ON_COMMAND(IDM_TEXTONLY,OnTextOnly)
ON_COMMAND(IDM_RECALCSIZE,OnRecalcSize)
END_MESSAGE_MAP()
Greetings,
Albert 'The Mad Butcher' van Peppen
window still remained on screen. This was because the old window never was
removed after a move.. Which only could mean that the WM_WINDOWPOSCHANGING message was not handled (correctly). After retrieving the latest version of the source (Toolbar_105.zip) and some searching I found that there was a function implemented for handling the WM_WINDOWPOSCHANGING message, but the message was never handled by MFC.. Then i looked at the message map for MFC in NGenericToolBar.cpp and... My thoughts where right.. The message was not handled by MFC 'cause it was not in the message map!
Here is how to fix it..
In the file NGenericToolBar.cpp, near line 35 the message map is declared.
Here there is something forgotten (! The WM_WINDOWPOSCHANGING is NOT handled !)
This the message mas as it should be:
BEGIN_MESSAGE_MAP(CNGenericToolBar,CToolBar)
//{{AFX_MSG_MAP(CNGenericToolBar)
ON_WM_CONTEXTMENU()
ON_WM_DESTROY()
ON_WM_PAINT()
ON_WM_NCCALCSIZE()
ON_WM_NCPAINT()
ON_WM_NCHITTEST()
ON_WM_WINDOWPOSCHANGING() // TMB! This one is realy needed but wasn't there!
//}}AFX_MSG_MAP
ON_COMMAND(IDM_BUTTONSONLY,OnButtonsOnly)
ON_COMMAND(IDM_BUTTONSANDTEXT,OnTextAndButtons)
ON_COMMAND(IDM_TEXTONLY,OnTextOnly)
ON_COMMAND(IDM_RECALCSIZE,OnRecalcSize)
END_MESSAGE_MAP()
Greetings,
Albert 'The Mad Butcher' van Peppen