Quantcast
Viewing all articles
Browse latest Browse all 12583

Why is NMHDR.code always 0 for Virtual ListView messages on Win7 x64

I have the following C# code on Win7 64bit, Visual Studio 2008.

The class is to implement a virtual ListView.

        protectedoverridevoid WndProc(ref Message m)
        {
              bool bHandled =false;

             switch (m.Msg)
            {
                 case MessageId.OCM_NOTIFY: // Reflected messages
                    NMHDR nm = (NMHDR) m.GetLParam(typeof(NMHDR));

                    switch (nm.code)
                    {
                        case CommCtrl.LVN_GETDISPINFO:
                           //do something
                           break;
                        case CommCtrl.LVN_ODCACHEHINT:
                           //do something
                           break;
                        case CommCtrl.LVN_ODFINDITEM:
                           //do something
                           break;

                          // ....


    publicstruct NMHDR
    {
            ///<summary>hwndFrom</summary>
            publicIntPtr hwndFrom;
            ///<summary>idFrom</summary>
            publicint idFrom;
            ///<summary>code</summary>
            publicint code;
    }

//<summary>EXTERNALSYM LVN_FIRST</summary>
publicconstint LVN_FIRST                = (0-100);   //listview

///<summary>EXTERNALSYM LVN_ODCACHEHINT</summary>
publicconstint LVN_ODCACHEHINT            = (LVN_FIRST -13);
///<summary>EXTERNALSYM LVN_GETDISPINFO</summary>
publicconstint LVN_GETDISPINFO            = (LVN_FIRST -77);
///<summary>EXTERNALSYM LVN_ODFINDITEM</summary>
publicconstint LVN_ODFINDITEM             = (LVN_FIRST -79);                                               

                                                                                                                                                                                                               It works well when I compile it as x86 platform. The nm.code is sometimes -13, or -77 or -79. But it always 0 when I compile as x64. In this way, the following switch code will never be executed any more. Does anyone know why this happens?                                                                                                           

                                               

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>