MartyConnelly
martyconnelly at shaw.ca
Thu Dec 15 18:42:34 CST 2005
Do you want to get the url of the graphic displayed on an html page or the url of whatever is displayed after triggering the hotspot? You might have to use this. Among the features built into the WebBrowser control are context (right-click) menus and accelerator keys mapped to specific actions. You may want to turn off some or all of these features in your application, but there is no direct way to do so using the WebBrowser control's properties. However, Microsoft offers a free tool to perform these actions--the WBCustomizer.dll http://support.microsoft.com/support/kb/articles/Q183/2/35.ASP or if you just want to parse out the returned Html from the webpage If you need to retrieve HTML pages, you can do so easily by calling some functions in the WinINet API library. First, put the following declarations in your project (in a code module) so the program will know about the required WinINet library functions: Public Const INTERNET_OPEN_TYPE_PRECONFIG = 0 Public Const INTERNET_OPEN_TYPE_DIRECT = 1 Public Const INTERNET_OPEN_TYPE_PROXY = 3 Public Const scUserAgent = "VB OpenUrl" Public Const INTERNET_FLAG_RELOAD = &H80000000 Public Declare Function InternetOpen Lib "wininet.dll" _ Alias "InternetOpenA" (ByVal sAgent As String, _ ByVal lAccessType As Long, ByVal sProxyName As String, _ ByVal sProxyBypass As String, ByVal lFlags As Long) As Long Public Declare Function InternetOpenUrl Lib "wininet.dll" _ Alias "InternetOpenUrlA" (ByVal hOpen As Long, _ ByVal sUrl As String, ByVal sHeaders As String, _ ByVal lLength As Long, ByVal lFlags As Long, _ ByVal lContext As Long) As Long Public Declare Function InternetReadFile Lib "wininet.dll" _ (ByVal hFile As Long, ByVal sBuffer As String, _ ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) _ As Integer Public Declare Function InternetCloseHandle Lib "wininet.dll" _ (ByVal hInet As Long) As Integer Then, obtain the entire text of the specified URL, as shown in this function: Private Function GetHTMLFromURL(sUrl As String) As String Dim s As String Dim hOpen As Long Dim hOpenUrl As Long Dim bDoLoop As Boolean Dim bRet As Boolean Dim sReadBuffer As String * 2048 Dim lNumberOfBytesRead As Long hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_PRECONFIG, _ vbNullString, vbNullString, 0) hOpenUrl = InternetOpenUrl(hOpen, sUrl, vbNullString, 0, _ INTERNET_FLAG_RELOAD, 0) bDoLoop = True Do While bDoLoop sReadBuffer = vbNullString bRet = InternetReadFile(hOpenUrl, sReadBuffer, Len(sReadBuffer), _ lNumberOfBytesRead) s = s & Left$(sReadBuffer, lNumberOfBytesRead) If Not CBool(lNumberOfBytesRead) Then bDoLoop = False Loop If hOpenUrl <> 0 Then InternetCloseHandle (hOpenUrl) If hOpen <> 0 Then InternetCloseHandle (hOpen) GetHTMLFromUrl = s End Function William Hindman wrote: >...I'm considering using the Web Browser ocx in an A2k3 form to access some >hotspotted graphics on a client's internal network and tie them into the mdb >...however I'm finding almost nothing on how to do something like this ...it >has to exist so I must be using the wrong search terms ...anyone know of a >source or site with code/samples/tutorials etc.? > >William > > > > -- Marty Connelly Victoria, B.C. Canada