Visual Basic 6 Black Book:OLE
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Chapter 26OLE
If you need an immediate solution to:
Adding An OLE Control To A Form
Creating And Embedding An OLE Object At Design Time
Linking Or Embedding An Existing Document At Design Time
Autosizing An OLE Control
Determining How An Object Is Displayed In An OLE Container Control
Using The OLE Controls Pop-Up Menus At Design Time
Inserting An OLE Object Into An OLE Control At Runtime
Deactivating OLE Objects
Using Paste Special To Insert A Selected Part Of A Document Into An OLE Control
How To Activate The OLE Objects In Your Program
Activating OLE Objects With A Pop-Up Menu That Lists All OLE Verbs
Activating OLE Objects From Code
Is An Object Linked Or Embedded?
Handling Multiple OLE Objects
Using OLE Control Arrays To Handle Multiple OLE Objects
Loading New OLE Controls At Runtime
Dragging OLE Objects In A Form
Deleting OLE Objects
Copying And Pasting OLE Objects With The Clipboard
Zooming OLE Objects
Saving And Retrieving Embedded Objects Data
Handling OLE Object Updated Events
Disabling In-Place Editing
In Depth
For obvious reasons, Object Linking and Embedding (OLE) is a very popular programming topic. Using OLE you can give the users of your program direct access to OLE server programs like Microsoft Word or Excel. In fact, you can integrate all kinds of programs together using OLE, giving your program the power of database, spreadsheet, word processor, and even graphics programs all wrapped into one.
Visual Basic lets you do this with the OLE control. This control can display OLE objects, and those objects appear as mini-versions of the programs connected to them. For example, if you display an Excel spreadsheet in an OLE control, the control displays what looks like a small version of Excel right there in your program. The program that creates the object displayed in the OLE control is an OLE server, and your program, which displays the OLE object, is called an OLE container. In fact, the proper name for the OLE control is the OLE container control.
You can use the OLE object in the OLE control just as you would in the program that created it; for example, you can work with an Excel spreadsheet in an OLE control just as if it was open in Excel itself. How does that work? There are two primary ways of working with the OLE objects in an OLE control: opening them and editing them in place.
When you open them, the OLE server application is launched in its own window and the OLE object appears in that application. When you want to save your changes to the OLE object in the OLE control, you use the servers Update item in the File menu.
When you edit an OLE object in place, the server application is not launched in its own window; instead, the object becomes active in the OLE control itself and may be edited directly. The OLE container programs menu system is taken over by the OLE serverand you may be startled to see Microsoft Words or Excels menu system in your programs menu bar. To close an OLE object that is open for in-place editing, you click the form outside the object.
As an example, the Microsoft Excel spreadsheet in Figure 26.1 is open for in-place editing.
Figure 26.1 Opening an Excel spreadsheet in an OLE control for in-place editing.
When the OLE object in an OLE control is closed, it appears in its inactive state, as shown in Figure 26.2.
Figure 26.2 An inactive OLE object.
OLE actions are called verbs; for example, opening an OLE object is accomplished with the VbOLEOpen verb, and editing it in place is accomplished with the VbOLEInPlaceActivate verb. Well see how to handle OLE verbs in this chapter when we use the OLE controls DoVerb method.
What other methods does the OLE control support? Those methods and what they do appear in Table 26.1. You can also use the OLE controls Action method to invoke the methods in Table 26.1, and the values for this property also appear in Table 26.1. When you use the Action property, the control often uses other properties of the control, such as the SourceDoc property, to find the data it needs to perform the requested operation. Note, however, that the Action property is considered obsolete, and well use the OLE methods instead.
Table 26.1 OLE methods.
Method
Action Value
Meaning
CreateEmbed
0
Creates embedded object
CreateLink
1
Creates linked object from the contents of a file
Copy
4
Copies the object to the system Clipboard
Paste
5
Copies data from the system Clipboard to an OLE container control
Update
6
Retrieves the current data from the application that supplied the object and displays that data as a picture in the OLE container control
DoVerb
7
Opens an object for an operation, such as editing
Close
9
Closes an object and terminates the connection to the application that provided the object
Delete
10
Deletes the specified object and frees the memory associated with it
SaveToFile
11
Saves an object to a data file
ReadFromFile
12
Loads an object that was saved to a data file
InsertObjDlg
14
Displays the Insert Object dialog box
PasteSpecialDlg
15
Displays the Paste Special dialog box
FetchVerbs
17
Updates the list of verbs an object supports
SaveToOle1File
18
Saves an object to the OLE version 1 file format
The term Object Linking and Embedding implies two ways of inserting objects into an OLE controlthrough linking and embedding such objects. How do those operations differ?
Linking Vs. Embedding
Whats the difference between linking and embedding OLE objects in the OLE control? The main difference has to do with where the objects data (such as the data in a spreadsheet) is stored. Data associated with a linked object is manipulated by the OLE server application that created it and is stored outside an OLE container control. Data associated with an embedded object is contained in an OLE container control, and that data can be saved with your Visual Basic application.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
898 06898 12898 26898 900898 25898 04898 13Zasadnicze wymagania dla prostych zbiorników ciśnieniowych 03 98 898898 24demo cgi 895898 07898 08więcej podobnych podstron