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

RegisterChangeNotify() public method

Register a form handle This form will receive a WM_SHNOTIFY when a notification occures !!!!! Add this code to your registered form : !!!!! protected override void WndProc(ref Message m) { switch(m.Msg) { case (int) ShellNotifications.WM_SHNOTIFY: if(Notifications.NotificationReceipt(m.WParam, m.LParam)) NewOperation((NotifyInfos) Notifications.NotificationsReceived[Notifications.NotificationsReceived.Count-1]); break; } base.WndProc(ref m); }
public RegisterChangeNotify ( IntPtr hWnd, CSIDL item, bool Recursively ) : ulong
hWnd System.IntPtr
item CSIDL ID of the special folder
Recursively bool Look recursively at modifications
return ulong
        public ulong RegisterChangeNotify(IntPtr hWnd, CSIDL item, bool Recursively)
        {
            if (notifyid != 0) return (0);
            SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry() { pIdl = GetPidlFromFolderID(hWnd, item), Recursively = Recursively };
            SHChangeNotifyEntry[] changenetrys = new SHChangeNotifyEntry[1] { changeentry };
            //changenetrys[0] = changeentry;
            notifyid = SHChangeNotifyRegister(
                hWnd,
        //SHCNF.SHCNF_TYPE | SHCNF.SHCNF_IDLIST,
        (SHCNRF)0x00FF | (SHCNRF)0x0000 | SHCNRF.NewDelivery,
        SHCNE.SHCNE_ALLEVENTS | SHCNE.SHCNE_INTERRUPT,
                WM_SHNOTIFY,
                1,
                changenetrys);
            return (notifyid);
        }