Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Learn four approaches for automating Excel logic, along with advantages and disadvantages of each. Read all about it in the free whitepaper: “Tapping into Excel Logic from Java: Four Server-Based AlternativesDownload Now!
  #1  
Old June 7th, 2003, 02:40 PM
csaba csaba is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: NYC
Posts: 79 csaba User rank is Private First Class (20 - 50 Reputation Level)csaba User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
[Advanced] Owner of object

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:
Code:
Function CIE(myDomElem)
    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
            Exit Function
        End If
    End If
Next


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.

Thanks,
Csaba Gabor

I'm thinking there must be some WinAPI that will help. Something like RtlMoveMemory? Or ObjPtr?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > [Advanced] Owner of object


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway