|
Excellent work with this article.
I tried TabbedSDISplitter.exe demo and it didn't loading in Windows 98 (Virtual PC, JP). It works under XP/2K. I am not sure what's wrong. How to add support. Does this program support Unicode?
|
|
|
|
|
ratass2002 wrote:
I tried TabbedSDISplitter.exe demo and it didn't loading in Windows 98 (Virtual PC, JP). It works under XP/2K. I am not sure what's wrong. How to add support. Does this program support Unicode?
The one that I provide compiled ready to run is a Unicode build. Try opening the project, making new configurations based on the existing Debug/Release, and name them "MBCS Debug" and "MBCS Release". You can rename the original configurations "Unicode Debug" and "Unicode Release".
Then in the "MBCS" configurations, if you're using VC 6, change the precompiled define _UNICODE and UNICODE to be _MBCS instead. If you're on VC 7.1, change Configuration Properties -> Character Set to be "Use Multi-Byte Character Set" instead of "Use Unicode Character Set".
Alternatively, you could use the Unicode build, and use MSLU[^] for running on Windows 9x.
HTH,
-Daniel
|
|
|
|
|
Minor problem at line 338, please replace
CDC dc = TabCtrl.GetDC();
with
CClientDC dc(TabCtrl);
|
|
|
|
|
Thanks a bunch! I wish that problem would have been caught a long time ago, but at least it is now
For others reading, this is in TabbedFrame.h. The current code causes DeleteDC to be called in the CDC destructor instead of ReleaseDC (like CClientDC will do), and DeleteDC isn't suppose to be called on an HDC retrieved via GetDC. It looks like I also have one bug in TabbedMDI.h in OnNcPaint with GetWindowDC if you chosen "DrawFlat" (it should use CWindowDC, not CDC).
There's several places in Sergey Klimov's docking window code that get it wrong too.
This seems fairly important, so I'll put out an update right away with the changes.
Thanks!
-Daniel
|
|
|
|
|
Great finding!!!
[WIN98]This bug actually causes an assertion error when you close the application.
if you just fix it in TabbedFrame.h it will fix the problem in WIN98 for the SDI demo. If you use MDI window probably need to fix it in TabbedMDI.h.
|
|
|
|
|
I posted an update 2 days ago with changes to TabbedFrame, TabbedMDI and Sergey's code, but they still haven't processed it. If it doesn't show up tomorrow, I'll send it in again. After the new code is up, could you try it out and let me know how it goes?
Thanks,
-Daniel
|
|
|
|
|
I just downloaded the source and demo files and they have the changes (at least in TabbedFrame). Based on my use of the same file with the fix, it does work on WIN98.
I forgot to mention that because I couldn't find out why your TabbedSDISplitter demo won't run on WIN98 (I tried compiling without UNICODE but it still won't run). I started a duplicate by adding stuff little by little and tested it on xp/98. I am not sure if it's a setting problem or a code problem, but mine works on both platform so far and it's using UNICODE. I have an impression that some stuff in the code doesn't apply to WIN98 so it won't work.
|
|
|
|
|
When attempting to compile the "TabbedSDISplitter" example I got the following error messages (see bellow). I'm using MSVS 6.0. We don't make much use of templates or the WTL so I'm sure we're just missing something that we should know. Can someone help?
--------------------Configuration: TabbedSDISplitter - Win32 Debug--------------------
Compiling resources...
Compiling...
stdafx.cpp
Compiling...
aboutdlg.cpp
mainfrm.cpp
d:\datafiles\daniel designs\tabingframework\examples\include\tabbedframe.h(507) : error C2039: 'GetClassLongPtr' : is not a member of '`global namespace''
d:\datafiles\daniel designs\tabingframework\examples\include\tabbedframe.h(471) : while compiling class-template member function 'int __thiscall CCustomTabOwnerImpl<class ctabbedframeimpl<class="" ctabbedchildwindow<class="" cdotnettabctrl<class="" c
tabviewtabitem=""> >,class CDotNetTabCtrl<class ctabviewtabitem="">,class CTabbedChildWindowBase<class ctabbedchildwindow<class="" cdotnettabctrl<class="" ctabviewtabitem=""> >,class ATL::CWindow,class ATL::CWinTraits<1442840576,512> > >,class CDotNetTabCtrl<class
ctabviewtabitem=""> >::DisplayTab(struct HWND__ *,int,int)'
d:\datafiles\daniel designs\tabingframework\examples\include\tabbedframe.h(507) : error C2065: 'GetClassLongPtr' : undeclared identifier
d:\datafiles\daniel designs\tabingframework\examples\include\tabbedframe.h(471) : while compiling class-template member function 'int __thiscall CCustomTabOwnerImpl<class ctabbedframeimpl<class="" ctabbedchildwindow<class="" cdotnettabctrl<class="" c
tabviewtabitem=""> >,class CDotNetTabCtrl<class ctabviewtabitem="">,class CTabbedChildWindowBase<class ctabbedchildwindow<class="" cdotnettabctrl<class="" ctabviewtabitem=""> >,class ATL::CWindow,class ATL::CWinTraits<1442840576,512> > >,class CDotNetTabCtrl<class
ctabviewtabitem=""> >::DisplayTab(struct HWND__ *,int,int)'
d:\datafiles\daniel designs\tabingframework\examples\include\tabbedframe.h(507) : error C2065: 'GCLP_HICONSM' : undeclared identifier
d:\datafiles\daniel designs\tabingframework\examples\include\tabbedframe.h(471) : while compiling class-template member function 'int __thiscall CCustomTabOwnerImpl<class ctabbedframeimpl<class="" ctabbedchildwindow<class="" cdotnettabctrl<class="" c
tabviewtabitem=""> >,class CDotNetTabCtrl<class ctabviewtabitem="">,class CTabbedChildWindowBase<class ctabbedchildwindow<class="" cdotnettabctrl<class="" ctabviewtabitem=""> >,class ATL::CWindow,class ATL::CWinTraits<1442840576,512> > >,class CDotNetTabCtrl<class
ctabviewtabitem=""> >::DisplayTab(struct HWND__ *,int,int)'
d:\datafiles\daniel designs\tabingframework\examples\include\tabbedframe.h(520) : error C2065: 'GCLP_HICON' : undeclared identifier
d:\datafiles\daniel designs\tabingframework\examples\include\tabbedframe.h(471) : while compiling class-template member function 'int __thiscall CCustomTabOwnerImpl<class ctabbedframeimpl<class="" ctabbedchildwindow<class="" cdotnettabctrl<class="" c
tabviewtabitem=""> >,class CDotNetTabCtrl<class ctabviewtabitem="">,class CTabbedChildWindowBase<class ctabbedchildwindow<class="" cdotnettabctrl<class="" ctabviewtabitem=""> >,class ATL::CWindow,class ATL::CWinTraits<1442840576,512> > >,class CDotNetTabCtrl<class
ctabviewtabitem=""> >::DisplayTab(struct HWND__ *,int,int)'
TabbedSDISplitter.cpp
d:\datafiles\daniel designs\tabingframework\examples\include\customtabctrl.h(1126) : error C2039: 'GetClassLongPtr' : is not a member of '`global namespace''
d:\datafiles\daniel designs\tabingframework\examples\include\customtabctrl.h(1116) : while compiling class-template member function 'void __thiscall CCustomTabCtrl<class cdotnettabctrl<class="" ctabviewtabitem="">,class CTabViewTabItem,class ATL::
CWindow,class ATL::CWinTraits<1442856960,0> >::StopItemDrag(bool)'
d:\datafiles\daniel designs\tabingframework\examples\include\customtabctrl.h(1126) : error C2065: 'GetClassLongPtr' : undeclared identifier
d:\datafiles\daniel designs\tabingframework\examples\include\customtabctrl.h(1116) : while compiling class-template member function 'void __thiscall CCustomTabCtrl<class cdotnettabctrl<class="" ctabviewtabitem="">,class CTabViewTabItem,class ATL::
CWindow,class ATL::CWinTraits<1442856960,0> >::StopItemDrag(bool)'
d:\datafiles\daniel designs\tabingframework\examples\include\customtabctrl.h(1126) : error C2065: 'GCLP_HCURSOR' : undeclared identifier
d:\datafiles\daniel designs\tabingframework\examples\include\customtabctrl.h(1116) : while compiling class-template member function 'void __thiscall CCustomTabCtrl<class cdotnettabctrl<class="" ctabviewtabitem="">,class CTabViewTabItem,class ATL::
CWindow,class ATL::CWinTraits<1442856960,0> >::StopItemDrag(bool)'
TabbedSDISplitterview.cpp
Generating Code...
Error executing cl.exe.
TabbedSDISplitter.exe - 7 error(s), 0 warning(s)
Jim Daniel
DoT Bellicode
|
|
|
|
|
Beau wrote:
When attempting to compile the "TabbedSDISplitter" example I got the following error messages (see bellow). I'm using MSVS 6.0. We don't make much use of templates or the WTL so I'm sure we're just missing something that we should know. Can someone help?
Sure. MSVC 6.0 comes with rather old window header files. Header files for Microsoft Windows come in what's known as the "platform SDK". Take a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/using_the_windows_headers.asp[^]. You'll want to #define _WIN32_WINNT and WINVER to match your "minimum system requirements". You usually put these #defines in the pre-compiled header (like stdafx.h). GetClassLongPtr and the other things above that had problems are defined in the later header files. If you're targeting 32-bit windows, GetClassLongPtr actually is a #define for GetClassLong.
You could actually get by with the platform SDK from around the XP time frame (August 2001). The latest platform SDK would work too. You can get that from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/[^]. You really just need the "core SDK" part. You'd then update Tools->Options->Directories. Update the "Include files", "Library files" and "Executable files" to put the corresponding psdk directories (include, lib, bin) before the VC6 ones. VC 7, 7.1, and 8.0 (beta) all include more recent platform SDK headers out of the box (whatever was available at the time they shipped).
HTH,
-Daniel
|
|
|
|
|
Thanks for the help.
I still have some questions. First which of the platform SDKs is used for Win2K (my development system)? What is the Oldist Windows version that the custum tab controls will work. We'd really like to support WinME if we can.
Jim Daniel
DoT Bellicode
|
|
|
|
|
Beau wrote:
I still have some questions. First which of the platform SDKs is used for Win2K (my development system)? What is the Oldist Windows version that the custum tab controls will work. We'd really like to support WinME if we can.
You can use the latest and greatest platform SDK for Windows 2000 development, and even Windows 95, 98 or ME development. It all just depends on how you #define _WIN32_WINNT and WINVER (and _WIN32_IE). See that first link I sent. For example
For Windows 2000 as a minimum requirement:
#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
#define _WIN32_IE 0x0501
#define _RICHEDIT_VER 0x0300
Windows XP:
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#define _WIN32_IE 0x0600
#define _RICHEDIT_VER 0x0300
Windows ME:
#define WINVER 0x0500
#define _WIN32_WINDOWS 0x0500
#define _WIN32_IE 0x0501
#define _RICHEDIT_VER 0x0300
Let's say you set Windows 2000 as a minimum requirement. That means if you want to use a function introduced in a later OS such as Windows XP, you'll have to use LoadLibrary/GetProcAddress to call the function instead of having it implicitly callable (and be prepared if GetProcAddress doesn't succeed meaning the function isn't available).
Also, it doesn't depend on the OS that you develop on. You could develop on Windows NT and use the latest platform SDK so that you target Windows Server 2003. You might not be able to debug on Windows NT if you call functions only available on Windows Server 2003, but you can compile just fine. You can also compile for 64-bit on a non-64 bit machine. Again, you won't be able to debug on a 32-bit machine, but you will be able to compile just fine. When you compile, the compiler is not going to be using OS DLLs from your OS install, but rather will reference header and import libraries for OS DLLs from the platform SDK. When you actually run (or debug) your application is when it matters what OS you're running on.
Does that all make sense?
-Daniel
|
|
|
|
|
Yea, it makes the usual MS kind of sense. I think what I'm really asking is if your frame work will run on older Win systems if I can get the thing to compile.
Jim Daniel
DoT Bellicode
|
|
|
|
|
Beau wrote:
I think what I'm really asking is if your frame work will run on older Win systems if I can get the thing to compile.
The tab code itself I believe should work on Windows 95 or later and Windows NT or later. Some of the samples target Windows 2000 or later. If you find something to the contrary, let me know what problems you run into.
-Daniel
|
|
|
|
|
I placed the following code in the MainFrame that hosts the tab conrol
(I used the sample DockingDemo application as an example.)
NOTIFY_CODE_HANDLER(CTCN_SELCHANGING, OnSelChanging)
NOTIFY_CODE_HANDLER(CTCN_SELCHANGE, OnSelChange)
I placed the correct corresponding methods:
LRESULT OnSelChanging(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
return 0;
}
LRESULT OnSelChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
return 0;
}
I didn't mess with the code that creates and subclass the tabcontrol object
CreateMDIClient();
m_tabbedClient.SetTabOwnerParent(m_hWnd);
BOOL bSubclass = m_tabbedClient.SubclassWindow(m_hWndMDIClient);
Why isn't my MainFrame class gets the notification?
Thanks for any help here.
Erez
|
|
|
|
|
erez_me wrote:
Why isn't my MainFrame class gets the notification?
The short answer - the MainFrame is not the direct parent of the tab control. The direct parent is likely a class derived from either CMDITabOwnerImpl or CTabbedFrameImpl. You can run Spy++ to see the window hierarchy.
If you're using MDI tabs, and you want the MainFrame to receive notifications from the tab control, you could have your own CMDITabOwnerImpl derived class. This class could either forward on notifications to the MainFrame, or do the special handling right there. If you have your own CMDITabOwnerImpl derived class, you can use that in the template parameters for CTabbedMDIClient.
If you're not doing MDI tabs, and have a CTabbedFrameImpl derived class as the tab owner (such as CTabbedPopupFrame or CTabbedChildWindow ), you can call SetForwardNotifications to have notifications forwarded on to the parent of the tab owner. Or instead, you could make your own CTabbedFrameImpl derived class that did whatever special processing you needed.
I would suggest customizing your own tab owner class to do what you want. If you need some external information, you could always add different member variables and accessor functions, or even come up with your own notifications or registered messages to communicate with the window's parent.
HTH,
-Daniel
|
|
|
|
|
Thanks Daniel,
I realized that the actual parent of the tab control was really not the actual Main Frame window.
I should probably derive my own CMDITabOwnerImpl and reflect the notification back to the parent (which will be in my case the CMainFrame class).
Thanks again for keeping up with me as I am trying to grasp it all
Erez
|
|
|
|
|
i meet the same question with you. i add the below codes into "TabbedMDI.h":
LRESULT OnSelChanging(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
ATLASSERT(idCtrl==pnmh->idFrom);
// Be sure the notification is from the tab control
// (and not from a sibling like a list view control)
if(pnmh && (m_TabCtrl == pnmh->hwndFrom))
{
ATLTRACE("***CMDITabOwner::OnSelChanging:%d\n", m_TabCtrl.GetCurSel());
// Send notification to MainFrm Window (=::GetParent(m_hWndMDIClient))
::SendMessage(::GetParent(m_hWndMDIClient), WM_NOTIFY, idCtrl, (LPARAM)pnmh );
}
bHandled = FALSE;
return 0;
}
and:
LRESULT OnSelChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
// Be sure the notification is from the tab control
// (and not from a sibling like a list view control)
if(pnmh && (m_TabCtrl == pnmh->hwndFrom))
{
int nNewTab = m_TabCtrl.GetCurSel();
// i added:
ATLTRACE("***CMDITabOwner::OnSelChange:%d\n", nNewTab);
// Send notification to MainFrm Window (=::GetParent(m_hWndMDIClient))
::SendMessage(::GetParent(m_hWndMDIClient), WM_NOTIFY, idCtrl, (LPARAM)pnmh );
......
}
others just as yours. so you can recieve CTCN_SELCHANGING or CTCN_SELCHANGE in MainFrm.
the core is the HWND i got using ::GetParent(m_hWndMDIClient) is MainFrm's window handle.
|
|
|
|
|
Almost three years after the first post, thanks for keeping your article (and source codes) updated.
Pascal Binggeli
|
|
|
|
|
My compiler can't find the atlapp.h. Is this a standard MSVC .NET file?
|
|
|
|
|
|
Hi Daniel, I'm trying to integrate your tab solution into a custom control and I'm getting compile warnings. It compiles, but the tabs don't show up. I'm using VC7 with WTL 7.1. Any thoughts would be appreciated!
Thanks,
Dave
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(1845) : warning C4244: 'initializing' : conversion from 'UINT_PTR' to 'UINT', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(1835) : while compiling class-template member function 'LRESULT CCustomTabCtrl<T,TItem,TBase,TWinTraits>::OnGetToolTipInfo(int,LPNMHDR,BOOL &)'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem,
TBase=ATL::CWindow,
TWinTraits=CCustomTabCtrlWinTraits
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\DOTNETTABCTRL.H(18) : see reference to class template instantiation 'CCustomTabCtrl<T,TItem,TBase,TWinTraits>' being compiled
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem,
TBase=ATL::CWindow,
TWinTraits=CCustomTabCtrlWinTraits
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\DOTNETTABCTRL.H(1121) : see reference to class template instantiation 'CDotNetTabCtrlImpl<T,TItem>' being compiled
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\TABBEDFRAME.H(188) : see reference to class template instantiation 'CDotNetTabCtrl<TItem>' being compiled
with
[
TItem=CTabViewTabItem
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\TABBEDMDI.H(657) : see reference to class template instantiation 'CCustomTabOwnerImpl<T,TTabCtrl>' being compiled
with
[
T=CMDITabOwner<CDotNetTabCtrl<CTabViewTabItem>>,
TTabCtrl=CDotNetTabCtrl<CTabViewTabItem>
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\TABBEDMDI.H(1104) : see reference to class template instantiation 'CMDITabOwnerImpl<T,TTabCtrl>' being compiled
with
[
T=CMDITabOwner<CDotNetTabCtrl<CTabViewTabItem>>,
TTabCtrl=CDotNetTabCtrl<CTabViewTabItem>
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\TABBEDMDI.H(1128) : see reference to class template instantiation 'CMDITabOwner<TTabCtrl>' being compiled
with
[
TTabCtrl=CDotNetTabCtrl<CTabViewTabItem>
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\TABBEDMDI.H(372) : see reference to class template instantiation 'CTabbedMDIClient<TTabCtrl>' being compiled
with
[
TTabCtrl=CDotNetTabCtrl<CTabViewTabItem>
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\MainFrm.h(7) : see reference to class template instantiation 'CTabbedMDIFrameWindowImpl<T>' being compiled
with
[
T=CMainFrame
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\TABBEDFRAME.H(468) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\TABBEDFRAME.H(447) : while compiling class-template member function 'int CCustomTabOwnerImpl<T,TTabCtrl>::DisplayTab(HWND,BOOL,BOOL)'
with
[
T=CMDITabOwner<CDotNetTabCtrl<CTabViewTabItem>>,
TTabCtrl=CDotNetTabCtrl<CTabViewTabItem>
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\TABBEDFRAME.H(583) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\TABBEDFRAME.H(553) : while compiling class-template member function 'BOOL CCustomTabOwnerImpl<T,TTabCtrl>::UpdateTabText(HWND,LPCTSTR)'
with
[
T=CMDITabOwner<CDotNetTabCtrl<CTabViewTabItem>>,
TTabCtrl=CDotNetTabCtrl<CTabViewTabItem>
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2863) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2843) : while compiling class-template member function 'int CCustomTabCtrl<T,TItem,TBase,TWinTraits>::HitTest(LPCTCHITTESTINFO) const'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem,
TBase=ATL::CWindow,
TWinTraits=CCustomTabCtrlWinTraits
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(912) : warning C4312: 'type cast' : conversion from 'DWORD' to 'HCURSOR' of greater size
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(906) : while compiling class-template member function 'void CCustomTabCtrl<T,TItem,TBase,TWinTraits>::StopItemDrag(bool)'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem,
TBase=ATL::CWindow,
TWinTraits=CCustomTabCtrlWinTraits
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2067) : warning C4267: 'argument' : conversion from 'size_t' to 'UINT', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2045) : while compiling class-template member function 'void CCustomTabCtrl<T,TItem,TBase,TWinTraits>::UpdateTabItemTooltipRects(void)'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem,
TBase=ATL::CWindow,
TWinTraits=CCustomTabCtrlWinTraits
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2512) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2490) : while compiling class-template member function 'BOOL CCustomTabCtrl<T,TItem,TBase,TWinTraits>::MoveItem(size_t,size_t,bool,bool)'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem,
TBase=ATL::CWindow,
TWinTraits=CCustomTabCtrlWinTraits
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2518) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2518) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2580) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2567) : while compiling class-template member function 'BOOL CCustomTabCtrl<T,TItem,TBase,TWinTraits>::DeleteItem(size_t,bool,bool)'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem,
TBase=ATL::CWindow,
TWinTraits=CCustomTabCtrlWinTraits
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2683) : warning C4267: 'argument' : conversion from 'size_t' to 'UINT', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(3025) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(3013) : while compiling class-template member function 'int CCustomTabCtrl<T,TItem,TBase,TWinTraits>::FindItem(CCustomTabCtrl<T,TItem,TBase,TWinTraits>::TItem *,CTabViewTabItem::FieldFlags,int) const'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem,
TBase=ATL::CWindow,
TWinTraits=CCustomTabCtrlWinTraits
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2453) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2438) : while compiling class-template member function 'int CCustomTabCtrl<T,TItem,TBase,TWinTraits>::InsertItem(int,CCustomTabCtrl<T,TItem,TBase,TWinTraits>::TItem *,bool)'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem,
TBase=ATL::CWindow,
TWinTraits=CCustomTabCtrlWinTraits
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\CUSTOMTABCTRL.H(2481) : warning C4267: 'argument' : conversion from 'size_t' to 'UINT', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\DOTNETTABCTRL.H(385) : warning C4244: 'initializing' : conversion from 'DWORD_PTR' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\DOTNETTABCTRL.H(380) : while compiling class-template member function 'void CDotNetTabCtrlImpl<T,TItem>::DrawItem_TabInactive(DWORD,LPNMCTCCUSTOMDRAW,RECT &)'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem
]
c:\MDI_AX_BASE\MdiControl_src\MdiControl\DOTNETTABCTRL.H(437) : warning C4244: 'initializing' : conversion from 'DWORD_PTR' to 'int', possible loss of data
c:\MDI_AX_BASE\MdiControl_src\MdiControl\DOTNETTABCTRL.H(432) : while compiling class-template member function 'void CDotNetTabCtrlImpl<T,TItem>::DrawItem_ImageAndText(DWORD,LPNMCTCCUSTOMDRAW,int,RECT &,RECT &)'
with
[
T=CDotNetTabCtrl<CTabViewTabItem>,
TItem=CTabViewTabItem
]
|
|
|
|
|
The line numbers indicated don't match the code it refers to - have you customized these files at all? Also, are you sure you're using VC 7.0 and not 7.1?
However, I do know that there are some updates that need to be made so that it compiles 64-bit clean. These warnings suggest you are either compiling for 64-bit, or you have /Wp64 (detect 64-bit portability issues) set.
I'll be updating the article with new code that compiles 64-bit clean. There are also a couple minor updates to accomodate WTL 7.5 I'll make at the same time. I was planning on uploading these updates closer to the WTL 7.5 release, but I may do them sooner than that.
As far as why the tabs aren't showing up, it's likely that's a different problem. Have you tried doing complete rebuilds of the samples to see if they work? If you're integrating it into your own thing, pay particular attention to how you have the tab owner working (and sizing). Does the tab control show up in Spy++ as a window, but it's just set to 0 width and height?
-Daniel
|
|
|
|
|
Greetings: First of all, excellent work and better yet, excellent responses to all those with questions!
There was a recent post about this, however, I didn't see any confirmation that a working solution was arrived at. I'd like to be able to select the active tab and contents under certain criteria. I'm able to enumerate all the child windows to get the HWND of the view frame window that I want to bring to the foreground, but I have not been able to get this to work.
If you could post the code needed to do this (I'm using the dotnet tab with MDI) based on the frame HWND of the desired view, I'd be very appreciative! Everything else is working great!
Fabulous effort! Thanks Daniel!
|
|
|
|
|
Davem1 wrote:
Greetings: First of all, excellent work and better yet, excellent responses to all those with questions!
Thanks
Davem1 wrote:
I'd like to be able to select the active tab and contents under certain criteria. I'm able to enumerate all the child windows to get the HWND of the view frame window that I want to bring to the foreground, but I have not been able to get this to work.
Is this an MDI? If so, all you have to do is call MDIActivate(hWndViewFrame) on the main frame or the MDIClient window, or this->MDIActivate(m_hWnd) from within the MDI child frame (the class deriving from CTabbedMDIChildWindowImpl). If you do, the corresponding tab for the window will automatically be selected.
If you want to go from the tab side of things and have C++ knowledge of the tab owner class, call DisplayTab(hWndViewFrame).
Let me know if these ways don't work for you - there's some other ways to do this as well. Also, let me know if you need this for MDI tabs, or other tabs.
HTH,
-Daniel
|
|
|
|
|
Hi Daniel, Wow! Thanks for the quick response. This is for an out of the box WTL MDI application. In trying to use your solution (above) from a CMainFrame callback function that I use to enumerate all the child windows and MDIActive() is reported as "identifier not found".
I'm pretty new to WTL, what is the dependency that I'm missing? I get the same response ("identifier not found") trying to use DisplayTab() as well. It seems that I have some dependency issue that I haven't identified.
And yes, this is for MDI tabs. This is probably something easy in terms of dependencies and any feedback from you would be greatly appreciated!
Thanks again Daniel!
|
|
|
|
|