Example #1
0
        /*
         *      [DllImport("shell32.dll")]
         *      public static extern int SHGetIDListFromObject([MarshalAs(UnmanagedType.IUnknown)] object punk, out IntPtr ppidl);
         */

        #region Register Functions


        /// <summary>
        /// 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);
        /// }
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="item">ID of the special folder</param>
        /// <param name="Recursively">Look recursively at modifications</param>
        /// <returns></returns>
        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);
        }
Example #2
0
        /// <summary>
        /// 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);
        /// }
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="item">ID of the special folder</param>
        /// <param name="recursively">Look recursively at modifications</param>
        /// <returns></returns>
        public ulong RegisterChangeNotify(IntPtr hWnd, CSIDL item, bool recursively)
        {
            if (this.notifyid != 0)
            {
                return(0);
            }

            SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry()
            {
                pIdl = GetPidlFromFolderID(hWnd, item), Recursively = recursively
            };

            SHChangeNotifyEntry[] changenetrys = new SHChangeNotifyEntry[1] {
                changeentry
            };
            this.notifyid = SHChangeNotifyRegister(
                hWnd,
                SHCNRF.ShellLevel | SHCNRF.InterruptLevel | SHCNRF.NewDelivery,
                SHCNE.SHCNE_ALLEVENTS | SHCNE.SHCNE_INTERRUPT,
                WM_SHNOTIFY,
                1,
                changenetrys);
            return(this.notifyid);
        }
        /*
		[DllImport("shell32.dll")]
		public static extern int SHGetIDListFromObject([MarshalAs(UnmanagedType.IUnknown)] object punk, out IntPtr ppidl);
		*/

        #region Register Functions


        /// <summary>
        /// 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);
        /// }
        /// </summary>
        /// <param name="hWnd"></param>
        /// <param name="item">ID of the special folder</param>
        /// <param name="Recursively">Look recursively at modifications</param>
        /// <returns></returns>
        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);
        }
			public NotificationWindow(ShellNotificationListener parent) {
				SHChangeNotifyEntry notify = new SHChangeNotifyEntry();
				notify.pidl = ShellItem.Desktop.Pidl;
				notify.fRecursive = true;
				m_NotifyId = Shell32.SHChangeNotifyRegister(this.Handle,
					SHCNRF.InterruptLevel | SHCNRF.ShellLevel,
					SHCNE.ALLEVENTS, WM_SHNOTIFY, 1, ref notify);
				m_Parent = parent;
			}
Example #5
0
		public static extern uint SHChangeNotifyRegister(IntPtr hWnd, SHCNRF fSources, SHCNE fEvents, uint wMsg, int cEntries, ref SHChangeNotifyEntry pFsne);
Example #6
0
 public static extern uint SHChangeNotifyRegister(IntPtr hWnd,
                                                  SHCNRF fSources, SHCNE fEvents, uint wMsg, int cEntries,
                                                  ref SHChangeNotifyEntry pFsne);