XPost: microsoft.public.vb.general.discussion, microsoft.public.vb   
   From: dsarvas@yahoo.com   
      
   On Sat, 13 Sep 2008 17:53:38 -0400, PeterD wrote:   
      
   >On Sat, 13 Sep 2008 20:23:38 GMT, dsarvas@yahoo.com (Don) wrote:   
   >   
   >>Thanks for the response, but I need something that detects that the   
   >>file is currently open. Since the file is immediately closed after   
   >>reading the contents as you described, it sounds like what I'm asking   
   >>isn't possible.   
   >   
   >Yep, not possible.   
   >   
   >> I'm trying to prevent users from having the file open   
   >>at the same time and making changes not aware that two or more people   
   >>are making changes that might conflict. Every method I can think of   
   >>either won't detect the file is open preventing the problem or detects   
   >>that a change was made after it was too late to prevent it.   
   >   
   >That old 'between a rock and a hard place' comes to mind. Consider   
   >this, can you perhaps run through the windows of open applications   
   >looking for Notepad, and seeing what file that window has open? That   
   >*might* work, but would be Notepad specific. I'm sure there are other   
   >programs that may present the same problems, too, however.   
      
   That actually has possibilties. I do know how to enumerate through   
   all open windows and even target a Notepad window and it's caption,   
   but I would have to do so by accessing all workstations on the network   
   until I find one that is running that file via Notepad. Seems like   
   that would be the challenge of my lifetime but I might just try   
   researching that one.   
   Don   
   >   
   >>   
   >>Don   
   >>   
   >>On Sat, 13 Sep 2008 14:10:09 -0400, "expvb" wrote:   
   >>   
   >>>Notepad opens the file, load it in memory, then close it immediately. You   
   >>>can open the file exclusively, or use FindFirstChangeNotification() to see   
   >>>if the user edited and saved the file outside your process, then prompt the   
   >>>user if he wants to reload the file. See this VB6 sample:   
   >>>   
   >>>http://vbnet.mvps.org/code/fileapi/watchedfolder.htm   
   >>>   
   >>>   
   >>>   
   >>>   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|