BExplorer.Shell.Interop.ShellNotifications.NotificationReceipt C# (CSharp) Method

NotificationReceipt() public method

Message received from the WndProc of a registered form
public NotificationReceipt ( IntPtr wParam, IntPtr lParam ) : bool
wParam System.IntPtr
lParam System.IntPtr
return bool
        public bool NotificationReceipt(IntPtr wParam, IntPtr lParam)
        {
            IntPtr ptr;
            uint eventID;
            var lockPtr = Shell32.SHChangeNotification_Lock(wParam, (int)lParam, out ptr, out eventID);
            try
            {

                SHNOTIFYSTRUCT shNotify = (SHNOTIFYSTRUCT)Marshal.PtrToStructure(
                    ptr,
                    typeof(SHNOTIFYSTRUCT));
                NotifyInfos info = new NotifyInfos((SHCNE)(int)eventID);
                //System.Windows.Forms.MessageBox.Show(info.Notification.ToString());

                //Not supported notifications
                //if (info.Notification == SHCNE.SHCNE_FREESPACE ||
                //    info.Notification == SHCNE.SHCNE_UPDATEIMAGE)
                //    return (false);

                info.Item1 = shNotify.dwItem1;
                info.Item2 = shNotify.dwItem2;

                // Was this notification in the received notifications ?
                if (NotificationsReceived.Contains(info)) return (false);
                NotificationsReceived.Add(info);
            }
            finally
            {
                if (lockPtr != IntPtr.Zero)
                    Shell32.SHChangeNotification_Unlock(lockPtr);
            }
            return (true);
            //DisplayName1 = GetDisplayNameFromPidl(shNotify.dwItem1);
            //DisplayName2 = GetDisplayNameFromPidl(shNotify.dwItem2);
        }
        #endregion