home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,653 of 10,840   
   PeterD to Don   
   Re: Detect file opened by Notepad   
   13 Sep 08 17:53:38   
   
   XPost: microsoft.public.vb.general.discussion, microsoft.public.vb   
   From: peter2@hipson.net   
      
   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.   
      
   >   
   >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)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca