External to your program? If so then look up the shell function or either of the API's of ShellExecute or ShellExecuteEx. Inside your program? If so then use the webbrowser control and the navigate method.
Put these two lines in the declaration section of a form or in a module
Const SW_NORMAL = 1
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
____________________________________________________________________________
Put a label on a form and make the caption look like a hyperlink. Something like - "
I am also trying to open up a web browser outside of my application. I already had these few lines that Darmo talkes about, but I am having problems with Windows98 machines. This works great on Windows XP, but on my Windows98 machine, nothing happens. It does not execute the ShellExecute line.
It is not necessary to shell it. You can set a reference to an internet explorer library which holds the IWebBrowser2 interface. You can then execute internet explorer, navigate to the page you want and do whatever you want. It's really very simple, however I forgot the name of the library to reference. I did this just a few days ago, when I get back home I'll post you the code and the reference.
Greetings,
Rick
Well, first of all, since we're targetting windows here, we can safely assume internet explorer at least is on the system. And second; I believe the original question was "I need to open internet explorer with a given url in my application. Any ideas. Thanks"....
And last, but certainly not least; apart from the URL to surf to, ShellExecute doesn't give you much control over the instance being launched, whereas an interface pointer to the instance gives you much control (almost full control I would say)
Greetings,
Rick
Hey, LazyMe, my comment was to the orginal poster, not you. Many people think that IE is the only web browser there is. An end-user will become frustrated if they have to open a web page with something other than their default browser (I know I would if a program continually opened Netscape for me to view a web page). ShellExecute will open the default browser and I believe using the windows API for such a small operation like this is <b>A LOT</b> better than creating new objects. Be an idiot:
I'm a little concerned about your assertion that ShellExecute does not work on some 98 and Win Me machines, and that this is documented in MSDN. Can you provide a reference, as this is news to me.
The line that you quote concerning Microsoft Layer for Unicode merely means that there is a Wide version of the ShellExecute API (ShellExecuteW) which, if you want to use it instead of the ANSI version (ShellExecuteA) in W9x/Me, requires the MLUC (it should also be pointed out that this advice is mostly directed to C/C++ programmers, as it is rather difficult to jump through the necessary hoops to leverage unicoWS.dll in VB)
Sorry strongm, I didn't mean to offend you, I've read a lot of your posts and know you know your stuff. I am aware that the ShellExecute API is supported in Win 95/Win NT 3.1 and up. I was wondering why dcdogxx was not able to make the statement suceed in Win98. I have seen many different values used for the lpParameters and lpDirectory parameters (eg: vbNullString,NULL,0,"" and was wondering if there is a value that works on all OS's (or if any of them do not).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.