Professional UI Solutions
Site Map   /  Register


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.

Forums » Prof-UIS General Discussion » Warnings in ExtTabWnd.h, ProfUIS 2.83 Collapse All
Subject Author Date
Carsten Pedersen Jun 12, 2008 - 5:13 AM


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’





c:\Program Files\Prof-UIS\Include\ExtTabWnd.h(2242) : see reference to class template instantiation ’CExtTMWI<_BT>’ being compiled





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

Jeroen Walter Sep 8, 2008 - 1:31 AM


After upgrading to version 2.83, we also get these 64bit warnings. We are using VS 2005 SP1.

You can reproduce them by enabling the project configuration option "Detect 64-bit Portability Issues (/Wp64)".

I would have expected that you, as a developer of a professional suite that also supports 64bit Windows, would already have done so. Apparently not.

As we strive to make our code warning free, these warnings originating from an external product are very frustrating.

I urge you to look into this, as for us, these warnings, though correct code it may be, clutter the output window of visual studio, so any spurious, but more important, warnings of our own code are drowned and go unnoticed.



Technical Support Sep 8, 2008 - 7:05 AM

If you have an active subscription, we can provide you with the latest Prof-UIS version 2.84 where these issues already resoved.

Jeroen Walter Sep 8, 2008 - 2:17 AM

Our focus is on 32-bit, but sometimes we need a 64-bit build of our program, so the 64-bit warning option is always on.


More information about how to reproduce them:

Build the 32-bit target of ProfUIS Lib.

The option "Detect 64-bit Portability Issues" is disabled there.

I’ve further looked into the problem, and I am now not so sure if this is a problem in the profuis code.

The 64bit version of profuis compiles without warnings, so this is good.

It’s just that the "Detect 64-bit Portability Issues" option will trigger a warning in a 32-bit compilation at any conversion of a pointer to a DWORD (or other 32-bit type).

The windows api, as you stated in one of your replies, "conveniently" returns a DWORD for GetClassLong.

The HICON however is defined as a pointer.

So the typeconversion from DWORD to HICON will trigger a warning.

This can be solved in ProfUis by code like this:

replace hIcon = (HICON)



hIcon = (HICON)(DWORD_PTR) ::__EXT_MFC_GetClassLong(...

i.e. add an explicit conversion to a pointer.  You can also change the #define __EXT_MFC_GetClassLong                GetClassLongPtr so it has the extra cast.........

This shouldn’t have an impact on a 64-bit build and it will "fool" the "Detect 64-bit Portability Issues" option.

Adding these conversions to all of your code base would be tedious and it will clutter your own code base with unnecessary stuff.

However, this shouldn’t be necessary, as I find this issue basically a limitation of the MFC and Windows API wrt the "Detect 64-bit Portability Issues" option.







Carsten Pedersen Jun 13, 2008 - 4:46 AM

The problem occurs with MS Visual  Studio 2003. The MFC Dialog application was generated using the Wizard after installing 2.83 version.

No special compiler settings were used.

Technical Support Jun 13, 2008 - 4:07 AM

Both warnings have to do with the __EXT_MFC_GetClassLong preprocessor function. It’s replaced by GetClassLong() API when it is compilied with Visual C++ 6.0 and by GetClassLongPtr() API when compiled with a later Visual C++ version. The GetClassLongPtr() API on x64 and IA64 platforms is:

ULONG_PTR WINAPI GetClassLongPtrA( __in HWND hWnd, __in int nIndex);
WINUSERAPI ULONG_PTR WINAPI GetClassLongPtrW( __in HWND hWnd, __in int nIndex );

The ULONG_PTR size is the same as HICON handle size. The 32-bit platform uses the following APIs based on 32-bit DWORD values which are compatible with 32-bit HICON handle:

WINUSERAPI DWORD WINAPI GetClassLongA( __in HWND hWnd, __in int nIndex );
WINUSERAPI DWORD WINAPI GetClassLongW( __in HWND hWnd, __in int nIndex );

So, we are absolutely sure that there are no problems will appear with the __EXT_MFC_GetClassLong preprocessor function. The only problem is that we cannot reproduce these warnings. Which Prof-UIS configuration, project and/or sample application should we build? Which Visual Studio version should we use? Do we need some special compiler settings?