I need to be able to view an HTML document in a web browser. I really need something like this...
procedure ViewDocument(BrowserPath, DocumentURL: string; ReuseBrowserWindow: Boolean);
BrowserPath is the full path of any browser (such as IE or Netscape), DocumentURL is the URL of the HTML file to view, this can be either on the web or a local file.
The last parameter is the most important. If ReuseBrowserWindow if False, the document should always open up in a new window. However if it is True, it should reuse a browser window that is already opened and only open a new one if one isn't presently opened.
Is the above possible? If so, would you be able to give me any source code that would do it in Delphi 4?
Also, there is the possibility that the procedure may fail for any reason when being called. In order to make the program robust, what is the best way of dealing with this? Should it be made a function that simply returns True/False for success/failure or should it raise an exception if this happens? I'd be interested to know what is the best programming practice to use and what is most widely used. I often wonder when programming, should I make a function return True/False to indicate success/failure or use exceptions when something goes wrong and expect the caller to handle this case?
Thanks a lot for your help.