Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing CeGetFileNotificationInfo
    text
    copied!<p>I have a Windows Mobile 6.5 application where I'm trying to monitor a file for changes. If I run the code below, then open WordPad and edit and save "\MyDir\Foo.txt", I only get notifications about temporary files being changed. </p> <p>For reference, I'm using Windows Mobile 6.5 Professional CE OS 5.2.23090.5.3.0. And, I have the same issue with Windows Mobile 6.1 Professional CE OS 5.2.21051.1.6.4.</p> <pre><code>#include &lt;vector&gt; int _tmain( int argc, _TCHAR* argv[] ) { HANDLE change = ::FindFirstChangeNotification( argv[ 1 ], FALSE, FILE_NOTIFY_CHANGE_CEGETINFO | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_LAST_ACCESS | FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE ); if( INVALID_HANDLE_VALUE != change ) { while( WAIT_OBJECT_0 == ::WaitForSingleObject( change, INFINITE ) ) { NKDbgPrintfW( L"Change detected\n" ); DWORD returned = 0; DWORD available = 0; if( ::CeGetFileNotificationInfo( change, 0, NULL, 0, &amp;returned, &amp;available ) ) { std::vector&lt; BYTE &gt; buffer( available ); if( ::CeGetFileNotificationInfo( change, 0, &amp;buffer.front(), buffer.size(), &amp;returned, &amp;available ) ) { BYTE* current = &amp;buffer.front(); const FILE_NOTIFY_INFORMATION* info = reinterpret_cast&lt; const FILE_NOTIFY_INFORMATION* &gt;( current ); for( current; NULL != current &amp;&amp; info-&gt;NextEntryOffset &gt; 0; current += info-&gt;NextEntryOffset ) { info = reinterpret_cast&lt; const FILE_NOTIFY_INFORMATION* &gt;( current ); NKDbgPrintfW( L"\t%s: %#08x\n", info-&gt;FileName, info-&gt;Action ); } } } ::FindNextChangeNotification( change ); } ::FindCloseChangeNotification( change ); } return 0; } </code></pre> <p>The output in the example I give above is:</p> <pre><code>Change detected 667F.tmp: 0x00000003 667F.tmp: 0x00000003 667F.tmp: 0x00000003 667F.tmp: 0x00010000 </code></pre> <p>Where I would expect it to be:</p> <pre><code>Change detected Foo.txt: 0x00000003 Foo.txt: 0x00000003 Foo.txt: 0x00000003 Foo.txt: 0x00010000 </code></pre> <p>What do I need to change to get the functionality I'm looking for?</p> <p>Thanks, PaulH</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload