468,133 Members | 1,184 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

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.Navigate "view-source:" & WebBrowser1.LocationURL

but these dont display the correct source, since it applies to another
frame
Help please with examples if you can (directly to me)
am*****@frontline.co.uk

many thanks
Jul 17 '05 #1
1 1803
Try this:

Const scUserAgent = "API-Guide test program"
Const INTERNET_OPEN_TYPE_DIRECT = 1
Const INTERNET_OPEN_TYPE_PROXY = 3
Const INTERNET_FLAG_RELOAD = &H80000000
Const sURL = "http://www.microsoft.com/index.htm"
Private Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA"
(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 InternetCloseHandle Lib "wininet" (ByRef hInet As
Long) As Long
Private Declare Function InternetReadFile Lib "wininet" (ByVal hFile As
Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long,
lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetOpenUrl Lib "wininet" Alias
"InternetOpenUrlA" (ByVal hInternetSession 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: KP*****@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(scUserAgent, INTERNET_OPEN_TYPE_DIRECT,
vbNullString, vbNullString, 0)
'Open the url
hFile = InternetOpenUrl(hOpen, sURL, vbNullString, ByVal 0&,
INTERNET_FLAG_RELOAD, ByVal 0&)
'Read the first 1000 bytes of the file
InternetReadFile hFile, sBuffer, 1000, Ret
'clean up
InternetCloseHandle hFile
InternetCloseHandle hOpen
'Show our file
MsgBox sBuffer
End Sub

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Tim Marshall | last post: by
2 posts views Thread by David | last post: by
5 posts views Thread by Reza Solouki | last post: by
6 posts views Thread by drec | last post: by
4 posts views Thread by Guern1 | last post: by
3 posts views Thread by =?ISO-8859-1?Q?Jo=E3o_Maia?= | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.