08 02 A3JMQ5YVXNYJYJRV5UQUW6LD4ML2B4DUC4JF7WI




Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!:ActiveX Components
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 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6! (Publisher: The Coriolis Group) Author(s): Peter G. Aitken ISBN: 1576102815 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




Click on the OK button to close the Project Properties dialog box. Next, use the Properties window to set the class properties. Only two of the properties concern us for this project; the settings and an explanation of each follow:


•  Instancing MultiUse—This setting permits other clients (outside the project) to create instances of the class, with multiple instances (if requested) supplied by a single running copy of the server. The other possible settings of this property set different restrictions on the class, but these do not concern us at present.
•  Name AXDEMO—You can use any descriptive name here. This property is used to identify the class. It is displayed in other applications’ Object Browser dialog boxes and is used in code (as we’ll see later) to create an instance of the class.

Once the class module’s properties are set, we can add the declarations of the variables that will be the class’s properties. You accomplish this in the General Declarations section of the class module. Here’s the code:



Option Explicit
Private pObjName As Variant
Private pDateCreated As Date
Private pNumber As Double
Private pSquareRoot As Double
Private pCubeRoot As Double


The Option Explicit statement should already be present, placed there automatically by Visual Basic. If not, you need to select Options from the Tools menu; on the Editor tab, turn on the Require Variable Declarations option. Lacking the Option Explicit statement in a module, Visual Basic does not require variables to be declared—a definite invitation to errors.
If you examine these variable declarations, you’ll see that all of them are Private, meaning they are not accessible outside the ActiveX server. They can be used for purely internal uses by the class, or they can be exposed to clients as properties (for reading, writing, or both) by means of property procedures. When you expose a variable with a property procedure, it becomes one of the object’s properties that can be accessed by clients.
We need to take a short detour from the demonstration project to explore property procedures. First, however, save the project. I used the default names suggested by Visual Basic: MyTestAXDLL for the project and AXDEMO for the class module (class modules are automatically given the .CLS extension).
Property Procedures
You had an introduction to property procedures in Chapter 6; now the time has come to learn more. Property procedures are a central part of ActiveX server programming. While you may be able to create very simple servers without using property procedures, you’ll find them essential for most of your projects. You can use a property procedure to create standard read/write properties that can be both read and set by clients. These procedures also permit you to create read-only properties, perform some action when the property is read or set, or assign a Help topic to the property.

Property procedures come in three varieties. Property Get and Property Let are usually used in tandem, permitting the client to read and set, respectively, the value of a property in the ActiveX object. Property Set is used in place of Property Let when the property in question contains a reference to an object. Because the demonstration server does not use object reference properties, I’ll limit the discussion to Property Get and Property Let.
Let’s assume we want the object to hav

Wyszukiwarka

Podobne podstrony:
SERWIS 2010 08 02
08 02 KPGO Prognoza ooś
MegaDance Vol 18 (08 02 2015) Tracklista
pdm? 2016 08 02
08 02
Pisemny egzamin pa pilota wycieczek 08 02 2007
08 02
08 02 Remonty i usuwanie usterek
technik elektryk11[08] o3 02 n
TI 02 05 08 T pl(1)
TI 99 02 08 T B M pl(1)

więcej podobnych podstron