Select the product you need help with
ΠΛΗΡΟΦΟΡΙΕΣ: Πρόσβαση στο μοντέλο αντικειμένου από μέσα σε ένα στοιχείο ελέγχου ActiveXΑναγν. άρθρου: 172763 - Δείτε τα προϊόντα στα οποία αναφέρεται το συγκεκριμένο άρθρο. Σε αυτήν τη σελίδαΠερίληψηΌταν συντάσσετε ένα στοιχείο ελέγχου ActiveX για το Internet, συχνά μπορεί να χρειαστεί να αποκτήσετε πρόσβαση στο μοντέλο αντικειμένου της σελίδας HTML. Το μοντέλο αντικειμένου επιτρέπει την πρόσβαση σε διάφορα στοιχεία μέσα στη σελίδα HTML. Αυτό το άρθρο ασχολείται με την πρόσβαση στο μοντέλο αντικειμένου από τη Visual C++ και Visual Basic και καλύπτει και Internet Explorer (IE) 3.x και 4.0. Περισσότερες πληροφορίεςΤΟ ΜΟΝΤΈΛΟ ΑΝΤΙΚΕΙΜΈΝΟΥΜπορείτε να βρείτε στην τεκμηρίωση για το μοντέλο αντικειμένου του κιτ ανάπτυξης λογισμικού ActiveX (SDK) και του SDK του προγράμματος-πελάτη Internet για τον Internet Explorer 3.x και 4.0, αντίστοιχα. Το μοντέλο αντικειμένου τεκμηριώνεται ως εξής:
window
- location
- frames
- ...
- document
- links
- forms
- elements
ΓΙΑΤΊ ΠΡΈΠΕΙ ΝΑ ΧΡΕΙΆΖΕΤΑΙ ΈΝΑ ΣΤΟΙΧΕΊΟ ΕΛΈΓΧΟΥ ΓΙΑ ΝΑ ΑΠΟΚΤΉΣΕΤΕ ΠΡΌΣΒΑΣΗ ΣΤΟ ΜΟΝΤΈΛΟ ΑΝΤΙΚΕΙΜΈΝΟΥ;Ένα στοιχείο ελέγχου πρόσβασης (και σε ορισμένες περιπτώσεις τροποποίηση) πληροφορίες σχετικά με τη σελίδα που ενσωματώνεται στο. Για να το κάνετε αυτό, το στοιχείο ελέγχου πρέπει να έχει πρόσβαση στο μοντέλο αντικειμένου. Για παράδειγμα, ένα στοιχείο ελέγχου μπορεί να απαριθμήσει όλα τα στοιχεία σε μια σελίδα. Στην περίπτωση της δυναμικής HTML, το στοιχείο ελέγχου πρόσβαση σε οποιοδήποτε στοιχείο HTML της σελίδας.ΚΑΤΆ ΤΗΝ ΠΡΌΣΒΑΣΗ ΣΤΟ ΜΟΝΤΈΛΟ ΑΝΤΙΚΕΙΜΈΝΟΥThe object model is implemented using automation and COM interfaces. Once the control is able to access the top level of the object model, then it can drill down the object model using automation or COM interfaces. This article discusses both steps:
GETTING TO THE TOP LEVEL OF THE OBJECT MODEL (VISUAL C++)Using IWebBrowserApp (for Internet Explorer 3.x and 4.x)IWebBrowserApp is an interface that is exposed by the Web Browser control. It has a document property (or get_document method if using vtable interface) that allows access to the automation object of the active document. If the document is an HTML document, then the automation object has a script property that gives the window object of the scripting object model. So, for a control to reach the object model, the following must be done:
Obtaining the IWebBrowserAppGetting the IWebBrowserApp is a two-step process:
Get the Document Property of IWebBrowserAppIWebBrowserApp is a dual interface. It has a document property and also a get_Document method. Either can be used to get the IDispatch of the active document. Once you have the IDispatch, then the script property can be obtained.Get the Script Property of the DocumentUsing the IDispatch obtained above, get the script property using automation. This will give the top level in the scripting object model, or the window object.GETTING THE TOP LEVEL OF THE OBJECT MODEL (VISUAL C++)(Internet Explorer 4.0 ONLY)Internet Explorer 4.0 makes accessing the object model much easier. This is a one-step process:
Obtaining IHTMLDocument2 from IOleClientSiteEvery control has access to IClientSite of its container. QI-ing for IHTMLDocument2 from the client site should give the scripting object model.Getting IHTMLDocument2 gives the document object in the scripting object model. Then either automation interfaces or vtable interfaces can be used to drill down the object model. GETTING THE TOP LEVEL OF OBJECT MODEL (VISUAL BASIC)The parent property of the UserControl can be used to access the automation object. From the Visual Basic documentation for the parent property, Internet Explorer returns an object whose Script property returns the IOmWindow object.The example given in Visual Basic documentation is as follows: The above line of code should read as follows: DRILLING DOWN THE OBJECT MODELDrilling down the object model is as simple as calling the properties and methods using automation. For Internet Explorer 3.x, use only automation. For Internet Explorer 4.0, vtable interfaces can be used. For more information refer to the driller sample in the Internet Client SDK.ΙδιότητεςΑναγν. άρθρου: 172763 - Τελευταία αναθεώρηση: Σάββατο, 18 Δεκεμβρίου 2010 - Αναθεώρηση: 2.0
Μηχανικά μεταφρασμένο ΣΗΜΑΝΤΙΚΟ: Αυτό το άρθρο είναι προϊόν λογισμικού μηχανικής μετάφρασης της Microsoft και όχι ανθρώπινης μετάφρασης. Η Microsoft σάς προσφέρει άρθρα που είναι προϊόντα ανθρώπινης αλλά και μηχανικής μετάφρασης έτσι ώστε να έχετε πρόσβαση σε όλα τα άρθρα της Γνωσιακής Βάσης μας στη δική σας γλώσσα. Ωστόσο, ένα άρθρο που έχει προκύψει από μηχανική μετάφραση δεν είναι πάντα άριστης ποιότητας. Ενδέχεται να περιέχει λεξιλογικά, συντακτικά ή γραμματικά λάθη, όπως ακριβώς τα λάθη που θα έκανε ένας μη φυσικός ομιλητής επιχειρώντας να μιλήσει τη γλώσσα σας. Η Microsoft δεν φέρει καμία ευθύνη για τυχόν ανακρίβειες, σφάλματα ή ζημίες που προκύψουν λόγω τυχόν παρερμηνειών στη μετάφραση του περιεχομένου ή χρήσης του από τους πελάτες της. Επίσης, η Microsoft πραγματοποιεί συχνά ενημερώσεις στο λογισμικό μηχανικής μετάφρασης. Η αγγλική έκδοση αυτού του άρθρου είναι η ακόλουθη:172763
(http://support.microsoft.com/kb/172763/en-us/
)
| Μεταφράσεις άρθρων |




Επιστροφή στην αρχή








