Solved

How to get text from Internet Explorer Address Bar to vb6 TextBox .....

Posted on 2004-10-25
948 Views
Last Modified: 2008-02-01
Hi,
I've a problem, i want source code, how to get text from Internet Explorer AddressBar to Textbox in Visual Basic 6 e.g: when user enter some url eg www.hotmail.com then I want to capture this url address on click or change event.  


Waiting for ur positive and nice response.           Thanks
0
Question by:AsifBangash
    6 Comments
     
    LVL 48

    Accepted Solution

    by:
    See this by Ark if make help:

    Receive Events from and Send Events to Open IE Windows
    http://www.freevbcode.com/ShowCode.Asp?ID=1606
    0
     
    LVL 1

    Author Comment

    by:AsifBangash

    Dear Ryancys,

    thx for reply but i want it in text box and i m saving it in database when textbox got text from it. and that will be unvisible to user.
    0
     
    LVL 1

    Author Comment

    by:AsifBangash
    Dear Ryancys,

    thx for reply but i want it in text box and i m saving it in database when textbox got text from it. and that will be unvisible to user.
    0
     
    LVL 48

    Expert Comment

    by:Ryan Chong
    Hi,

    If you mean grab the web page content, you can try below suggestions:

    1st: Try use the URLDownloadToFile API

    Example:

    Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

    Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
        Dim lngRetVal As Long
        lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
        If lngRetVal = 0 Then DownloadFile = True
    End Function

    Private Sub Form_Load()
        Randomize
        rndkey = Int(Rnd * 100000")
        URL = "http://www.abc.com/pass_management/user_auth.php?name=USERNAME&pass=PASSWORD" & "&rndkey=" & rndkey
        DownloadFile URL , "c:\test.txt"
    End Sub

    also:

    Ensuring URLDownloadToFile Bypasses a Cached File Copy
    http://vbnet.mvps.org/code/internet/urldownloadtofilenocache.htm

    2nd: Using M$ Internet Transfer Control ActiveX. You can select it from Components, where it got a method called openURL which do exact the same above to retrive data from an URL.

    Example:

    mydata = Inet1.OpenURL(url)

    and then we can display the web page content into textbox, and save into database, etc.

    Hope this helps
    0
     
    LVL 48

    Expert Comment

    by:Ryan Chong
    See this recent PAQ as well : http:Q_21178962.html

    where Erick37 suggested solution as follows:

    ...
    Dim ie As Object
        Set ie = CreateObject("InternetExplorer.Application")
        ie.Navigate "http://msdn.microsoft.com"
        Do While ie.ReadyState <> READYSTATE_COMPLETE
            DoEvents
        Loop
        Debug.Print ie.StatusText
        Debug.Print ie.LocationName
        Debug.Print ie.LocationURL
        ie.Quit
        Set ie = Nothing
    ...
    0
     
    LVL 1

    Author Comment

    by:AsifBangash
    Dear Ryancys,

    Thanks for hep me. Your first help is right for me and i m Accepted ur first answer.

    ok I do it means capture text from internetexplorer to Textbox of visual Basic 6.0. any way thaks.

    like to mail me on my account (asifbangash at gmail.com)
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Cisco Complete Network Certification Training

    If you’re an IT engineer or technician, it's time you take your career to the next level. This elite training bundle is brimming with all of the information you need to learn to sit for Cisco CNNA, CCNP, and CCENT certification exams.

    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    857 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

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now