Howdy,
I am currently using VB.NET and wanting to know how you cycle through and/or attach to already open processes.
For example, I am familiar with open an excel file and manipulating it from within VB. But what if I want to attach to a file the user already has open? How can I do this?
Typically I'd do a
Dim oExcel as Excel.Application
oExcel = CreateObject("Excel.Application") ' Create the Excel Object
and then go about manipulating the object, even going so far as to hide the excel application from the user whilst manipulating it.
But I have been given the challenging of allowing the user to
Dim ps As New ProcessStartInfo
ps.UseShellExecute = True
ps.FileName = MyFile
Process.Start(ps)
To first look at the excel sheet, and then I need to attach to it to read data off of it. I do not want to open the file again as that creates a multitude of problems such as warning me that its already open and read only and all that stuff.
Going further, this knowledge could possibly be useful when attaching to other open applications in the future. I've googled and searched now trying to find some info on how to do this, but nothing has fit the bill. Thank you in advance for any help you can give me with this!
I am currently using VB.NET and wanting to know how you cycle through and/or attach to already open processes.
For example, I am familiar with open an excel file and manipulating it from within VB. But what if I want to attach to a file the user already has open? How can I do this?
Typically I'd do a
Dim oExcel as Excel.Application
oExcel = CreateObject("Excel.Application") ' Create the Excel Object
and then go about manipulating the object, even going so far as to hide the excel application from the user whilst manipulating it.
But I have been given the challenging of allowing the user to
Dim ps As New ProcessStartInfo
ps.UseShellExecute = True
ps.FileName = MyFile
Process.Start(ps)
To first look at the excel sheet, and then I need to attach to it to read data off of it. I do not want to open the file again as that creates a multitude of problems such as warning me that its already open and read only and all that stuff.
Going further, this knowledge could possibly be useful when attaching to other open applications in the future. I've googled and searched now trying to find some info on how to do this, but nothing has fit the bill. Thank you in advance for any help you can give me with this!