Registers a window that receives notifications from the file system or Shell.
Syntax
ULONG SHChangeNotifyRegister( HWND hwnd, int fSources, LONG fEvents, UINT wMsg, int cEntries, const SHChangeNotifyEntry *pshcne );
Parameters
hwnd A handle to the window that receives the change or notification messages.fSources One or more of the following values that indicate the type of events for which to receive notifications. Note These flags are not defined in the header file. Implementers must define them themselves or use their numeric values in their place.SHCNRF_InterruptLevel0x0001. Interrupt level notifications from the file system.SHCNRF_ShellLevel0x0002. Shell-level notifications from the shell. SHCNRF_RecursiveInterrupt0x1000. Interrupt events on the whole subtree. This flag must be combined with the SHCNRF_InterruptLevel flag. When using this flag, notifications must also be made recursive by setting the fRecursive member of the corresponding SHChangeNotifyEntry structure referenced by pshcne to TRUE. Use of SHCNRF_RecursiveInterrupt on a single level viewfor example, a pointer to an item identifier list (PIDL) that is relative and contains only one SHITEMIDwill block event notification at the highest level and thereby prevent a recursive, child update. Thus, an icon dragged into the lowest level of a folder hierarchy may fail to appear in the view as expected.SHCNRF_NewDelivery0x8000. Messages received use shared memory. Call SHChangeNotification_Lock to access the actual data. Call SHChangeNotification_Unlock to release the memory when done.fEvents Change notification events for which to receive notification.wMsg Message to be posted to the window procedure.cEntries Number of entries in the pshcne array.pshcne [in] Array of SHChangeNotifyEntry structures that contain the notifications. This array should always be set to one when calling SHChangeNotifyRegister or SHChangeNotifyDeregister will not work properly.
SHCNRF_InterruptLevel
SHCNRF_ShellLevel
SHCNRF_RecursiveInterrupt
SHCNRF_NewDelivery
Return Value
Returns a positive integer registration ID. Returns zero if out of memory or in response to invalid parameters.
Remarks
Note This function is available through Microsoft Windows XP Service Pack 2 (SP2) and Windows Server 2003. It might be altered or unavailable in subsequent versions of Windows.When a relevant file system event takes place and the hwnd parameter is not NULL, then the message indicated by wMsg is posted to the specified window. Otherwise, if the pshcne parameter is not NULL, then that notification entry is called.For performance reasons, multiple notifications may be combined into a single notification. For example, if a large number of SHCNE_UPDATEITEM notifications are generated for files in the same folder, they can be joined into a single SHCNE_UPDATEDIR notification.
When a relevant file system event takes place and the hwnd parameter is not NULL, then the message indicated by wMsg is posted to the specified window. Otherwise, if the pshcne parameter is not NULL, then that notification entry is called.
For performance reasons, multiple notifications may be combined into a single notification. For example, if a large number of SHCNE_UPDATEITEM notifications are generated for files in the same folder, they can be joined into a single SHCNE_UPDATEDIR notification.
Function Information
Minimum DLL Versionshell32.dll version 5.0 or laterCustom ImplementationNoHeadershlobj.hImport libraryshell32.libMinimum operating systems Windows 2000
when SHCNRF_NewDelivery (recomend flag) is specified then the wParam/lParam value of the message delviered to the hwnd specified in this API should be passed as the first 2 params to SHChangeNotification_Lock()