|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Carsten Pedersen
|
Jun 13, 2008 - 2:38 AM
|
Hi, When I built my dialog app using the Wizard the first build generated the following warnings: c:\Program Files\Prof-UIS\Include\ExtTabWnd.h(1860) : warning C4312: ’type cast’ : conversion from ’DWORD’ to ’HICON’ of greater size
c:\Program Files\Prof-UIS\Include\ExtTabWnd.h(1831) : while compiling class-template member function ’CExtCmdIcon *CExtTMWI<_BT>::OnTabWndQueryItemIcon(const CExtTabWnd::TAB_ITEM_INFO *) const’
with
[
_BT=CExtTabWnd
]
c:\Program Files\Prof-UIS\Include\ExtTabWnd.h(2242) : see reference to class template instantiation ’CExtTMWI<_BT>’ being compiled
with
[
_BT=CExtTabWnd
] This warning exist on lines 1860 and 1867.
Is there a way to rewrite the code so that I can avoid this annoying warning? Carsten Panch
|
|
Technical Support
|
Jun 14, 2008 - 3:05 AM
|
Here is the updated source code for the OnTabWndQueryItemIcon() virtual method of the CExtTMWI template class: virtual CExtCmdIcon * OnTabWndQueryItemIcon(
const CExtTabWnd::TAB_ITEM_INFO * pTii
) const
{
ASSERT_VALID( pTii );
HWND hWndMdiChild = (HWND)pTii->LParamGet();
if( hWndMdiChild == NULL
|| (! ::IsWindow( hWndMdiChild ) )
)
return NULL;
HICON hIcon = (HICON)
::SendMessage(
hWndMdiChild,
WM_GETICON,
WPARAM(ICON_SMALL),
0
);
if( hIcon == NULL )
{
hIcon = (HICON)
::SendMessage(
hWndMdiChild,
WM_GETICON,
WPARAM(ICON_BIG),
0
);
if( hIcon == NULL )
{
#if _MFC_VER >= 0x700
// disable warning C4312: type cast’ : conversion from ’DWORD’ to ’HICON’ of greater size
#pragma warning( push )
#pragma warning( disable : 4312 )
#endif // _MFC_VER >= 0x700
hIcon = (HICON)
::__EXT_MFC_GetClassLong(
hWndMdiChild,
__EXT_MFC_GCL_HICONSM
);
if( hIcon == NULL )
{
hIcon = (HICON)
::__EXT_MFC_GetClassLong(
hWndMdiChild,
__EXT_MFC_GCL_HICON
);
if( hIcon == NULL )
return NULL;
} // if( hIcon == NULL )
#if _MFC_VER >= 0x700
// rollback warning C4312: type cast’ : conversion from ’DWORD’ to ’HICON’ of greater size
#pragma warning( pop )
#endif // _MFC_VER >= 0x700
} // if( hIcon == NULL )
} // if( hIcon == NULL )
ASSERT( hIcon != NULL );
m_iconMdiChildCache.Empty();
CExtCmdIcon _iconBig;
_iconBig.AssignFromHICON( hIcon, true );
VERIFY(
m_iconMdiChildCache.
CreateScaledCopy(
_iconBig,
CSize( 16, 16 )
)
);
if( ! m_iconMdiChildCache.IsEmpty() )
return (&m_iconMdiChildCache);
return NULL;
}
|
|