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,664 of 10,840   
   Don to All   
   Re: Detect file opened by Notepad   
   14 Sep 08 17:44:59   
   
   XPost: microsoft.public.vb.general.discussion, microsoft.public.vb   
   From: dsarvas@yahoo.com   
      
   On Sun, 14 Sep 2008 12:24:27 -0400, "Jim Mack"    
   wrote:   
      
   >Don wrote:   
   >> "Ralph" wrote:   
   >>>   
   >>> Maybe you need to provide your own 'editor' and otherwise protect   
   >>> the data?   
   >>   
   >> And that's EXACTLY what I believe to be the answer.  I think that's   
   >> where I stand and either place a Rich Text box in my app for that   
   >> purpose or create a detour so that if Notepad is detected as the   
   >> default app about to lanuch the file, I can instead launch an app I   
   >> know would work.   
   >> Don   
   >   
   >I haven't read this whole thread, but in your shoes I would tug at   
   >this from the other end. Open the file yourself with exclusive access:   
   >lock out all writes except your own.   
      
   This was my original plan.  I just wanted to avoid that and find a way   
   to detect that Notepad had the file open which I now know can't be   
   done.  But . . . (seem my comment following your last comment)   
   >   
   >If someone has the file already open, your open will fail and you can   
   >deal with it as you like.   
   >   
   >In the case of Notepad having the file open, since the file isn't   
   >"really" open, you'll still be able to gain exclusive access. But if   
   >the Notepad user tries to save her copy, she won't be able to. She'll   
   >have to save under a different name or folder. So you're covered   
   >either way.   
   This is exactly the problem we're having and why I needed to find a   
   way to solve the problem.  Users are opening files, making changes,   
   then they can't save them because someone else has the file open.  But   
   I found a solution to that as long as it isn't Notepad that has the   
   file open (or previously open) for reasons already discussed.  I like   
   the idea of exclusive access, but my fear is what might happen if my   
   app is unexpectedly closed leaving a file open.  I'm not familiar with   
   exclusive access so I'll look into it.  If that exclusiveness is   
   released in such a case, then that can be a solution to my problem.   
   I'm assuming you mean that Notepad can be used to open a file with   
   exclusive access.  If so, I didn't know that and I'll research that.   
   Others in this thread have mentioned that and I just sort of tossed   
   the idea aside because of my concerns of the file not reverting back   
   after a user is finished with it or if the program terminates   
   unexpectedly.  I'll check this out.   
   Don   
   >   
   >--   
   >    Jim Mack   
   >    MicroDexterity Inc   
   >    www.microdexterity.com   
   >   
      
   --- 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