Page 1 of 2 12 LastLast
Results 1 to 40 of 44

Thread: Help me please!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Red face Help me please!!

    I have a few questions, about VB because i just startd about a day ago.

    How do I make a program open up internet explorer links, inside of it (like an iframe on a website).

    Also, if anyone could help me get startd that would be greatly appreciated.

    Last edited by K1tchen; Jan 24th, 2005 at 11:29 PM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    the easiest way would be to use SHELL "www.vbforums.com"
    which would open your default browser. The next best way it to use SHELLEXECUTE, but you need to load some stuff before you can use it.
    Click the search button and type it in. There is another thread on the first page from today that lists out exactly what you would need to do it the second way.

    Welcome to the forums.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    thanks, ill let you know if it works


    edit: it didnt work

    any other ideas?

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
    4. ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    5.  
    6. Private Const SW_HIDE As Long = 0
    7. Private Const SW_SHOWNORMAL As Long = 1
    8.  
    9. Private Sub Command1_Click()
    10.     ShellExecute 0&, "OPEN", "www.msn.com", vbNullString, "C:\", SW_SHOWNORMAL
    11.  
    12.  ' c:\ = Destination Folder
    13. End Sub

    sorry about that. I should have tried it first. I think there is a way to do it, but this works for sure.

  5. #5
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: Help me please!!

    nonono, he means like with the web browser control...
    First goto Project > Components on the menu bar.
    Scroll down until you find "Microsoft Internet Controls".
    Check the box next to that one and click "Ok".
    A picture of the world should appear in the control box on the left of VB (where you click to select a button, or label, etc).
    Click the world and place the control onto the form.
    Play around with the properties.

    Hope that helps.
    "I don't want to live alone until I'm married" - M.M.R.P

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    that's a little bit more complicated than my first two suggestions, but if that is what you want, that's how to do it.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    can u guys IM me on AIM, just so if i have any question because what u said was complicating with the checkbox and stuff...


    aim lxhaxorxl

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    I don't have aim. ms messenger

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    ok, nvm about AIM...

    that idea with the MS Internet Controls thing worked for me, just how to i make it display my website?????

    (im new to this remmeber!)

  10. #10
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Help me please!!

    first do a search on this forum for either webrowser control or inet control

    and read all you can,

    then start a simple project, adding the contorls you need and set the properties for the controls, then put in what ever code you can from what you have learned, cut and paste from the examples works great

    then see if you can figure out why it isn't working.

    then post here, with the code you are using and what your problem is

    rgds pete

  11. #11
    Lively Member Misspell's Avatar
    Join Date
    Mar 2002
    Location
    Located
    Posts
    69

    Re: Help me please!!

    On a blank form add a Text1 (textbox) and a WebBrowser1 (Web Browser control), then place this code in your form.

    VB Code:
    1. Private Sub Form_Resize()
    2. '
    3. Text1.Move 10, 0, Me.Width - 150
    4. WebBrowser1.Move 10, Text1.Top + Text1.Height, Me.Width - 150, (Me.Height - WebBrowser1.Top)
    5. End Sub
    6.  
    7.  
    8. Private Sub Text1_KeyPress(KeyAscii As Integer)
    9. '
    10.  If KeyAscii = vbKeyReturn Then
    11.      
    12.       ' see if ".com" is in the Text1.text field
    13.       If InStr(Text1.Text, ".com") Then
    14.         ' if so then pass it to the WebBrowser1 control
    15.         WebBrowser1.Navigate Text1.Text
    16.       Else
    17.         ' if not, toss it at the end of the google string
    18.         ' and search google for the Text1.text
    19.         WebBrowser1.Navigate "http://www.google.com/search?q=" & Text1.Text
    20.       End If
    21.      
    22.       KeyAscii = 0 ' clear KeyCode so you dont get a beep
    23.                    ' Comment out that line and you will hear a beep when the 'enter'
    24.                    ' is pressed.
    25.   End If
    26. End Sub

    That should get you started.
    There is tons of info about this with-in the forum, search around and you will see.

    _

    ~ What was once an opinion, became a fact, to be later proven wrong... ~

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    Hey that helped a lot!!!, now im wondering this one thing, how do i make it start of at a certain page when you open it?

    like http://www.google.com how would i make that the homepage???

  13. #13
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: Help me please!!

    put the WebBrowser1.Navigate in the Form_Load event.
    "I don't want to live alone until I'm married" - M.M.R.P

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    idk what that iss...



    like could u add it to that code that she posted up there????


  15. #15
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    open a form, press control-t to open components, click the checkbox next to M$ Internet Controls. This will add the world control. Double-click on it, and it will add a window to your form. This is where the web will open.

    Then, add this to the form: (change the address if you want)

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.  
    5.   WebBrowser1.Navigate "www.msn.com"
    6.  
    7. End Sub

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    we need ppl like him thanks!! ill tell ya if it works...

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    nice it workd!! hey, could you possibly help me make a browser?

  18. #18
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    I can help you when you get stuck, but i'm sure that if you search you can find the code to make a browser, but why not use IE?

  19. #19

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    i just want my own browser to advertise my game im makin

  20. #20
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    a browser can't advertise anything. it is just a program to see pages on the internet. you woud need a web page, and a place to host it, and then usually some way to get people to see it, so that you could advertise.

  21. #21

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    i kno i got a site, and with the browser i'd make it the homepage, so that way they have to see it when they open it, no matter what...

  22. #22
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Help me please!!

    thats kind of..well annoying..

  23. #23
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    they already have those in IE. They are called BHO's, commonly known as Hijackers that take over your home page. You don't want to do this. Nobody would use a browser that they couldn't set the home page for.

    You could set IE to your homepage, but only if the user wanted it.

    ALSO: Take your personal information out of the first post. We can get it from your profile page. If you leave it here, the bots will get it and your domain and email will get spammed.
    Last edited by dglienna; Jan 24th, 2005 at 10:35 PM.

  24. #24

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    ack!!!! you guys dont understand...well

    what i want is where you can set your homepage all everyhting like a normal browser, except it has a link to my site, so i can it hits, or something like that, but i want to make it so its like IE but, invisble it clicks a link, such as my website, giving me hits without them knowing it...

    i think thats the best way to explain it

  25. #25
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    Doesn't sound like something that i'd want

  26. #26

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    ok, heres the next thing, how do you make a window pop open when you click a link that is targeted for a new window, meaning when i click the link, it opens it inside my program, and not in IE...

  27. #27
    Hyperactive Member Disiance's Avatar
    Join Date
    Sep 2004
    Location
    Denver, CO
    Posts
    439

    Re: Help me please!!

    you could add an "ad bar" to the browser.
    "I don't want to live alone until I'm married" - M.M.R.P

  28. #28

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!


  29. #29
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    i'm not sure. But, I found this:

    http://www.vb-helper.com/howto_restricted_browser.html

    this should give you an idea or two.
    Last edited by dglienna; Jan 25th, 2005 at 12:05 AM.

  30. #30

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    this just allows it to only go to one website, and stay there...only problem is, it stays at a blank website...and blocks EVERY WEBSITE that i try to go to on it...well check it out...

    heres what i have so far, i have a TextBox Control, and the WebBrowser Control, and heres the code

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.  
    5.   WebBrowser1.Navigate "STARTING PAGE"
    6.  
    7. End Sub
    8. Private Sub Form_Resize()
    9. '
    10. Text1.Move 10, 0, Me.Width - 150
    11. WebBrowser1.Move 10, Text1.Top + Text1.Height, Me.Width - 150, (Me.Height - WebBrowser1.Top)
    12. End Sub
    13.  
    14.  
    15. Private Sub Text1_KeyPress(KeyAscii As Integer)
    16. '
    17.  If KeyAscii = vbKeyReturn Then
    18.             ' see if ".com" is in the Text1.text field
    19.       If InStr(Text1.Text, ".com") Then
    20.         ' if so then pass it to the WebBrowser1 control
    21.         WebBrowser1.Navigate Text1.Text
    22.       Else
    23.         ' if not, toss it at the end of the google string
    24.         ' and search google for the Text1.text
    25.         WebBrowser1.Navigate "http://www.google.com/search?q=" & Text1.Text
    26.       End If
    27.             KeyAscii = 0 ' clear KeyCode so you dont get a beep
    28.                    ' Comment out that line and you will hear a beep when the 'enter'
    29.                    ' is pressed.
    30.   End If
    31. End Sub
    32. Private Sub webBrowse_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    33. 'txtURL.Text = URL 'Additionally you can use this, but it shows all child URL's too (such as URL's loaded in iFrames)
    34. txtURL.Text = WebBrowser1.Document.URL
    35. txtURL.SelStart = 0
    36. txtURL.SelLength = Len(txtURL.Text)
    37. End Sub
    38. ' Cancel any navigation that moves outside VB helper.
    39. Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As _
    40.     Object, URL As Variant, Flags As Variant, _
    41.     TargetFrameName As Variant, PostData As Variant, _
    42.     Headers As Variant, Cancel As Boolean)
    43. Const TARGET = "about:blank"""
    44.  
    45.     Cancel = (LCase$(Left$(URL, Len(TARGET))) <> TARGET)
    46.     If Cancel Then MsgBox URL & " is blocked"
    47. End Sub
    48.  
    49. ' Don't let the user open a new window.
    50. Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel _
    51.     As Boolean)
    52.     Cancel = True
    53.     MsgBox "You cannot open a new window."
    54. End Sub

    EDIT: lets say i wanted to make it stay at http://www.google.com how would i do that?

  31. #31
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    I commented out the cancel=true, and got it to browse where I wanted.
    you would just have it always navigate to the same page. if it didn't have the com, then it would do a google search

  32. #32
    Member
    Join Date
    Jan 2005
    Posts
    56

    Re: Help me please!!

    Not to be mean or anything, but if you just started programming "a day ago" how exactly are you going to program a game? I've been programming in BASIC for 16 years and I can tell you there's nothing harder to make than a decent game!!!! Trust me..

    -Mike

  33. #33

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    ahh kk, cancel=true cancel that out...
    ________________________________

    whatcha mean make a game, this is a web browser ....

  34. #34
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: Help me please!!

    If you want to read more about the Web Browser Control, read the articles in my signature. They provide in-depth information about the component, and also contain and example for a browser application.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  35. #35

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    wow, nice!!!

    ok so now theres a compile error in this part the error reads: "User-defined type not defined"

    VB Code:
    1. Private Sub tlbMain_ButtonClick(ByVal Button As MSComctlLib.Button)
    2. Select Case Button.Key
    3.     Case "back"
    4.         webMain.GoBack
    5.     Case "forward"
    6.         webMain.GoForward
    7.     Case "stop"
    8.         webMain.Stop
    9.         Button.Enabled = False
    10.     Case "reload"
    11.         webMain.Refresh
    12.     Case "home"
    13.         webMain.GoHome
    14.     Case "search"
    15.         webMain.GoSearch
    16.     Case "preview"
    17.         webMain.ExecWB OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT
    18.     Case "print"
    19.         webMain.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DODEFAULT
    20.     Case "lock"
    21.         If Button.Value = tbrPressed Then
    22.             tlbMain.Buttons.Item("vbwm").Value = tbrUnpressed
    23.         Else
    24.             tlbMain.Buttons.Item("vbwm").Value = tbrUnpressed
    25.         End If
    26.     Case "vbwm"
    27.         If Button.Value = tbrPressed Then
    28.             tlbMain.Buttons.Item("lock").Value = tbrUnpressed
    29.         Else
    30.             tlbMain.Buttons.Item("lock").Value = tbrUnpressed
    31.         End If
    32. End Select
    33. End Sub

    i kinda know what it means, but not completely....

  36. #36
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    what line is crashing?

  37. #37

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    VB Code:
    1. Private Sub tlbMain_ButtonClick(ByVal Button As MSComctlLib.Button)

    thats the line thats crashing...i think its because..well nvm, ill let you answer it...

  38. #38
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    did you add the component Common Control?

  39. #39

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: Help me please!!

    nope lemme try this




    EDIT: cant find it

  40. #40
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Help me please!!

    Found it for you. I guess you didn't download the sample project from the article? You should. It has everything you need for the basics.
    Last edited by dglienna; Jan 26th, 2005 at 02:19 AM.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width