Open
Description
There is a missing SHCNRF_ShellLevel
flag here - in the type of events for which to receive notifications:
RenderPipelineShaders/tools/rpsl_explorer/src/file_monitor.hpp
Lines 36 to 41 in 3118340
It is necessary to include it to capture changes made, e.g. from text-editors (considered as a
ShellLevel
source).
Other, minor things:
UM_FILE_CHANGED
should be type ofUINT
;- result of
ILCreateFromPathA
is not checked (in case of0
); - registered-to-notify file is not placed into
m_registerIDs
- so it would be wrongly considered again
Please find my snipped with corrected version:
static constexpr UINT UM_FILE_CHANGED = WM_USER + 4097;
bool BeginWatch(HWND hWndListener, const std::string& fileName)
{
auto iter = m_registerIDs.find(fileName);
if (iter != m_registerIDs.end())
{
return false;
}
PCIDLIST_ABSOLUTE pidl = ILCreateFromPathA(fileName.c_str());
if (pidl == 0)
{
return false;
}
SHChangeNotifyEntry notifyEntry = { pidl, FALSE };
ULONG uId = SHChangeNotifyRegister
(
hWndListener,
SHCNRF_InterruptLevel | SHCNRF_ShellLevel | SHCNRF_NewDelivery,
SHCNE_RENAMEITEM | SHCNE_DELETE | SHCNE_UPDATEITEM,
UM_FILE_CHANGED,
1,
¬ifyEntry
);
if (uId != 0)
{
m_registerIDs.emplace(fileName, uId);
}
return (uId != 0);
}
Metadata
Metadata
Assignees
Labels
No labels