Re: Get a reference to an opened window



Dan,

I think with all the latest patches and IE security updates, that no longer
works. For me, I get:

OLE error code 0x800401e3: Operation unavailable.

This is on the loIE = GetObject( , "InternetExplorer.Application") line.

I can loop through Explorer Windows like this still:

oShellObj = CREATEOBJ('Shell.Application')
oShWinColl = oShellObj.Windows()
FOR EACH oItem IN oShWinColl
? oItem.LocationURL
ENDFOR



--
Fred
Microsoft Visual FoxPro MVP


"Dan Freeman" <spam@xxxxxxxxxxxxx> wrote in message
news:eNq0G3vOFHA.3336@xxxxxxxxxxxxxxxxxxxxxxx
> I'm not sure about Windows explorer, but Internet Explorer is easy...
>
> Try
> * grab a reference if it's already running
> loIE = GetObject( , "InternetExplorer.Application")
> Catch
> Try
> * otherwise, create a new reference
> loIE = CreateObject("InternetExplorer.Application")
> Catch
> Messagebox("Couldn't get the object")
> Endtry
> Endtry
>
> The technique is called Automation. For more general information, see
> http://www.hentzenwerke.com/catalog/autofox.htm. It's about using Office
> apps, but the techniques apply.
>
> Dan
>
>
> Leon wrote:
>> I am trying to get Object reference to Internet explorer
>> and Windows Explorer.
>>
>> Leon
>>
>> "Dan Freeman" wrote:
>>
>>> Only if the application is an automation server.
>>>
>>> What exactly are you trying to do?
>>>
>>> Dan
>>>
>>> Leon wrote:
>>>> Hi Lee.
>>>> Thanks for replying.
>>>> May be I did not explain it correctly, but what I need is to have
>>>> the same type of reference
>>>> to the window as I would have by calling like O = Getobject(...).
>>>> And later I want
>>>> to use properties and methods of that object like O.ObjectProperty.
>>>> Is that possible to do?
>>>>
>>>> Leon
>>>>
>>>>
>>>> "Lee Mitchell" wrote:
>>>>
>>>>> Hi Leon:
>>>>>
>>>>> You need to use Windows API calls to find the Window name. Take a
>>>>> look at the code in this article:
>>>>>
>>>>> http://support.microsoft.com/default.aspx?scid=KB;EN-US;188404
>>>>>
>>>>> I hope this helps.
>>>>>
>>>>> This posting is provided "AS IS" with no warranties, and confers no
>>>>> rights.
>>>>>
>>>>> Sincerely,
>>>>> Microsoft FoxPro Technical Support
>>>>> Lee Mitchell
>>>>>
>>>>> *-- VFP9 HAS ARRIVED!! --*
>>>>> Read about all the new features of VFP9 here:
>>>>> http://msdn.microsoft.com/vfoxpro/
>>>>>
>>>>> *--Purchase VFP 9.0 here:
>>>>>
>>>
> http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
>>>>> 69-4500-8bf2-3f06689f4ab3&type=ovr
>>>>>
>>>>> Keep an eye on the product lifecycle for Visual FoxPro here:
>>>>> http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
>>>>> - VFP5 Mainstream Support retired June 30th, 2003
>>>>> - VFP6 Mainstream Support retired Sept. 30th, 2003
>>>>>
>>>>>> Hi Guys.
>>>>>
>>>>>> Can anyone prompt me how to get a reference to not a VFP window?
>>>>>> The window was not opened from VFP 8.0 using Createobject() or
>>>>>> Getobject().
>>>>>
>>>>>> Thanks
>
>


.