Sign in to follow this  
Followers 0
Uling

get the COM-Object from a known Window Handle ?

12 posts in this topic

Hi,

the problem is not to get the COM-Object from an Application ( this one is "Remedy.User.1").

The problem is to get the COM-Object of an specific Instance if more than one Instances of the Application are running.

I'm able to search for the Window that i need with WinGetHandle / WinList etc. and get the HWND.

but how can I get the Object with this HWND ?

Perhaps a way like the __IEControlGetObjFromHWND() or ObjGet("winmgmts:.....) functions ?

An other way is to go via embedded IEs in that Application.

I'm able to get the Object from the embedded IE within the Application.

Is there a way to get the Object of the embedding Application, like $o_App=$o_IE_embedded.ParentApp() ?

thanks for any help!

Uling

Share this post


Link to post
Share on other sites



Hi,

the problem is not to get the COM-Object from an Application ( this one is "Remedy.User.1").

The problem is to get the COM-Object of an specific Instance if more than one Instances of the Application are running.

I'm able to search for the Window that i need with WinGetHandle / WinList etc. and get the HWND.

but how can I get the Object with this HWND ?

Perhaps a way like the __IEControlGetObjFromHWND() or ObjGet("winmgmts:.....) functions ?

An other way is to go via embedded IEs in that Application.

I'm able to get the Object from the embedded IE within the Application.

Is there a way to get the Object of the embedding Application, like $o_App=$o_IE_embedded.ParentApp() ?

thanks for any help!

Uling

This is an unsolved problem. It has come up before, for example in trying to connect to one of multiple instances of Excel running. The ROT (Running Object Table) is not easily enumerated by AutoIt to find the objects. When queried, the ROT always returns the first instance of a given object and there doesn't seem to be a way to reference other instances by index.

At least, that's my understanding of the problem.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

@ PsaltyDS, thanks for the answer.

perhaps the other way...

is it possible to get the embedding Application from a known Object of an embedded IE ?

greetings

Uling

Share this post


Link to post
Share on other sites

@ PsaltyDS, thanks for the answer.

perhaps the other way...

is it possible to get the embedding Application from a known Object of an embedded IE ?

greetings

Uling

I'm not sure. I think that would be a Dale question... Dale?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Dale ?!

where are you ? :):lmao:

Share this post


Link to post
Share on other sites

Dale ?!

where are you ? :):think:

You should show considerably more patience than that. This is not a real-time tech support board...

:lmao:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

There are no DOM functions to help with this as reaching outside the DOM is considered a security risk.

It will take code similar to __IEControlGetObjFromHWND to do this, but I have nothing for you. I have searched for this in the past and actually found some code in C capable of this, but didn't have the time of gumption to convert it. I looked for a pointer to this, but did not find it. Sorry, don't have a quick answer for you.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

P.S. I reread your question and realize I misunderstood it - you have the hwnd of the container window, but you are trying to get a reference to an embedded COM object? Have you tried modifying __IEControlGetObjFromHWND to suit your needs? First step would be to change the call to ControlGetHandle to look for the specific control you want (you may need to leave off the .1 version string)... then take out the code specific to IE.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

P.S. I reread your question and realize I misunderstood it - you have the hwnd of the container window, but you are trying to get a reference to an embedded COM object? Have you tried modifying __IEControlGetObjFromHWND to suit your needs? First step would be to change the call to ControlGetHandle to look for the specific control you want (you may need to leave off the .1 version string)... then take out the code specific to IE.

Dale

Remedy is a help desk ticket workflow application (we have it where I work). I don't think the OP wants anything from the IE instances themselves. The Remedy app has an embedded IE control in it. He wants to somehow use that to get a COM object reference to the parent instance of Remedy.

$oRemedy = ObjGet("Remedy.User.1") would work except for that fact that he has multiple instances of Remedy running, and no good way to get the object reference to a particular one.

...at least, that's what I thought was going on.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

So Remedy is included in an HTML page? Is it an activeX control? A JavaApplet? Flash? How is it embedded?

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

So Remedy is included in an HTML page? Is it an activeX control? A JavaApplet? Flash? How is it embedded?

Dale

I think it's the other way around. An instance of IE is embedded inside some of the Remedy app windows. He want to use the embedded IE to get a reference to the COM interface of the parent Remedy app instance.

But Uling should be stepping in here and verifying that for himself.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

OK, if this is the case, my initial reply was on the money - not much help, but on the money.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0