Click here to Skip to main content
13,594,789 members
Rate this:
Please Sign up or sign in to vote.
See more:
Dear bros,
I am converting a vc6 project to vc8 that is visual studio 2005 and I am getting this error. Please suggest a solution to get rid of this.

There is a funtion as following
BOOL CExListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
        HD_NOTIFY   *pHDN = (HD_NOTIFY*)lParam;

        if((pHDN->hdr.code == HDN_BEGINTRACKW || pHDN->hdr.code == HDN_BEGINTRACKA || pHDN->hdr.code == HDN_DIVIDERDBLCLICKA || pHDN->hdr.code == HDN_DIVIDERDBLCLICKW )
                && pHDN->iItem == 5)            // Prevent only first (col# 0) from resizing
                *pResult = TRUE;                // disable tracking
                return TRUE;                    // Processed message
        return CListCtrl::OnNotify(wParam, lParam, pResult);

this is caught by compiler when is passed through
ON_NOTIFY_REFLECT(WM_NOTIFY, OnNotify )macro funtion. 

So please suggest me how to get it done.

Thanking You
Posted 31-Oct-12 2:18am
Updated 31-Oct-12 2:31am
nv3 31-Oct-12 9:44am
You are trying to hook a handler for ON_NOTIFY to an ON_NOTIFY_REFLECT event. The compiler is complaining because your handler function should have the signature:

void FuncName (NMHDR* pHdr, LRESULT* pRes);

To fix the function signature would be easy, but I guess the command routing needs some fixing also. Read the MSDN technical note on Message Reflection to understand the background. Then the fix will probably be a breeze.
Jochen Arndt 31-Oct-12 10:07am
With VS 2005 use the ON_NOTIFY_REFLECT_EX macro for handlers returning a BOOL. This should do the job for specific messages (like the HDN_xxx messages from your handler) but I'm not sure if this can be also used with the WM_NOTIFY message.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It looks like the macro ON_NOTIFY_REFLECT in VC6 is different from the one in VC2005. This may be the result of one environment using the ATL version, and the other the MFC version.
Use the button F12 (with the text cursor blinking in the word ON_NOTIFY_REFLECT) on both environments, it will bring you to the macro definition.

Hope this helps,
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Make sure that return type for 'OnNotify'is always LRESULT entire your solution.
Richard MacCutchan 9-Apr-15 9:29am
This question is more than 2 years old; you are far too late to post this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.180621.3 | Last Updated 9 Apr 2015
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100