Results 1 to 28 of 28

Thread: need help

  1. #1
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    need help

    I am creating a program using vb6. Can somebody give me an idea on how to link vb6 program to a website search engine/weblink tool:
    What I am trying to accomplish is, if I want to input a set of characters/numerc into a texbox in a vb6 form and hit enter or click button, it will open a multiple website and the value I typed into the textbox of the program should authomatically be shown (same value) into the textbox of the website search engine and will authomatically search itself.
    thank you in advance. Please advise.

  2. #2
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    See if this will help you any
    Attached Files Attached Files
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  3. #3
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    Hi jmsrickland, thank you for your help and response. It is the exact program that I want to accomplish but, what's missing is the program should open multiple website

    example:
    Shell("www.google.com", vbNormalFocus)

    and the value I typed into the textbox (getfocus)of the program should authomatically be shown into the textbox of the website search engine(html format) and will authomatically search itself.

    thank you for your response

  4. #4
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    Does "multiple website" mean more than one website or the same website multiple times?
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  5. #5
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    It should open more than one website, assuming all website are created under html format and the string/numeric that was inserted to the textbox of the vb6 form must get the same value into the search box of the mutiple websites that were opened

    example:
    Shell("www.google.com", vbNormalFocus)
    Shell("www.yahoo.com", vbNormalFocus)
    Shell("www.msn.com", vbNormalFocus)

  6. #6
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    OK, so using the project I posted as an example you want to open more than one site as separate windows using the Shell function instead of using the WebBrowser control. Now, we need to know the names of all the search engines you want to use unless you have already named them (google, yahoo, msn <-- any otheres??), then take the search argument string and insert it into each search box of the sites opened. Is this correct?
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  7. #7
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    That is correct. To be more specific, it is the telephone number that I usually use to search to this html format tool (e.i., http://wp40281.corp.ads:5621)

  8. #8
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    Does it have to be separate windows of the browser using Shell or can it be separate Forms each one using the WebBrowser control. I ask this because I think it is easier to insert the search string into the site's search box using WebBrowser than it is using Shell since I have no way of knowing how to insert the string into a running copy of IE or whatever browser you are using.
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  9. #9
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    It is a standard html program tool that I use for searching information. It is a separate windows of a browser. I was just thinking if by means of using vb6, I can call multiple browsers to display all the information that I wanted to view

  10. #10
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    Yes, just like I did with GoogleSearch you would have more Forms each one with a WebBrowser control on it and the app would just simply call each Form like it did with one Form in my GooglSerach app.
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  11. #11
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    I assume we would need to use a webbrowser control provided by vb6 and not a separate standard web browser using a shell to view the multiple tools doing a search. I believe I get the idea there. Can this call function works even if the multiple browsers works on an intranet connection?

  12. #12
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    If I knew how to pass the search string to a browser (launched by Shell) it would be better but using VB6's WebBrowser just makes it easier (for me) however, the tools would need to be programmed in the code.

    You can have many WebBrowsers controls running at the same time just like multiple copies of IE running at the same time.
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  13. #13
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    We would need to use a multiple forms(webbrowsers controls ) and insert an html format link(search tool) to each dedicated webbrowser (forms). Is that the idea?

  14. #14
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    OK, I figured out how to do it with the three sites you mentioned using ShellExecute

    Use the app I posted and change the code to this: Note you will not need the other Form, just the first one

    Code:
    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
    
    Private Sub Form_Load()
     Dim InputLine As String
     
     Combo1.Clear
     
     Open App.Path & "\Google Search Strings.txt" For Input As #1
     
     Do While Not EOF(1)
       Line Input #1, InputLine
       If InputLine <> vbNullString Then
         Combo1.AddItem InputLine
       End If
     Loop
     
     Close #1
     
     Combo1.Text = Combo1.List(0)
     
     Image2.MousePointer = vbCustom
     Image2.MouseIcon = LoadPicture(App.Path & "\HandPointer3232.ico")
    End Sub
    
    Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer)
     '
     ' Must be done in KeyUp. This doesn't work if in KeyDown
     '
     If KeyCode = 13 Then
       Command1_Click
     End If
    End Sub
    
    Private Sub Command1_Click()
     Dim FoundSearchArhInComboList As Boolean
     Dim ThisSearchString As String
     
     If Combo1.Text = "" Then Exit Sub
      
     FoundSearchArhInComboList = False
          
     ThisSearchString = Combo1.Text
    
     For q = 0 To Combo1.ListCount
       If ThisSearchString = Combo1.List(q) Then
         FoundSearchArhInComboList = True
         Exit For
         Stop
       End If
     Next q
     
     If FoundSearchArhInComboList Then
       Open App.Path & "\Google Search Strings.txt" For Output As #1
       
       Print #1, ThisSearchString
       
       For q = 0 To Combo1.ListCount
         If Combo1.List(q) <> ThisSearchString Then
           Print #1, Combo1.List(q)
         End If
       Next q
       
       Close #1
      
       Combo1.Clear
    
       Open App.Path & "\Google Search Strings.txt" For Input As #1
     
       Do While Not EOF(1)
         Line Input #1, InputLine
         
         If InputLine <> vbNullString Then
           Combo1.AddItem InputLine
         End If
       Loop
       
       Close #1
       
       Combo1.Text = Combo1.List(0)
     Else
       Open App.Path & "\Google Search Strings.txt" For Output As #1
       
       Print #1, ThisSearchString
       
       For q = 0 To Combo1.ListCount
         Print #1, Combo1.List(q)
       Next q
       
       Close #1
      
       Combo1.Clear
    
       Open App.Path & "\Google Search Strings.txt" For Input As #1
     
       Do While Not EOF(1)
         Line Input #1, InputLine
         
         If InputLine <> vbNullString Then
           Combo1.AddItem InputLine
         End If
       Loop
       
       Close #1
       
       Combo1.Text = Combo1.List(0)
     End If
     
     '
     ' Use Google
     '
     ShellExecute 0&, vbNullString, "http://www.google.com/search?q=" & frmGoogleSearch.Combo1.Text, vbNullString, vbNullString, SW_SHOWNORMAL
    
     '
     ' Use Yahoo
     '
     ShellExecute 0&, vbNullString, "http://search.yahoo.com/search;_ylt=ApV0jxntyveJDDkQlPDu_9CbvZx4?p=" & frmGoogleSearch.Combo1.Text, vbNullString, vbNullString, SW_SHOWNORMAL 
    
     '
     ' Use MSN
     '
     ShellExecute 0&, vbNullString, "http://www.bing.com/search?q=" & frmGoogleSearch.Combo1.Text, vbNullString, vbNullString, SW_SHOWNORMAL 
     
     '
     ' Comment out the below three
     '
     'Caption = Search & " [Google Explorer]"
     'frmGoogleExplorer.Show
     'Me.Hide
    End Sub
    
    Private Sub Image2_Click()
     Command1_Click
    End Sub
    
    Private Sub Label2_Click()
     Combo1.Text = ""
    End Sub
    
    Private Sub Label3_Click()
     Dim FoundSearchArhInComboList As Boolean
     Dim ThisSearchString As String
     
     If Combo1.Text = "" Then Exit Sub
      
     FoundSearchArhInComboList = False
          
     If MsgBox("Are you sure you want to delete this entry?", vbYesNo, "Request Delete") = vbNo Then Exit Sub
          
     ThisSearchString = Combo1.Text
    
     For q = 0 To Combo1.ListCount
       If ThisSearchString = Combo1.List(q) Then
         FoundSearchArhInComboList = True
         Exit For
         Stop
       End If
     Next q
     
     If FoundSearchArhInComboList Then
       Open App.Path & "\Google Search Strings.txt" For Output As #1
       
       'Print #1, ThisSearchString
       
       For q = 0 To Combo1.ListCount
         If Combo1.List(q) <> ThisSearchString Then
           Print #1, Combo1.List(q)
         End If
       Next q
       
       Close #1
      
       Combo1.Clear
    
       Open App.Path & "\Google Search Strings.txt" For Input As #1
     
       Do While Not EOF(1)
         Line Input #1, InputLine
         Combo1.AddItem InputLine
       Loop
       
       Close #1
       
       Combo1.Text = Combo1.List(0)
     End If
    End Sub

    EDIT:

    Crap! It appears that only one copy of IE can be launched. For now I guess we will have to go back to using the WebBrowser instead of IE.

    I know I can have three copies of IE running at the same time but only if I launch each one at a time by double clicking on it's Desktop Icon. Using Shell it doesn't appear to work that way.


    EDIT to EDIT:

    It does work. I just noticed that the three sites were added as tabs so all three sites were launched. It's one IE but each site is a tab so all you have to is to tab to each one unless you want all three to show at one time on your screen then I will use Max's idea if he shows me how..
    Last edited by jmsrickland; Aug 11th, 2012 at 05:23 PM.
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  15. #15
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    Thank you for your help. This is a great help!

  16. #16
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    Re: need help

    Why use shellexecute? You could use createobject and control your internet explorer windows and search with document

  17. #17
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    Quote Originally Posted by Max187Boucher View Post
    Why use shellexecute? You could use createobject and control your internet explorer windows and search with document
    OK, so how to do that?
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  18. #18
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    OH, I guess it does work. I just noticed that the three sites were added as tabs so all three sites were launched.
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  19. #19
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    Re: need help

    I will show an example when i get my pc in half hour... Im not saying what you did is not good i just thought it would be better to have the control of your objects

  20. #20
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    Re: need help

    sorry for late reply i was trying to find out more information than i thought i knew

    i was trying to control each tab then i could of control each tab's document, which i found out i dont think is possible or if it is it would be alot of messing around with api calls

    the only way i could control documents would be if i did with seperate windows (no tabs) only 4 different windows of ie then i could use the document...

    i would go with jmsrickland or you can try this..
    Code:
    Option Explicit
    
    Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
       Private Const SW_SHOWNORMAL = 1
       Private Const SW_SHOWMINIMIZED = 2
       Private Const SW_SHOWMAXIMIZED = 3
    
    Private IE As Object
    
    
    
    Private Sub cmdSearch_Click()
       If txtSearch = vbNullString Then
          MsgBox "Please enter something to search for!", vbInformation, "Please search for something"
          Exit Sub
       ElseIf chkYahoo.Value = vbUnchecked And chkMSN.Value = vbUnchecked And chkGoogle.Value = vbUnchecked And chkDogpile.Value = vbUnchecked Then
          MsgBox "Please select a search engine!", vbInformation, "Please select a search engine"
          Exit Sub
       End If
    
       'Shell ("cmd.exe /c TASKKILL /IM iexplore.exe /F"): Sleep 1500 'close all ie windows... if needed
    
       Set IE = CreateObject("InternetExplorer.Application")
    
       With IE
          If chkYahoo.Value = vbChecked Then .Navigate "http://ca.search.yahoo.com/search?p=" & txtSearch
          If chkMSN.Value = vbChecked Then .Navigate2 "http://www.bing.com/search?q=" & txtSearch, 2048
          If chkGoogle.Value = vbChecked Then .Navigate2 "http://www.google.ca/#hl=en&q=" & txtSearch, 2048
          If chkDogpile.Value = vbChecked Then .Navigate2 "http://www.dogpile.com/search/web?q=" & txtSearch, 2048
          .Visible = True
       End With
       ShowWindow IE.hwnd, SW_SHOWMAXIMIZED
       'You can control ie here if you want
       'Only problem is i do not know how to control every tab (if possible)
       'for example
       Sleep 2000 '2 sec wait (for loading pages)
       Debug.Print IE.Document.Body.InnerHTML 'print innerhtml of current website (main ie window/object "IE") which in this case is yahoo
    
       Set IE = Nothing
    End Sub
    and i will attach project also (see attachment)
    Attached Files Attached Files
    Last edited by Max187Boucher; Aug 11th, 2012 at 10:06 PM. Reason: Updated to show Maximized

  21. #21
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    I modified the Forms module so that you can launch multiple instances of IE each one navigating to a different search Web Sit. Also, you can control the position, width and height of each instance. The positions and size parameters are for my monitor so you would need to adjust to your own liking.

    Code:
    Private Sub Form_Load()
     Dim InputLine As String
     
     Combo1.Clear
     
     Open App.Path & "\Google Search Strings.txt" For Input As #1
     
     Do While Not EOF(1)
       Line Input #1, InputLine
       If InputLine <> vbNullString Then
         Combo1.AddItem InputLine
       End If
     Loop
     
     Close #1
     
     Combo1.Text = Combo1.List(0)
     
     Image2.MousePointer = vbCustom
     Image2.MouseIcon = LoadPicture(App.Path & "\HandPointer3232.ico")
    End Sub
    
    Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer)
     '
     ' Must be done in KeyUp. This doesn't work if in KeyDown
     '
     If KeyCode = 13 Then
       Image2_Click
     End If
    End Sub
    
    Private Sub Image2_Click()
     Dim FoundSearchArhInComboList As Boolean
     Dim ThisSearchString As String
     
     If Combo1.Text = "" Then Exit Sub
      
     FoundSearchArhInComboList = False
          
     ThisSearchString = Combo1.Text
    
     For q = 0 To Combo1.ListCount
       If ThisSearchString = Combo1.List(q) Then
         FoundSearchArhInComboList = True
         Exit For
         Stop
       End If
     Next q
     
     If FoundSearchArhInComboList Then
       Open App.Path & "\Google Search Strings.txt" For Output As #1
       
       Print #1, ThisSearchString
       
       For q = 0 To Combo1.ListCount
         If Combo1.List(q) <> ThisSearchString Then
           Print #1, Combo1.List(q)
         End If
       Next q
       
       Close #1
      
       Combo1.Clear
    
       Open App.Path & "\Google Search Strings.txt" For Input As #1
     
       Do While Not EOF(1)
         Line Input #1, InputLine
         
         If InputLine <> vbNullString Then
           Combo1.AddItem InputLine
         End If
       Loop
       
       Close #1
       
       Combo1.Text = Combo1.List(0)
     Else
       Open App.Path & "\Google Search Strings.txt" For Output As #1
       
       Print #1, ThisSearchString
       
       For q = 0 To Combo1.ListCount
         Print #1, Combo1.List(q)
       Next q
       
       Close #1
      
       Combo1.Clear
    
       Open App.Path & "\Google Search Strings.txt" For Input As #1
     
       Do While Not EOF(1)
         Line Input #1, InputLine
         
         If InputLine <> vbNullString Then
           Combo1.AddItem InputLine
         End If
       Loop
       
       Close #1
       
       Combo1.Text = Combo1.List(0)
     End If
     
     SearchGoogle
     SearchYahoo
     SearchBing
    End Sub
    
    Private Sub Label3_Click()
     Dim FoundSearchArhInComboList As Boolean
     Dim ThisSearchString As String
     
     If Combo1.Text = "" Then Exit Sub
      
     FoundSearchArhInComboList = False
          
     If MsgBox("Are you sure you want to delete this entry?", vbYesNo, "Request Delete") = vbNo Then Exit Sub
          
     ThisSearchString = Combo1.Text
    
     For q = 0 To Combo1.ListCount
       If ThisSearchString = Combo1.List(q) Then
         FoundSearchArhInComboList = True
         Exit For
         Stop
       End If
     Next q
     
     If FoundSearchArhInComboList Then
       Open App.Path & "\Google Search Strings.txt" For Output As #1
       
       'Print #1, ThisSearchString
       
       For q = 0 To Combo1.ListCount
         If Combo1.List(q) <> ThisSearchString Then
           Print #1, Combo1.List(q)
         End If
       Next q
       
       Close #1
      
       Combo1.Clear
    
       Open App.Path & "\Google Search Strings.txt" For Input As #1
     
       Do While Not EOF(1)
         Line Input #1, InputLine
         Combo1.AddItem InputLine
       Loop
       
       Close #1
       
       Combo1.Text = Combo1.List(0)
     End If
    End Sub
    
    Private Sub SearchGoogle()
     Set IE = CreateObject("internetexplorer.application")
     IE.Navigate2 "http://www.google.com/search?q=" & frmGoogleSearch.Combo1.Text
     IE.Left = 15 / Screen.TwipsPerPixelX
     IE.Top = 120 / Screen.TwipsPerPixelY
     IE.Width = 5085 / Screen.TwipsPerPixelX
     IE.Height = 5910 / Screen.TwipsPerPixelY
     IE.Visible = True
     Set IE = Nothing
    End Sub
    
    Private Sub SearchYahoo()
     Set IE = CreateObject("internetexplorer.application")
     IE.Navigate2 "http://search.yahoo.com/search;_ylt=ApV0jxntyveJDDkQlPDu_9CbvZx4?p=" & frmGoogleSearch.Combo1.Text
     IE.Left = 5100 / Screen.TwipsPerPixelX
     IE.Top = 120 / Screen.TwipsPerPixelY
     IE.Width = 5085 / Screen.TwipsPerPixelX
     IE.Height = 5910 / Screen.TwipsPerPixelY
     IE.Visible = True
     Set IE = Nothing
    End Sub
    
    Private Sub SearchBing()
     Set IE = CreateObject("internetexplorer.application")
     IE.Navigate2 "http://www.bing.com/search?q=" & frmGoogleSearch.Combo1.Text
     IE.Left = 10185 / Screen.TwipsPerPixelX
     IE.Top = 120 / Screen.TwipsPerPixelY
     IE.Width = 5085 / Screen.TwipsPerPixelX
     IE.Height = 5910 / Screen.TwipsPerPixelY
     IE.Visible = True
     Set IE = Nothing
    End Sub
    Last edited by jmsrickland; Aug 12th, 2012 at 06:48 PM.
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  22. #22
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    thank you for the help guys. I appreciate it.

  23. #23
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    Re: need help

    For more control of your ie windows have a look at this

  24. #24
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    Your samples did work to my project, Thanks to your guys.

    I was just playing with it and I am linking an html format program tool where I can use as a search engine and it doesn't work. Would it be possible to use my own tool as a search engine?

  25. #25
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    You might want to explain a little better what you are referring to. What is this html format tool you are talking about? What is your own tool?

    I thought all the sample codes you got solved your problem. What's up now?
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  26. #26
    Junior Member
    Join Date
    Mar 12
    Posts
    17

    Re: need help

    I already have that(google,msn,yahoo) working except I am using an entranet made html program tool that I need it to run as well the tool is http://wp40281.corp.ads:5621

  27. #27
    PowerPoster
    Join Date
    Jan 08
    Posts
    6,765

    Re: need help

    Quote Originally Posted by werd101 View Post
    I already have that(google,msn,yahoo) working except I am using an entranet made html program tool that I need it to run as well the tool is http://wp40281.corp.ads:5621
    Link is no good

    Anyway I don't under stand your question about would it be possible to use my own tool as a search engine?
    The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved


    When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day

  28. #28
    Frenzied Member
    Join Date
    Aug 11
    Location
    B.C., Canada
    Posts
    1,838

    Re: need help

    what is your tool? was it build with vb6? is it a downloaded tool from somewhere, if so what is the name

    and what do you mean link your program with the websites? attach project here or AT LEAST post a "working" link... or event better post a picture?

    we need to know a bit more information to help you out... hopefully your tool is something that you have built in vb6 and we can have a look at it

Posting Permissions

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