Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Fri, 4 Jul 2008 03:40:27 -0700 (PDT),    group: microsoft.public.win32.programmer.ole        back       


How to get dynamic attribute at runtime   
Hi,

I have a simple tool works like the IE Developer toolbar. When I move
the mouse over the HTML page, it can retrieve the element information
under the mouse. But if the attribute is set by JS at runtime.

Used the Low Level Mouse hook, so I know where the mouse. Then I get
the "Internet Explorer_Server" window class and get the DOM object. I
can see the JS is running and the styles are applied to the elements.
But my app cannot retrieve it.

Does the DOM get from "Internet Explorer_Server" class represent a
dynamic one or a static one?

Thanks~~~
date: Fri, 4 Jul 2008 03:40:27 -0700 (PDT)   author:   unknown

Re: How to get dynamic attribute at runtime   
wrote in message
news:c7537469-708e-4598-ae8e-3fb5badcbc16@w8g2000prd.googlegroups.com
> I have a simple tool works like the IE Developer toolbar. When I move
> the mouse over the HTML page, it can retrieve the element information
> under the mouse. But if the attribute is set by JS at runtime.

How do you retrieve the attribute? How does JS set the attribute?
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Fri, 4 Jul 2008 09:45:08 -0400   author:   Igor Tandetnik

Re: How to get dynamic attribute at runtime   
What is the "IE Developer toolbar"? I don't think I have heard of it, but it 
sounds useful.


 wrote in message 
news:c7537469-708e-4598-ae8e-3fb5badcbc16@w8g2000prd.googlegroups.com...
>
> I have a simple tool works like the IE Developer toolbar.
date: Fri, 4 Jul 2008 12:23:54 -0700   author:   Sam Hobbs _change_social_to_socal

Re: How to get dynamic attribute at runtime   
Ignore my question about the IE Developer toolbar; I found articles about 
it. One of the articles is See "Steve C. Orr - The free Internet Explorer 
Developer Toolbar" at:

http://steveorr.net/articles/IEDevToolbar.aspx


 wrote in message 
news:c7537469-708e-4598-ae8e-3fb5badcbc16@w8g2000prd.googlegroups.com...
> Hi,
>
> I have a simple tool works like the IE Developer toolbar. When I move
> the mouse over the HTML page, it can retrieve the element information
> under the mouse. But if the attribute is set by JS at runtime.
>
> Used the Low Level Mouse hook, so I know where the mouse. Then I get
> the "Internet Explorer_Server" window class and get the DOM object. I
> can see the JS is running and the styles are applied to the elements.
> But my app cannot retrieve it.
>
> Does the DOM get from "Internet Explorer_Server" class represent a
> dynamic one or a static one?
>
> Thanks~~~
>
date: Fri, 4 Jul 2008 21:04:15 -0700   author:   Sam Hobbs _change_social_to_socal

Re: How to get dynamic attribute at runtime   
On Jul 4, 9:45 pm, "Igor Tandetnik"  wrote:
>  wrote in message
>
> news:c7537469-708e-4598-ae8e-3fb5badcbc16@w8g2000prd.googlegroups.com
>
> > I have a simple tool works like the IE Developer toolbar. When I move
> > the mouse over the HTML page, it can retrieve the element information
> > under the mouse. But if the attribute is set by JS at runtime.
>
> How do you retrieve the attribute? How does JS set the attribute?
> --

While I hover the mouse the item, it is applied a hight-light effect,
by applying a new "class" attribute. So I think the "class" attribute
is set during the "onmouseover" callback.

To retrieve the attribute I use "IHTMLElement::getAttribute" method.


> With best wishes,
>     Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
date: Sat, 5 Jul 2008 02:21:07 -0700 (PDT)   author:   unknown

Re: How to get dynamic attribute at runtime   
wrote in message
news:f6d6d101-d11b-4d31-8704-5a7e0add5d24@k13g2000hse.googlegroups.com
> On Jul 4, 9:45 pm, "Igor Tandetnik"  wrote:
>>  wrote in message
>>
>> news:c7537469-708e-4598-ae8e-3fb5badcbc16@w8g2000prd.googlegroups.com
>>
>>> I have a simple tool works like the IE Developer toolbar. When I
>>> move the mouse over the HTML page, it can retrieve the element
>>> information under the mouse. But if the attribute is set by JS at
>>> runtime.
>>
>> How do you retrieve the attribute? How does JS set the attribute?
>
> While I hover the mouse the item, it is applied a hight-light effect,
> by applying a new "class" attribute. So I think the "class" attribute
> is set during the "onmouseover" callback.

Are you sure? Have you looked at JavaScript code doing this, or are you 
just guessing?

What's the URL of the page you are testing on?

> To retrieve the attribute I use "IHTMLElement::getAttribute" method.

If the script really manipulates "class" attribute, try also with 
IHTMLElement::get_className. I doubt it would make a difference though.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Sat, 5 Jul 2008 11:51:56 -0400   author:   Igor Tandetnik

Re: How to get dynamic attribute at runtime   
On Jul 5, 11:51 pm, "Igor Tandetnik"  wrote:
>  wrote in message
>
> news:f6d6d101-d11b-4d31-8704-5a7e0add5d24@k13g2000hse.googlegroups.com
>
> > On Jul 4, 9:45 pm, "Igor Tandetnik"  wrote:
> >>  wrote in message
>
> >>news:c7537469-708e-4598-ae8e-3fb5badcbc16@w8g2000prd.googlegroups.com
>
> >>> I have a simple tool works like the IE Developer toolbar. When I
> >>> move the mouse over the HTML page, it can retrieve the element
> >>> information under the mouse. But if the attribute is set by JS at
> >>> runtime.
>
> >> How do you retrieve the attribute? How does JS set the attribute?
>
> > While I hover the mouse the item, it is applied a hight-light effect,
> > by applying a new "class" attribute. So I think the "class" attribute
> > is set during the "onmouseover" callback.
>
> Are you sure? Have you looked at JavaScript code doing this, or are you
> just guessing?
>
> What's the URL of the page you are testing on?
>

Pretty sure. I have tried it on many public site.


> > To retrieve the attribute I use "IHTMLElement::getAttribute" method.
>
> If the script really manipulates "class" attribute, try also with
> IHTMLElement::get_className. I doubt it would make a difference though.

Yep. IHTMLElement::get_className really solves my problem. But I want
to know if there are any universal way to get the attributes. If I
have to write specific code to get sepcific attribute, my code would
be in a mess and difficult to maintain. I have tried IHTMLDOMAttribute
and IHTMLDOMAttribute2, the behavior of both are odd...It does works
with "class" attribute. But if I tried to get "align", my app crash. I
have not troubleshooted this, however, I could get "align" by
getAttribute. And If you try to get "offsetWidth" attribute, my app
would suspend until I kill it.

Do you have any good ideal to help work this out? Thanks.


> --
> With best wishes,
>     Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
date: Sun, 6 Jul 2008 02:22:23 -0700 (PDT)   author:   unknown

Re: How to get dynamic attribute at runtime   
wrote in message
news:0130fe3d-e498-4906-be85-353e39dcd359@27g2000hsf.googlegroups.com
> Yep. IHTMLElement::get_className really solves my problem. But I want
> to know if there are any universal way to get the attributes. If I
> have to write specific code to get sepcific attribute, my code would
> be in a mess and difficult to maintain. I have tried IHTMLDOMAttribute
> and IHTMLDOMAttribute2, the behavior of both are odd...It does works
> with "class" attribute. But if I tried to get "align", my app crash. I
> have not troubleshooted this, however, I could get "align" by
> getAttribute. And If you try to get "offsetWidth" attribute, my app
> would suspend until I kill it.

Well, every attribute on an HTML element is reflected in a property 
(usually of the same name, with class->className being the only 
exception if I recall correctly). But not every property is reflected in 
an attribute: e.g. you cannot write <span offsetWidth="123"> in an HTML 
document (to be precise, you _can_ write that, but the attribute will 
have no effect).

If you want to read any property given its name as a string, try using 
late binding, via IDispatch::GetIdsOfNames and Invoke.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Mon, 7 Jul 2008 08:04:22 -0400   author:   Igor Tandetnik

Re: How to get dynamic attribute at runtime   
On Jul 7, 8:04 pm, "Igor Tandetnik"  wrote:
>  wrote in message
>
> news:0130fe3d-e498-4906-be85-353e39dcd359@27g2000hsf.googlegroups.com
>
> > Yep. IHTMLElement::get_className really solves my problem. But I want
> > to know if there are any universal way to get the attributes. If I
> > have to write specific code to get sepcific attribute, my code would
> > be in a mess and difficult to maintain. I have tried IHTMLDOMAttribute
> > and IHTMLDOMAttribute2, the behavior of both are odd...It does works
> > with "class" attribute. But if I tried to get "align", my app crash. I
> > have not troubleshooted this, however, I could get "align" by
> > getAttribute. And If you try to get "offsetWidth" attribute, my app
> > would suspend until I kill it.
>
> Well, every attribute on an HTML element is reflected in a property
> (usually of the same name, with class->className being the only
> exception if I recall correctly). But not every property is reflected in
> an attribute: e.g. you cannot write <span offsetWidth="123"> in an HTML
> document (to be precise, you _can_ write that, but the attribute will
> have no effect).
>
> If you want to read any property given its name as a string, try using
> late binding, via IDispatch::GetIdsOfNames and Invoke.

Thanks...looks like my simple tool is going to get complicate...

> --
> With best wishes,
>     Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
date: Mon, 7 Jul 2008 18:52:39 -0700 (PDT)   author:   unknown

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us