From: Salad on
Has IE gotten so complex you can't get the URL from IE? The code at
http://www.mvps.org/access/api/api0051.htm used to work. Now it returns
nothing. Is this due to having the IE/Yahoo/Google/WhateverElse toolbars?

I've determined where it fails...at least for me....on the third If()
statement in function Refresh. Maybe MS has changed the value of
ComboBoxEx32 to some other value?

Is there a way to get the URL from an IE window if you have the hWnd of
it? I've got the class and caption, no URL.

Private Const mconIE_COMBOEx = "ComboBoxEx32"

'this works
If fIsNT() Then
hWndChild = apiFindWindowEx(hWnd, 0, _
conIE_WORKERW, vbNullString)
Else
hWndChild = apiFindWindowEx(hWnd, 0, _
mconIE_WORKERA, vbNullString)
End If

'this works
If hWndChild > 0 Then
' Rebar is child of Worker window
hWndChild = apiFindWindowEx(hWndChild, 0, _
mconIE_REBAR, vbNullString)
End If

'heres where it fails. It always returns 0
If hWndChild > 0 Then
' ComboboxEx is child of Rebar window
hWndChild = apiFindWindowEx(hWndChild, 0, _
mconIE_COMBOEx, vbNullString)
End If

'since it's 0 now, it's ignored
If hWndChild > 0 Then
' ComboBox is child of ComboBoxEx Window
hWndChild = apiFindWindowEx(hWndChild, 0, _
mconIE_COMBO, vbNullString)
End If

'since it's 0 now, it's ignored
If hWndChild > 0 Then
' Edit class is child of ComboBox window
hWndChild = apiFindWindowEx(hWndChild, 0, _
mconIE_EDIT, vbNullString)
End If
From: Salad on
Stephen Lebans wrote:

> Just glancing at your code, your check for validity of hWnd is incorrect.
> For NT or higher you follow this logic:
>
> If hWndChild <> 0 Then
>
> NT or higher you can get a negative value for the hWnd as it is now a full
> 32 bit value.

Hi Stephen:

The code at http://www.mvps.org/access/api/api0051.htm worked back in
2005. It was part of my app. I noticed recently it no longer worked.

I changed all references of "hWndChild > 0" to "hWndChild <> 0". That
didn't help because in the third if statement in procedure Refresh()
hWndChild gets set to zero.

I'm thinking that perhaps MS has moved on and the code at the site
hasn't been upgraded and perhaps will never work without a major upgrade.

I really would like to enumerate through open IE windows and present the
subject lines/Urls to the user to associate records with a specific URL.

From: Salad on
Stephen Lebans wrote:

> Check the Classnames for your version of Internet Explorer as they have
> probably changed in some fashion. Do you have Spy++ on your system? Or there
> is a WIndow Class viewer on the Access MVP site.
>
Hi Stephen:

The code in produre "Refresh() enumerates all open windows and
determines the hWnd number and the caption of each window. It then gets
the class of each window. If the class is "IEFrame", IE's class name,
it then attempts to extract the URL. Up to this point it processes
correctly.

After getting the class and caption the first two If/Endif's work fine
as well.

It is the 3rd-5th If/Endifs that fail when getting the hWndChild
values...;child of Rebar window, child of ComboBoxEx, and child of
ComboBox window. Since the Url locater is a combo box I figure that's
why they last 3 calls to get the hWndChild are looking for a combobox type.