ClassWizard Generated CToolBarCtrl::Create()
Greg D. Tighe -- gdt@eng.aisinc.com
Friday, May 10, 1996
MSVC++ 4.1, Windows 95
I wanted to add a toolbar control to one of my views, so I created my
own class derived from CToolBarCtrl, added a member variable of this
type to my view class and invoked CMyTBCtrl::Create() from within
CMyView::OnInitialUpdate(). Everything works fine.
Next I decided to add some custom controls to my toolbar control and
decided that I needed to create these custom controls when my toolbar
control was created. So I invoked ClassWizard, selected CMyTBCtrl
and saw right there at the top of the "Messages" list; "Create".
(I later figured out that I wanted to override the OnCreate() method
for my toolbar control, *not* the Create() method.)
However, when I double-clicked on "Create" the clicked on the "Edit
Code" button I saw that ClassWizard had generated the following
method declaration for me:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL);
This is the same method declaration for CWnd::Create(), not
CToolBarCtrl::Create(). Indeed, when I rebuilt my application I got
a compiler error in CMyView.cpp because my original invocation of
CMyToolBar::Create() now had an incorrect number (and types) of
parameters.
What I expected ClassWizard to generate was a method like the
following:
virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
So, is this expected behavior? Should ClassWizard have generated a
CToolBarCtrl-style Create() method for me?
-Greg Tighe
Applied Intelligent Systems, Inc.
Ann Arbor, MI
gdt@aisinc.com
David W. Gillett -- DGILLETT@expertedge.com
Monday, May 13, 1996
[Mini-digest: 3 responses]
> However, when I double-clicked on "Create" the clicked on the "Edit
> Code" button I saw that ClassWizard had generated the following
> method declaration for me:
>
> virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
> DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,
> CCreateContext* pContext = NULL);
>
> This is the same method declaration for CWnd::Create(), not
> CToolBarCtrl::Create(). Indeed, when I rebuilt my application I got
> a compiler error in CMyView.cpp because my original invocation of
> CMyToolBar::Create() now had an incorrect number (and types) of
> parameters.
ClassWizard similarly provides an (invalid) override of
CWnd::Create() for CDialog-derived objects (which want to override
CDialog::Create(), with its own different parameter list).
Dave
-----From: Mike Dickson
I had some problems like this what I did was to use the class CToolBar and
not use CToolBarCtrl.
I just edited the cpp and h files to this. This is much simpler to call,
but there may be some functionality
in CToolBarCtrl that I will not be able to access but since my need was
simple this works great.
Michael++
I regard golf as an expensive way of playing marbles.
--- G. K. Chesterton
-----From: "Mike Blaszczak"
> MSVC++ 4.1, Windows 95
Thanks.
> However, when I double-clicked on "Create" the clicked on the "Edit
> Code" button I saw that ClassWizard had generated the following
> method declaration for me:
It sounds like you've found a bug in ClassWizard. I'll see if I can get it in
front of one of the Wizards guys.
.B ekiM
TCHAR szDixiesBBQ[] = _T("Have you met The Man?");
| Вернуться в корень Архива
|