Utilising the ShellExecute command to Open files
Posted on 2004-04-17
I have a Visual Basic program that displays the contents of a folder. The folder can have both subfolders and files within it. When the user double clicks on the file - I want my program to open the file in its associated program. I have searched around and have come up with this ...
Declare Function ShellExecuteA Lib "shell32.dll" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long )
Now that is all well and good. And it does work. But I need to know what each of the variables mean and how I can get the best out of them - i.e add in further clauses to the opening of the file.
What I really want to do is lock the file for reading and writing when it opens. But dont know how!
I tried adding in :
"Lock Read Write" for the value of 'ByVal lpParameters As String'
But this doesnt appear to work. Maybe im doing it wrong.
Can you help?
Also - I need to know when the file is closed again i.e when the user has carried out his/her updates and has closed the file. Is that possible?
Thanks in advance,