Re: Open a file as read only
Where does Office come into this?
If you use System.IO class you can open a file for read/write operations using the ReadOnly file mode.
Re: Open a file as read only
Open it yourself and lock it, then open it in the 3rd party application; or, if the application has a command-line switch to control read-only mode, start the application with that switch and pass the file name as an argument.
Re: Open a file as read only
Cheers.
Is it possible to get a handle on the application closing ?
I don't think this is possible but it would be useful if I my application could be alerted when word,notepad or whatever closed so I could run some clean up code.
Re: Open a file as read only
Yes:
VB.NET Code:
Imports System.Diagnostics
' ...
Dim notepad As Process = Process.Start("notepad")
notepad.EnableRaisingEvents = True
AddHandler notepad.Exited, AddressOf notepad_Exited
' ...
Private Sub notepad_exited(sender As Object, e As EventArgs)
MessageBox.Show("Notepad was closed")
End Sub
Re: Open a file as read only
Thanks penegate.
You are a god among men :)
Re: Open a file as read only
I like to think so, but it's nice to hear it from someone else. :D