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,679 of 10,840   
   Don to Don   
   Re: Detect file opened by Notepad   
   15 Sep 08 14:19:45   
   
   XPost: microsoft.public.vb.general.discussion, microsoft.public.vb   
   From: dsarvas@yahoo.com   
      
   Although it has absolutely NO relevence to this thread, in researching   
   ways to get around my problem with Notepad I discovered something I   
   didn't know.   
      
   If you type "Bush hid the facts" (no quotes and no period)  in Notepad   
   and save the file, when you open the file you won't see the phrase.  I   
   won't spoil it by giving the explanation here, but you can Google your   
   way to the explanation. Try Googling "Things you can't type in   
   Notepad" and I think you'll find it.   
      
   Don   
      
      
   On Sat, 13 Sep 2008 17:28:13 GMT, dsarvas@yahoo.com (Don) wrote:   
      
   >   
   >I wrote an app that alerts a user who attempts to open a file that the   
   >file is currently in use.  It works fine except when the file is   
   >opened by Notepad.  If a text file is opened, most computers are   
   >configured to use Notepad to open the file by default and if they are   
   >configured to use Notepad by default I want it to remain that way   
   >rather than retrieve the text into my app or force the user to use   
   >another app to read the file.  I'm using the following code I found   
   >online and lErrNum returns a value of zero if Notepad has the file   
   >open but returns 70 when most other files are open using another   
   >application.   
   >   
   >Don   
   >   
   >Open sPathFile For Input Lock Read As #iFileNum   
   >Close iFileNum   
   >lErrNum = Err.Number   
   >On Error GoTo 0   
   >   
   >Select Case lErrNum   
   >    Case 0 'No error occurred.  File is NOT already open by another   
   >user.   
   >        FileIsOpen = False   
   >    Case 70 'Error number for "Permission Denied." File is already   
   >opened by another user.   
   >        FileIsOpen = True   
   >    Case 53 'File not found   
   >        FileIsOpen = False   
   >    Case Else 'Another error occurred.   
   >        FileIsOpen = True   
   >        MsgBox Error(lErrNum)   
   >End Select   
   >   
   >   
      
   --- 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