Want to read from an already opened Notepad file
-
How do i read from an already opened text file using vb6.0.. I tried to write code which is here...
Private Sub Form_Load() Dim TxtSheet As Object Set TxtSheet = GetObject("d:\amit\1.txt") ' This is a NOTEPAD APPLICATION AND IS ALREADY OPENED by some other application in write|append mode Dim buffer As String buffer = TxtSheet.Application.Value Text1.Text = buffer Unload Me End Sub
amit mishra -
How do i read from an already opened text file using vb6.0.. I tried to write code which is here...
Private Sub Form_Load() Dim TxtSheet As Object Set TxtSheet = GetObject("d:\amit\1.txt") ' This is a NOTEPAD APPLICATION AND IS ALREADY OPENED by some other application in write|append mode Dim buffer As String buffer = TxtSheet.Application.Value Text1.Text = buffer Unload Me End Sub
amit mishraNotepad just edits text files. Are you talking about opening and reading the file, or are you trying to the the contents of the Notepad window? Notepad doesn't put any locks on the files it opens, so use standard file methods to open and read it. Reading the Notepad window will be much more difficult to do in VB because now your trying to read the memory of another process, something that is "mostly" forbidden in Windows. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome