How can you find the "owner" of an Object (originating from an in process server)?
Suppose you have an object within your VB application. Perhaps it's a cell from Excel, perhaps it's a DOM element from IE. Sadly, you've forgotten where (or, rather, from which in process server) it came from, but now you have a need to determine the original instance (that it came from). Frankly, you'd be happy knowing anything about where it came from (hWnd, processID, etc.) because then you could loop over all instances to find yours.
This information has got to exist because (1) If you kill the original app, your object is now defunct and (2) In order to interact with the object, it's got to know what code to execute.
So that the question isn't too abstract, I describe my specific situation: I have a DOM element from IE (5.5 on Win 2K Pro). No problem, you say, why not do:
Set Wnds = CreateObject("Shell.Application")
Set myBod = myDomElem.document.parentWindow.top.document.body
For each oWnd in Wnds.windows
If TypeName(oWin.document) = "HTMLDocument" Then
If oWin.document.body Is myBod Then
Set CIE = oWnd
Well, yes, that works nicely except for my situation where myDomElem is actually a DOM element of an IFrame's document. In this case, the Set myBod = ... dies because .top forbids ("access is denied") access to .document, but that is a topic for a separate post.
The fact that I'm pursing such an esoteric path means that (1) I've investigated all the easier methods - but don't be shy about suggesting them anyway - may as well collect them in one place, and (2) I'm mad at this problem. Things like .top and .frameElement have no excuse to be failing when called via VB on the user's machine.
I'm thinking there must be some WinAPI that will help. Something like RtlMoveMemory? Or ObjPtr?