>>>I have never had it happened to me but I was wondering of what are the case(s) when DECLARE ShellExecture would fail? That is, I am thinking if I should put this DECLARE call in TRY/CATCH?
>>>
>>>Thank you in advance for any suggestions
>>
>>Dmitry,
>>
>>Check this out:
>>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp>
>Dawa,
>
>Thank you for the document. It is very informative. However, I am looking for more of practical cases that would cause the DECLARE fail. I guess one thing is if someone erases the .dll file from the drive. And I guess it would not hurt to place TRY/CATCH around it since the DLL is only loaded once.
Well, shell32.dll is an essential file of the OS. It is used by Explorer which is Windows' main user interface. The OS wouldn't allow to delete the file.
Yes, you're right. It might fail for other reasons and it doesn't hurt to catch the exception. You might want to add code in Error event or On Error too, wherever is appropriate. My philosophy is to trap every single error if possible and handle them appropriately.
I use ShellExecute in my app too, so far I havn't had any problem or errors reported from that ( I log run time errors in a dbf).
HTH
Dawa Tsering
"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."
- Ephesians 4:29-30 NIV
Dare to Question -- Care to Answer
Time is like water in a sponge, as long as you are willing you can always squeeze some.
--Lu Xun, Father of Modern Chinese Literature