?
Solved

Web Browser

Posted on 1999-12-18
8
Medium Priority
?
259 Views
Last Modified: 2010-05-02
I'm afraid this is probably a rather stupid question, but I simply want to be able to launch a web browser (IE, whatever) in a new window.  You all mention a web browser control, but I'm just not sure where to get this/how to make this.  Thanks for your help!
0
Comment
Question by:kataragon
  • 4
  • 3
8 Comments
 
LVL 4

Accepted Solution

by:
Juilette earned 30 total points
ID: 2292394
'open a browser and go to a www address
'bas module
'
Public 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

Function ShellToBrowser%(Frm As Form, ByVal URL$, ByVal WindowStyle%)
   
    Dim api%
        api% = ShellExecute(Frm.hwnd, "open", URL$, "", App.Path, WindowStyle%)
 
    'Check return value
    If api% < 31 Then
        'error code - see api help for more info
        Dim msg As String
        msg = "This item doesn't work with your system"
        MsgBox msg, vbCritical, "Error"
        ShellToBrowser% = False
    ElseIf api% = 32 Then
        'no file association
        Dim msg1 As String
        msg1 = "This item doesn't work with your system"
        MsgBox msg, vbCritical, "Error"
        ShellToBrowser% = False
    Else
        'It worked!
        ShellToBrowser% = True
 
    End If
   
End Function
'

'<<<  event from application...click event of button  >>>>>>>>
'
Private Sub cmdWeb_Click()
    Dim Site As String
    Dim success As Integer
        Site = "http://www.Yahoo.com/" '& Trim(txtWeb.Text)
        success% = ShellToBrowser(Me, Site, 0)
End Sub

0
 

Author Comment

by:kataragon
ID: 2292416
Wow Juilette, thanks for the quick response.  But could you explain to me what the use of the % means, and how/why success is able to change to success% ?
Also, if I already have a window open, it just replaces the page I had.  Is there a way to get it to open in a new window?

Thanks again
0
 
LVL 5

Expert Comment

by:KDivad
ID: 2292467
% indicates a variable type. Long, I think.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 

Author Comment

by:kataragon
ID: 2292497
Yeah, I figured as much.  Thanks.

But does anyone know how to get the page to open up a new instance of the browser?

Thanks-
0
 
LVL 5

Expert Comment

by:KDivad
ID: 2292499
I've never used ShellExecute, but I would try changing the second param from "open" to "opennew". If ShellExecute works the way I think it does, then I am right, if not, then...
0
 

Author Comment

by:kataragon
ID: 2292514
Thanks all- FYI, no, ShellExecute doesn't work with an 'opennew'.  I found some info on it, http://msdn.microsoft.com/library/periodic/period99/vji9904_shell.htm

And I decided I guess I can just open a new instance of IE myself, then run Juilette's code from up top.  

Thanks for all your help!

0
 

Author Comment

by:kataragon
ID: 2292516
Oh, I said this was a 10 point question, but now why is it showing up '1 point'?  Did I miss something?
0
 
LVL 5

Expert Comment

by:KDivad
ID: 2292534
Thanks for the info on ShellExecute.

The point value is correct. Once an answer has been accepted, the points are divided by 10. Now others can get the answer by "buying" the PAQ. I suspect the amount is shrunk because the new looker doesn't know if the answer is definitely what they want.

Later,
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question