Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. File Create/Update Notification

File Create/Update Notification

Scheduled Pinned Locked Moved C / C++ / MFC
csharpdatabasevisual-studioquestionannouncement
5 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cheesepirate
    wrote on last edited by
    #1

    Hi I'm working on a fairly large file indexing system, and I'm trying to find the best and fastest way of finding out if a file needs reindexing. Currently the best we've got is keeping a DB of the last time a file was indexed and periodically rescanning a checking the last modifed date against that. Is there a way of being told if a file has been created or modified, in a similar sort of way to Visual Studio bringing up the "This file has been modified outside of Visual Studio..." dialog? (One which doesn't require a lot of resources as well - this is intended to run in the background) Cheers Dave

    P 1 Reply Last reply
    0
    • C cheesepirate

      Hi I'm working on a fairly large file indexing system, and I'm trying to find the best and fastest way of finding out if a file needs reindexing. Currently the best we've got is keeping a DB of the last time a file was indexed and periodically rescanning a checking the last modifed date against that. Is there a way of being told if a file has been created or modified, in a similar sort of way to Visual Studio bringing up the "This file has been modified outside of Visual Studio..." dialog? (One which doesn't require a lot of resources as well - this is intended to run in the background) Cheers Dave

      P Offline
      P Offline
      Paul Ranson
      wrote on last edited by
      #2

      Check out 'FindFirstChangeNotification' in the Win32 documentation. Paul

      C 1 Reply Last reply
      0
      • P Paul Ranson

        Check out 'FindFirstChangeNotification' in the Win32 documentation. Paul

        C Offline
        C Offline
        cheesepirate
        wrote on last edited by
        #3

        Cheers Paul It's always the problem with trying to find where to start looking! :) Dave

        2 D 2 Replies Last reply
        0
        • C cheesepirate

          Cheers Paul It's always the problem with trying to find where to start looking! :) Dave

          2 Offline
          2 Offline
          224917
          wrote on last edited by
          #4

          you can look here also: UINT ThreadNotifyFunc (LPVOID pParam) { HWND hwnd = (HWND) pParam; // Window to notify HANDLE hChange = ::FindFirstChangeNotification (_T ("C:\\"), TRUE, FILE_NOTIFY_CHANGE_FILE_NAME ¦ FILE_NOTIFY_CHANGE_DIR_NAME); if (hChange == INVALID_HANDLE_VALUE) { TRACE (_T ("Error: FindFirstChangeNotification failed\n")); return (UINT) -1; } while (...) { ::WaitForSingleObject (hChange, INFINITE); ::PostMessage (hwnd, WM_USER_CHANGE_NOTIFY, 0, 2); ::FindNextChangeNotification (hChange); // Reset } ::FindCloseChangeNotification (hChange); return 0; }


          It's not a bug, it's an undocumented feature.
          suhredayan@omniquad.com

          messenger :suhredayan@hotmail.com

          1 Reply Last reply
          0
          • C cheesepirate

            Cheers Paul It's always the problem with trying to find where to start looking! :) Dave

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Also look for ReadDirectoryChangesW().


            "The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups