Help with IE Browser Menu in VB (Question for experts)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • amjad

    #1

    Help with IE Browser Menu in VB (Question for experts)

    Hi

    I have been searching all the newsgroups and MSDN but cant seem to
    find how to perform a "simple" task.

    I basically want to achieve the following:

    Given a URL, I navigate to the URL, position to a frame within the Web
    page, copy the contents and paste or save as file the copied contents.

    I dont know the name of the frame in the frame-definitions, so to get
    around this, I am positioning the Mouse manually to that frame

    I have tried using SendKeys to send Control-A and Control-C, but these
    dont seem to work.

    I am now trying to activate the Right-click and then Select "View
    source" or use "select All" and then "copy" and then "Paste".

    I have tried variations of "view source:" such as

    WebBrowser1.Nav igate "view-source:" & WebBrowser1.Loc ationURL

    but these dont display the correct source, since it applies to another
    frame


    Help please with examples if you can (directly to me)
    amoghul@frontli ne.co.uk

    many thanks
  • Slaatje

    #2
    Re: Help with IE Browser Menu in VB (Question for experts NOT!)

    Try this:

    Const scUserAgent = "API-Guide test program"
    Const INTERNET_OPEN_T YPE_DIRECT = 1
    Const INTERNET_OPEN_T YPE_PROXY = 3
    Const INTERNET_FLAG_R ELOAD = &H80000000
    Const sURL = "http://www.microsoft.c om/index.htm"
    Private Declare Function InternetOpen Lib "wininet" Alias "InternetOp enA"
    (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As
    String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
    Private Declare Function InternetCloseHa ndle Lib "wininet" (ByRef hInet As
    Long) As Long
    Private Declare Function InternetReadFil e Lib "wininet" (ByVal hFile As
    Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long,
    lNumberOfBytesR ead As Long) As Integer
    Private Declare Function InternetOpenUrl Lib "wininet" Alias
    "InternetOpenUr lA" (ByVal hInternetSessio n As Long, ByVal lpszUrl As String,
    ByVal lpszHeaders As String, ByVal dwHeadersLength As Long, ByVal dwFlags As
    Long, ByVal dwContext As Long) As Long
    Private Sub Form_Load()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi. net

    Dim hOpen As Long, hFile As Long, sBuffer As String, Ret As Long
    'Create a buffer for the file we're going to download
    sBuffer = Space(1000)
    'Create an internet connection
    hOpen = InternetOpen(sc UserAgent, INTERNET_OPEN_T YPE_DIRECT,
    vbNullString, vbNullString, 0)
    'Open the url
    hFile = InternetOpenUrl (hOpen, sURL, vbNullString, ByVal 0&,
    INTERNET_FLAG_R ELOAD, ByVal 0&)
    'Read the first 1000 bytes of the file
    InternetReadFil e hFile, sBuffer, 1000, Ret
    'clean up
    InternetCloseHa ndle hFile
    InternetCloseHa ndle hOpen
    'Show our file
    MsgBox sBuffer
    End Sub



    Comment

    Working...