(Paperback - BK&CD ROM)
In order to create scalable, distributed objects with Visual Basic, a programmer must understand the underlying architecture and complexities of Microsoft's Component Object Model (COM)-information that until now has been primarily available in resources aimed at the C++ programmer. Programming Distributed Applications With Com And Microsoft(r) Visual Basic(r) 6.0, teaches COM fundamentals in language Visual Basic programmers understand, and explains how to exploit the significant COM-based capabilities in Visual Basic 6.0. Businesses that can leverage existing VB proficiency to develop business objects in the middle tier can realize tremendous gains in their enterprise development strategy.
This is an advanced programming and application development guide for building N-tier business objects for distributed solutions. Author Ted Pattison guides you through COM/DCOM and shows you how to create distributed applications using Visual Basic 6.0 instead of C++. The author introduces the Microsoft Transaction Server (MTS) and Microsoft Message Queue (MSMQ) and ties everything together with the Common Object Model (COM).
More Reviews and RecommendationsTed Pattison, formerly with Microsoft, now works as a trainer for DevelopMentor - a premier developer-training company. As a consultant, Ted has implemented multitier client/server applications for such clients as Hughes Aircraft, Southern California Edison, and the American Automobile Association. He is a contributor to Microsoft Systems Journal, Microsoft Interactive Developer, and Visual Basic Programmer's Journal.
Reader Rating:
See Detailed Ratings
March 02, 2001: This book is not for the newbie. You must have a solid understanding of VB. That given, this book is the ABSOLUTE BEST I have read regardless of the topic. It is clear & concise. Ted's writing style makes you feel as if he is talking with you. So far, every time a question has popped into my head it's like he read my mind and addresses that question within the next few sentences. Every page is filled with a revelation regarding the innerworkings of COM. The author took the time to learn COM from C/C programmers and rewrite it for VB programmers to understand, I am looking forward to future books by Ted Pattison.
Reader Rating:
See Detailed Ratings
February 26, 2001: I FELT SORRY FOR MYSELF FOR WASTING TIME WITH THIS BOOK. THE MORE I READ THE MORE THE BOOK CONFUSED ME.
This reference speaks to the huge base of Visual Basic developers who, until now, could only learn about COM by reading books written for C++ programmers. Now they can get up to speed quickly and participate in Microsoft's strategy for distributed computing. The Foreword is by Don Box, the industry guru for COM technology.
Loading...Page numbers in italics refer to figures or tables.
A
Abort method, 210, 211, 215
abstract base classes, 45-46
access permissions, 272
ACID rules
defined, 202
in distributed transactions, 209
usage overview, 203-6
Activate method, 190
activation, COM
local vs. remote, 163
out-of-process, 73-74, 78, 84
overview, 56-58
in server packages, 182-83
Active Server Pages (ASP)
architecture of, 283-86
built-in objects, 284, 289-91
creating, 283-84
creating Visual Basic objects from, 286-92
defined, 283
and IIS Application Designer, 17, 18, 292-93
running applications, 285, 286
running MTS transactions from, 286, 287
transactional support, 288-89
ActiveX components, in MSMQ, 242, 246
ActiveX Data Objects (ADO), 207, 224, 286
ActiveX DLLs
vs. ActiveX EXEs, 78, 79
apartment-threaded, 147-48
building, in Visual Basic, 81-85
debugging, 196-99
and global variables, 152
in MTS environment, 180, 182, 185-89, 195-96
MTS transaction support, 212-13
when to use, 78, 79
ActiveX EXEs
vs. ActiveX DLLs, 78, 79
building, in Visual Basic, 81-85
and global variables, 152
multithreaded, 148-50
and secondary threads, 153, 154-55
and thread pooling, 150
when to use, 78-79
ActiveX vs. COM, 6
activities, MTS, 191-93
activity threading, 155-56
AddRef method, 62, 63, 64
administration queues, 266
apartments. See also threads
creating, 145-46, 148, 149-50, 154
and global variables, 151-52
in MTS, 191-93
multithreaded (MTA) model, 142-44
overview, 141-42
single-threaded (STA) model, 142-45
apartment-threaded model, 142. See also single-threaded apartment (STA) model
AppIDs
configuring, 169-70, 173, 272
in MTS, 183, 184, 273
applications. See also distributed applications; transactional applications
monolithic development vs. COM, 3-4
using interfaces in design, 38-39
Web-based, 283-93
AppServer class, 186
architecture, two-tier vs. N-tier, 7-13, 177. See also three-tier architecture; two-tier architecture
array data type, 119-20
Arrived event, 252
ASP. See Active Server Pages (ASP)
ASP type library, 289-90, 290
asynchronous communication, and Microsoft Message Queue, 16-17, 235
asynchronous method calls, 155, 155
atomic transaction requirement, OLTP, 202, 203
authentication, 167
automation, 65-70, 93, 131
B
backup site controllers (BSCs), 239, 241
BeginTransaction method, ITransactionDispenser interface, 210, 215
BeginTransaction method, MSMQTransactionDispenser object, 261
bidirectional communication, 128-35
Binary Compatibility mode, 91, 92, 195, 196
binary reuse
as basis for COM, 2, 4
and C++, 43-44
and DLLs, 2, 4
and object-oriented programming, 43
and Windows operating system, 43
binding
early, 68-69
late, 66-67, 68
and RPC, 161
types of, 68-69
vTable, 69
black-box reuse, 28, 29
built-in ASP objects, 284, 289-91
business objects, 10-12, 11, 12
ByRef parameter, 118, 123-24
Byte arrays, 253-54
ByVal parameter, 118, 123, 124
C
C and C++ programming languages. See also Visual C++
and abstract base classes, 45-46
and binary reuse, 43-44
and class factories, 59
and COM, 5
and custom marshaling, 73
developing eventing service, 294-95
and distributed transactions, 210-11
and dynamic binding, 46-47
friend methods, 97
and GUIDs, 55
vs. Interface Definition Language, 49-50
and IUnknown interface, 63
limitations for component-based development, 43-45
memory allocation, 62
and multithreading, 144, 145
naming interfaces, 114-15
and remote activation, 174
and special data types, 123
and threads, 139
vs. Visual Basic, 3, 54, 55
callback interfaces, 131-34, 174
calling context, 188-89
CanBePooled method, 191
Caption property, 246
CICS, 207
circular references, 64
class-based references, 20-21, 22
classes
and implementation inheritance, 23
implementing interfaces, 29-30
installing in MTS server packages, 182
vs. interfaces, 31
persistable, 258-60
and public interfaces, 21-22
selecting type of COM server for, 77-80
setting procedure attributes, 96-97
superclasses vs. subclasses, 23
and threads, 146
Web classes, 292-93, 292
class factories, 58-59
class identifiers (CLSIDs), 55-56, 73, 84, 85, 90, 91, 146, 163, 165, 173, 174, 182, 183
class modules, 30, 31, 32-33, 94
Close method, 244
CLSIDs. See class identifiers (CLSIDs)
coclasses, defined, 47-48
CoCreateGUID function, 55
CoInitializeEx function, 147
collection objects, 124
COM. See Component Object Model (COM)
COM+
eventing service, 295
load balancing service, 297
middleware features, 298
queued components feature, 296-97
role of MTS, 299-300
threading in, 155-56
and Windows NT Server, 14
COM activation. See activation, COM; remote activation
COM applications, defined, 169
COM DLLs, 77. See also ActiveX DLLs
COM exceptions, 101-4
COM EXEs, 77. See also ActiveX EXEs
COM library, 54, 55
Commit method, 210, 211
committed transactions, 203
COM objects
activating, 56-58
built-in ASP objects as, 290
overview, 61
compatibility, component versions
levels of, 87
and MTS, 195
project settings, 89-91
Component Object Model (COM). See also COM+
vs. ActiveX, 6
architectural requirements, 42
and binary reuse, 2, 4
vs. DCOM, 7
declarative vs. programmatic security, 166, 272
error-raising conventions, 104-5
exception handling, 101-4
history of, 41-43
initial design requirements, 43-54
and interface-based programming, 5-6
interface-based programming as basis, 38-39
and Interface Definition Language (IDL), 49, 110-12
interprocess capability, 3, 42, 115-23
and language independence, 48
mapping to Visual Basic, 51-53
vs. monolithic application development, 3-4
and MTS, 195
vs. OLE, 6, 42-43
and out-of-process communications, 4-5
overview, 1-3
relationship to object-oriented programming, 2-3, 42, 107
and remote method calls, 4-5, 5, 6
role of interfaces, 34
and RPC, 160-64
threading models, 142-45
and Visual Basic, 3
and Web-based applications, 283
COM security, 166, 272-74
COM servers
ActiveX DLLs vs. ActiveX EXEs, 79
component packaging, 77-80
and component versioning, 86-93
creating, 81-85, 93
in-process vs. out-of-process, 77-79
registering, 83-84
and Windows Registry, 82-83
COM Specification, 47-48
concurrency, 140-41
connected networks (CNs), 239
connection pooling, 224-26
consistency transaction requirement, OLTP, 202, 203, 214
constants, enumerating, 95
container applications, 79, 80
Contents property, 256
context, calling, 188-89
context wrappers, 185, 185, 189, 216, 216, 217-18
coordinating transaction manager (CTM), 208-9, 208. See also Distributed Transaction Coordinator (DTC)
CorrelationID message property, 248
CreateInstance method, 193, 214, 220, 287
Create method, 243
CreateObject function, 85, 153, 173, 189, 193-94
CreatePropertyGroup method, 280-81
CreateProperty method, 281-82
CreateThread function, 146-47
custom callback interfaces, 131-34
custom marshaling, 73, 124-26
cyclic deadlocks, 228
D
DACL. See discretionary access control list (DACL)
database management systems (DBMSs)
and distributed transactions, 211
and lock management, 204-6
making connections, 223-28
and online transaction processing, 202, 206, 207
and two-tier architecture, 8-9, 10, 177
data types, primitive, 119-23
DBMS. See database management systems (DBMSs)
DCOM. See Distributed COM (DCOM)
Dcomcnfg.exe file
Applications tab, 169
Default Properties tab, 167, 167-69
defined, 165
Identity tab, 171-72, 171
Location tab, 173, 174
Security tab, 170, 170
Deactivate method, 190
dead letter queues, 265-66
deadlocks, 228-30
debugging MTS components
using MsgBox statement, 196, 197
using Windows NT event log, 196, 197
in Visual Basic, 196, 198-99
in Visual C++, 196, 197
declarative security, 166, 272, 273-74
declarative transactions, 15, 212. See also MTS transactions
Delivery message property, 247-48
DisableCommit method, 217-18, 221, 222
discretionary access control list (DACL), 166
distributed applications
client-side configuration, 173-74
creating middleware for, 293-300
designing, 271-300
load balancing across servers, 17, 236-37, 236, 297-98
queue listener application, 295-97, 296
role of message queues, 234-38, 234
and RPC, 162-64
scalable notification system, 293-95
server-side configuration, 165-72
Web-based, 283-93
Distributed COM (DCOM). See also distributed applications
configuring, 165, 167-72
and firewalls, 175
initial release pros and cons, 175
overview, 7
and RPC, 162-64
distributed computing. See also distributed applications; Distributed COM (DCOM)
and Microsoft Message Queue, 16-17
and Microsoft Transaction Server, 15, 16
need for application scalability, 16-17
and object-oriented programming, 3
and Windows NT Server, 14-18
Distributed Computing Environment (DCE), and RPC, 160
Distributed Transaction Coordinator (DTC)
enlisting connections, 223-224, 223
and MTS, 212-32
overview, 209, 210
writing applications directly against, 210-11
distributed transactions
ACID rules in, 209
and DTC, 210-11
and MTS, 212-32
overview, 207-9
steps in running, 208-9
and transaction managers, 207, 208, 210-11
and two-phase commit protocol, 207, 209, 223, 223
DllHost.exe container application, 79
DLLs. See ActiveX DLLs; dynamic-link libraries (DLLs)
domain controllers, 174
done flag, 216, 216
doomed flag, 216-17, 216
DTC Proxy Core Object, 210
DTC transactions, 215
dual interfaces, 67-68
durability transaction requirement, OLTP, 202, 203
dynamic binding, 26, 46-47
Dynamic Data Exchange (DDE), 42
dynamic-link libraries (DLLs), 2, 4, 78-79. See also ActiveX DLLs
E
EnableCommit method, 218
encapsulation
and C++, 44-45
and COM, 4
and inheritance, 29-30
Encina, 209
enlisted objects, 226
enlisting connections, 223-224, 223
enumerations, 95-96
error handling, 101-5
events, MSMQ, 250-52
events, Visual Basic
building scalable application, 293-95, 294
using, 129-31
exporting packages, 183-84
extending interfaces, 37, 114-15
external transactions, MSMQ, 260, 263-64
F
facility codes, 99-101
factoring interfaces, 112-14
factory pattern, 58
firewalls, using DCOM across, 175
flags, internal, 216, 216
FormatName property, 245-46
form-based applications, multithreading in, 153-55
free-threaded model, 142. See also multithreaded apartment (MTA) model
friend methods, 97
G
"garbage collection," 164
GetObjectContext method, 186, 186, 187, 189, 195
GetOriginalCallerName method, 278
global classes, 94-95
global data, sharing across MTS objects, 279-83
globally unique identifiers (GUIDs), 55-56, 90-91, 183
GlobalMultiUse classes, 94, 95
GlobalSingleUse classes, 94
global variables, and apartment threading, 151-52
GUIDs. See globally unique identifiers (GUIDs)
H
happy flag, 216, 216, 217-18
HRESULTs, 98-101
HTML files. See Active Server Pages (ASP)
HTML templates, 292
I
IDE. See Integrated Development Environment (IDE)
IDispatch interface
vs. IUnknown interface, 111-12
overview, 66-67
and Visual Basic events, 131
vs. vTable binding, 131
IDL. See Interface Definition Language (IDL)
ID message property, 248
IID forwarding, 88-89
IIDs. See interface identifiers (IIDs)
IIS. See Internet Information Server (IIS)
IIS Application Designer (IISAD), 17, 292-93
IIS In-Process Applications, 285
IMarshal interface, 124
impersonation, 168-69
implementation inheritance
and code reuse, 23-25
and COM, 4
hierarchies, 24-25, 25
Java example, 23-24
overview, 23, 24
and polymorphism, 25-26, 26
problems with, 27-28
and Visual Basic, 20
when to use, 24, 27
and white-box reuse, 27, 28
inheritance, interface, 29-30, 112-13
inheritance hierarchies, 24-25, 25. See also implementation inheritance
Initialize procedure, 189
InitProperties method, 258
in-process servers, 77, 78, 84
installing Microsoft Message Queue (MSMQ), 240-41
Instancing settings, 94
Integrated Development Environment (IDE), 53, 55, 78, 90, 91, 109-10
interactive users, 172
interface-based programming, 5-6, 19-20
Interface Definition Language (IDL)
benefits of using, 50
defining interfaces in, 110-12
overview, 48-49
and RPC, 160
and Visual Basic, 49, 53-54, 110-12, 114-15
interface identifiers (IIDs), 55-56, 90, 91, 92, 182
interface inheritance, 29-30, 112-13
interfaces
as basis for COM, 38-39
benefits of using, 34-36
vs. classes, 31
and code reuse, 20
and COM, 5-6, 19
custom callback, 131-34
as data type, 5-6, 28
defined, 28
defining in separate type libraries, 109-10
defining properties in, 32
design decisions, 108-15
dual, 67-68
extending, 37, 114-15
factoring, 112-14
and GUIDs, 55-56
hidden, 51
IUnknown vs. IDispatch, 111-12
logical names for, 114-15
multiple, 35-36, 64, 65
outbound, 128-35
and proxy/stub pairs, 71
role in COM, 34
RPC, 160-61
separating from implementation, 28-37
setting procedure attributes, 96-97
user-defined, 20, 37, 38-39, 69-70, 108-15
using, 33-39
version-compatible, 87, 88-89
version-identical, 87
and Visual Basic, 20, 30-32, 51-54, 68, 69, 113-14
writing in IDL, 53-54, 110-12
internal transactions, MSMQ, 260-63
Internet Information Server (IIS), 17, 18, 283, 284-85, 290
IPersistStorage interface, 258, 259
IPersistStream interface, 258, 259
IsCallerInRole method, 277-78
isolation levels, 205-6, 228
isolation transaction requirement, OLTP, 202, 204-6
ISupportErrorInfo interface, 101-2
ITransactionDispenser interface, 210, 215
ITransaction interface, 210, 211, 215
IUnknown interface
AddRef method, 62, 63, 64
vs. IDispatch interface, 111-12
overview, 61-65
QueryInterface method, 64-65
Release method, 62, 63, 64
J
Java, 2, 23-24, 48
journal queues, 264-65
L
late binding, 66-67, 68
launch permissions, 272
legacy DLLs, 79-80
library packages, 180, 275, 278
lifetime management, 62-64
load balancing, 17, 236-37, 236, 297-98
location transparency, 5, 71, 74-75, 115
locking
conflicts in, 228-30
levels of granularity, 204
overview, 204
in property groups, 281
read locks, 204-5, 229
shared locks, 204-5
update locks, 229-30
write locks, 204-5, 228, 229
lock management, 204-6
M
marshaler, universal, 72, 82, 115, 116, 120-21, 123-24, 125
marshaling
custom, 73, 124-26
defined, 71, 72
and remote interfaces, 115, 116, 117-18, 120-21, 121, 122, 123
standard, 72
using smart proxy objects, 126-28
and Visual Basic, 72, 124-26
memory, 62, 279-83
message bodies
defined, 246
passing parameterized information, 252-60
passing VBA strings, 246-52
and persistent objects, 258-60
and PropertyBag objects, 256-57
role of Byte arrays, 252-54
and string parsing, 254-56
message headers, 246
message queues. See queues
messages. See also message bodies; queues
priority levels, 246-47
properties of, 246-48
queue listener application, 295-97, 296
reading and removing, 248-50
receiving, 248-49
sending, 246-47
transactional, 260-64
viewing without removing, 250
methods
changing implementations, 92
and HRESULTs, 98-101
implementing subset of, 112
marking as friends, 97
out-of-process calls, 72, 115, 116, 116
return values, 98-101
round-trip calls, 115-17
setting attributes, 96-97
Microsoft Distributed Transaction Coordinator. See Distributed Transaction Coordinator (DTC)
Microsoft IDL compiler, 110, 161-62
Microsoft Message Queue (MSMQ)
ActiveX components, 242
creating private queues, 245-46
creating public queues, 242-45
and Distributed Transaction Coordinator (DTC), 209
installing, 240-41
internal vs. external transactions, 260-64
MSMQ events, 250-52
overview, 16-17, 238-40
programming MSMQ objects, 242-60
sending messages, 246-47
transactional messages in, 260-64
Microsoft SQL Server. See SQL Server
Microsoft Transaction Server (MTS). See also MTS components
in COM+, 299-300
concurrency model, 191-94
as container application, 178-79
and declarative transactions, 212-32
as development environment, 195-96
and Distributed Transaction Coordinator (DTC), 209
and distributed transactions, 207, 209, 210
and DTC, 212-32
mtx.exe container application, 80
and N-tier architecture, 177-78
overview, 15, 16, 177-78
security model, 272-78
and stateless programming, 230-32
Windows NT requirements, 194-95
middle-tier. See middleware
middleware, 293-300
MIDL compiler, 110, 161-62
MQSeries, 233
MsgBox statement, 154, 196, 197
MSMQCoordinatedTransactionDispenser component, 263
MSMQ enterprises, 238-39
MSMQEvent object, 251-52
MSMQ events, 250-52
MSMQ Explorer, 240-41, 242, 247
MSMQ Information Store (MQIS), 239, 240, 241
MSMQMessage object, 246
MSMQQuery object, 243-44
MSMQQueueInfo object, 242, 243, 244
MSMQQueue object, 244, 248, 250, 251-52
MSMQ routing servers, 239
MSMQ sites, 239
MSMQTransactionDispenser object, 261
MSMQTransaction object, 261
MS-RPC, 161-62
MTS. See Microsoft Transaction Server (MTS)
MTS applications
enlisting connections, 223-224, 223
resource dispensers for, 224-25, 279-83
secured, 274-76
and stateless programming, 230-32
MTS components. See also MTS objects
and activation, 182-83
creating, in Visual Basic, 180-82, 189
debugging, 196-99
defined, 179
server packages vs. library packages, 179-80
transaction support settings, 212-13, 212, 213, 214
MTS Executive
creating objects inside transactions, 213-15
defined, 180
overview, 184-85
MTS Explorer, 180, 181, 182, 183-84, 195, 196, 212
MTS objects. See also MTS transactions
connection pooling, 224-26
creating, 189, 190, 193-94, 213-15
enlisted, 226
life cycle of, 189-91
propagating into existing activities, 192-93
root, 214, 215, 216-17, 221-22, 225
secondary, 220-22, 226
sharing global data across, 279-83
MTS programmatic security, 272, 276-78
MTS resource dispensers, 224-25, 279-83
MTS roles, 273-76
MTS run time. See MTS Executive
MTS server packages. See server packages
MTS transactions
ASP scripting objects in, 288-89
business logic vs. data access code, 226-28
completing vs. aborting, 216-18, 216
connecting objects to resource manager, 223-224, 223
creating objects inside, 212-14
vs. DTC transactions, 215
internal flags, 216, 216
as logical transactions, 215
multiobject, 220-22
running from ASP pages, 286, 287-88
secondary objects, 220-22
sending and receiving messages in, 263-64
MTSTTransactionMode property, 212-13, 213
mtxas.dll file, 185
mtxex.dll file, 80, 180, 274
mtx.exe file, 80, 178-79, 274
mtxspm.dll file, 279
multiobject MTS transactions, 220-22
multiple interfaces, 35-36, 64, 65
multithreaded apartment (MTA) model, 142-44
multithreading. See also apartments
and concurrency, 140-41
and data synchronization, 140-41, 279
in form-based applications, 153-55
and global data sharing, 279-83
and Visual Basic, 146-52
when to use, 137-38, 156-57
MultiUse classes
adding to ActiveX DLLs, 179, 180, 182
and ObjectControl interface, 190
overview, 94-95
vs. user-defined interfaces, 108
N
Nelson, Mike, 175
New operator, 57, 84, 153, 189, 193-94
No Compatibility mode, 90
notification systems, scalable, 293-95
N-tier architecture. See also three-tier architecture
and Microsoft Transaction Server, 177-78
overview, 13, 13
and RPC, 162-64
O
Object Browser, 186, 290, 290
ObjectContext interface, 187-89, 276-77, 278, 287
ObjectControl interface, 189-90
Object data type, 67
object-oriented programming (OOP)
and binary reuse, 43
and distributed computing, 3
implementation inheritance feature, 23-28
polymorphism feature, 25-26, 26
relationship to COM, 2-3, 42, 107
and RPC, 161
object pooling, 190
objects. See also MTS objects; root objects
activation overview, 56-58
and bidirectional communication, 128-35
calling context, 188-89
circular references to, 64
class factories, 58-59
extending, 37, 86-87, 92, 114-15
in-process vs. out-of-process, 115-23
lifetime management, 62-63
and outbound interfaces, 128-35
persistent, 258-60
public interfaces, 21, 22
stateless, 230-32
ODBC Driver Manager, 223, 224-25
ODBC drivers, 211, 224
OLE32.DLL file, 54, 57
OLE automation, 65. See also automation
OLE Transactions protocol, 209, 223
OleView utility, 50, 50, 111
OLE vs. COM, 6, 42-43
OLTP. See online transaction processing (OLTP)
online transaction processing (OLTP)
ACID rules, 202, 203-6
concurrency vs. isolation, 228-30
distributed transactions, 207-11
overview, 202-7
role of MTS, 15, 207
simple transactions, 206-7
transaction requirements, 202
Web-based, 17, 18
Open method, 244
Open Software Foundation (OSF), 160
Oracle, 8, 202, 204, 211, 223
outbound interfaces, 128-35
out-of-process activation, 73-74, 78, 84
out-of-process method calls, 72, 115, 116, 116
out-of-process servers, 77, 78-79, 80, 83-84, 165
P
packages
creating, 181-82
exporting, 183-84
server packages vs. library packages, 179-80
viewing list in My Computer, 180-81
packaging components, 77-80
.pak files, 183
parsing strings, 254-56
participating transaction manager (PTM), 208, 208, 209. See also Distributed Transaction Coordinator (DTC)
PathName property, 242, 243, 245
PeekCurrent method, 250
peeking, defined, 234
Peek method, 250
PeekNext method, 250
persistable classes, 258-60
persistent objects, 258-60
ping algorithm, 164
plug-compatible objects, 26
polymorphism, 4, 6, 25-26, 26, 35
pooling ODBC connections, 224-26
primary enterprise controllers (PECs), 239, 240, 241
primary site controllers (PSCs), 239, 240, 241
primary thread, defined, 139
primitive data types, 119-23
private queues, 245-46
Procedure Attributes dialog box, 96-97
Procedure IDs, 97
processes, defined, 138
ProgIDs, 85
programmatic security, 166, 272, 276-78
programming, interface-based, 5-6. See also object-oriented programming (OOP)
programming languages. See also C and C++ programming languages; Visual Basic
and COM, 2, 48
and implementation inheritance, 23-24, 27
and polymorphism, 25-26
Project Compatibility mode, 90
Project Properties dialog box, 89-91
properties
in property groups, 279, 281-82
setting attributes, 96-97
shared, 279, 281-82
PropertyBag objects, 256-57, 258
property groups, 279, 280-81
protected properties, 27
proxy objects, 70-71, 71, 72, 126-28
proxy/stub pairs
and out-of-process objects, 115
overview, 70-71
and Registry, 82
responsibilities of, 72
public interfaces, 21, 22
PublicNotCreatable class module, 52-53
public queues, 242-45
Q
QueryInterface method, 64-65
queued components, 296-97
queues. See also Microsoft Message Queue (MSMQ)
administration, 266
creating, 242-45
dead letter, 265-66
journal, 264-65
listener application, 295-97, 296
overview, 234-38
private, 245-46
public, 242-45
response, 266-69
vs. RPC, 235-38
transactional, 237-38, 237, 260-64
types of, 264-69
R
Read Committed isolation level, 205, 206
reader applications, 234
read locks, 204-5, 229
ReadProperties method, 258, 259
ReadProperty method, 257
Read Uncommitted isolation level, 205, 206
ReceiveCurrent method, 250
Receive method, 248, 249, 250
receiver applications, 234, 234
refreshing Registry, 196
registering COM servers, 83-84
Registry. See also AppIDs
and COM servers, 82-83
and GUIDs, 55
refreshing, 196
Release method, 62, 63, 64
remote activation
and client-side configuration, 173-74
vs. local activation, 163
overview, 163-64
and Service Control Manager (SCM), 163-64
remote method calls, 4-5, 5, 6, 72
remote objects, binding, 73-74
Remote Procedure Call (RPC)
background, 160-62
and COM, 160-64
and HRESULTS, 98-101
importance of, 162, 163
limitations of, 161, 235-37
vs. message queues, 235-38
MS-RPC, 161-62
and object-oriented programming, 161
standard, 7, 160, 161-62
Remote Server Name property, 184
Repeatable Read isolation level, 205, 206
resource dispensers
ODBC Driver Manager as, 224-25
Shared Property Manager as, 279-83
resource managers (RMs), 207, 208, 208, 211, 223-224, 223
response queues, 266-69
roles, MTS, 273-76
root objects. See also secondary objects
and connection pooling, 225
defined, 214
how they work, 215
in multiobject transactions, 220-22
role in MTS transactions, 216-17
round-trip method calls, 115-17
routing servers, 239
RPC. See Remote Procedure Call (RPC)
run-time environment, 80
S
SafeRef method, 186, 186, 187
scalability, application, 16-17
scalable eventing architecture, 293-95, 294
SCM. See Service Control Manager (SCM)
ScriptingContext interface, 289, 290-91
secondary objects, 220-22, 225, 226
secondary threads, 153, 154-55, 154
secured MTS applications, 274-76
security
authentication levels, 167-69
configuring DCOM, 167-69
declarative vs. programmatic, 166, 272
impersonation levels, 168-69
MTS model, 272-78
programmatic, 166, 272, 276-78
Security property, 278
sender applications, 234, 234
Send method, 246, 249
Serializable isolation level, 206, 228
Server object, 286
server packages
activation in, 182-83
creating, 181-82
vs. library packages, 180
MTS roles in, 274-76
overview, 179-80
and security checking, 276
testing, 195-96
servers. See also COM servers
load balancing across, 17, 236-37, 236, 297-98
for MSMQ, 239-40
Service Control Manager (SCM)
and class factories, 58-59
and MTS objects, 182
and object activation, 57-58, 73-74, 78, 84, 85
overview of COM activation, 57-58
and remote activation, 163-64
SetAbort method, 218-19, 220, 221, 222
SetComplete method, 218-19, 220, 221, 222
shared locks, 204-5
shared properties
in COM+, 283
creating, 281-82
creating groups, 280-81
reading and writing to, 282
setting default value, 282
Shared Property Manager (SPM), 279-83
sharing MTS objects, 279-83
single-threaded apartment (STA) model, 142-45, 279
SingleUse classes, 94
smart proxy objects, 126-28
software. See applications
source journaling, 264-65
SPM. See Shared Property Manager (SPM)
SQL Server
and deadlocks, 229-30
and MSMQ enterprises, 239
and transaction processing, 202, 204, 206, 209, 211, 223, 224
and two-tier architecture, 8, 9
SQLSetConnectAttr function, 211
standard marshaling, 72. See also marshaling
stateless programming, 230-32
stored procedures, 8-9, 9
string data type, 119
string parsing, 254-56
structured query language (SQL), 8, 9
stub objects, 70-71, 71, 72
superclasses, 23
surrogate processes, 79-80
synchronization, data, 140-41, 279
T
target journaling, 264-65
Terminate procedure, 189
testing in MTS environment, 195-96
ThreadingModel attribute, 146, 147
thread pooling, 150, 191
threads. See also apartments; multithreading
and ActiveX DLLs, 147-48
and ActiveX EXEs, 148-50, 153, 154-55
and COM+, 155-56
and concurrency, 140-41
and data synchronization, 140-41, 279
and global variables, 151-52
in MTS, 191-93, 279, 282
overview, 138-46, 139
primary, 139
secondary, 153, 154-55, 154
thread-per-object vs. thread pool, 150
user-interface, 139
three-tier architecture
costs and benefits, 13-14
defined, 13
middle-tier services, 293-300
vs. N-tier architecture, 13, 177
and RPC, 162-64
TOP END, 209
transactional applications
and DTC, 209-11
overview, 207, 208
steps in running transactions, 208-9
writing code directly against DTC, 210-11
transactional ASP pages, 288-89
transactional messages, 237-38, 237, 260-64
transactional queues
creating, 260
external transactions, 260, 263-64
internal transactions, 260-63
transaction managers (TMs), 207, 208. See also coordinating transaction manager (CTM); Distributed Transaction Coordinator (DTC); participating transaction manager (PTM)
transaction processing. See online transaction processing (OLTP)
transactions. See also declarative transactions; Microsoft Transaction Server (MTS); MTS transactions; online transaction processing (OLTP)
ACID rules for, 202, 203-6
atomic requirement, 202, 203
committed, 203
consistency requirement, 202, 203, 214
and data item lock management, 204-6
defined, 202
distributed, 207-11
durability requirement, 202, 203
isolation levels, 205-6
isolation requirement, 202, 204-6
logical vs. physical, 215
programming, 206-7
serializable, 206
simple, 206-7
Transaction Server type library, 185-87
Transact-SQL, 206, 207
TUXEDO, 207, 209
two-phase commit protocol, 207, 209, 223, 224
two-tier architecture
adding layer, 10-12, 11, 12
limitations of, 9-10
vs. N-tier architecture, 7-14, 177
overview, 8
and stored procedures, 8-9, 9
when to use, 9
type libraries
defining interfaces in, 109-10
and enumerations, 95-96
and IDL, 50
interface definitions in, 53
Transaction Server, 185-87
and Visual Basic, 49, 50, 81-82
TypeOf keyword, 64-65
U
UDT. See user-defined data type (UDT)
universally unique identifiers (UUIDs), 55
universal marshaler, 72, 82, 115, 116, 120-21, 123-24, 125
update locks, 229-30
updating Registry, 196
user accounts, 171-72
user-defined data type (UDT), 120-23, 125
user-defined interfaces
and automation, 69-70
and declarative security, 274
defining in IDL, 110-12
defining in separate type libraries, 109-10
vs. MultiUse classes, 108
overview, 37, 38-39
user-interface threads, 139
UUIDs. See universally unique identifiers (UUIDs)
V
variant data type, 120, 126
VBS array data type, 119-20
VBScript, 283-84, 287-88, 291
VBS string data type, 119
versioning components
automation clients, 93
binary, 86-88
levels of compatibility, 87
and MTS, 195
overview, 86
project compatibility settings, 89-91
vs. starting from scratch, 93
Visual Basic. See also VBScript
ActiveX DLLs, 78
ActiveX EXEs, 78-79
and automation, 65
calling built-in ASP objects from, 289-91
vs. C and C++, 3, 54, 55
and class factories, 58-59
COM capabilities, 3
creating MTS components, 180-82, 189
creating objects from ASP pages, 286-87
debugging MTS components, 196, 198-99
error-handling model, 101, 102-4
and GUIDs, 55-56
and IDL, 49, 53-54, 110-12
and IIS Application Designer, 17
and implementation inheritance, 23
integrated development environment, 53, 55, 78, 90, 91
and interfaces, 20, 30-32, 51-54, 68, 69, 113-14
and IUnknown interface, 62, 63
and lifetime management, 63-64
mapping COM exceptions, 102-4
mapping to COM, 51-53
and marshaling, 72, 124-26
and multithreading, 144, 146-52
naming conventions, 30
Object Browser, 186, 290, 290
persistable classes in, 258-60
Procedure Attributes dialog box, 96-97
and RPC, 162
and threads, 139
and type libraries, 49, 50, 81-82
using events, 129-31, 293, 294
version differences, 52-53
wizard bar, 32-33, 33
Visual C++, using to debug MTS applications, 196, 197
vTables
and custom callback interfaces, 134
defined, 47
and dual interfaces, 67-68, 68
and dynamic binding, 47, 47, 69
and IDispatch interface, 66, 66, 86-88, 131
and IUnknown interface, 61, 62
W
WAM. See Web application manager (WAM)
Web application manager (WAM), 284, 285
Web-based applications, 283-93
Web classes, 292-93, 292
Web servers, 17, 18, 283
white-box reuse, 27, 28, 29
Win32 API, 43
Win32 threading overview, 139-46
Windows NT
and COM security, 166, 167-69
debugging applications with event log, 196, 197
and distributed development, 14-18
integration between IIS and MS, 284-85
security model, 166, 272, 273
Service Packs for, 260
setup for MTS, 194-95
user accounts, 171-72
WithEvents keyword, 130, 131
worker threading, 155-56
write locks, 204-5, 228, 229
WriteProperties method, 258, 259
WriteProperty method, 256
X
X/Open standard, 209
Take a moment to consider the following questions. What is your perception of Visual
Component-based development solves many of the problems associated with
Software development for the Windows operating system has always been based on
COM was built from the ground up to be object-oriented. It's based on clients,
After a client connects to an object, it simply invokes method calls as in any other
If code reuse in COM were limited to in-process DLLs, clients would have no way to
Notice that the client code and the object code are actually running in different processes
As you'll see, COM not only takes care of many grungy plumbing details in an
The concept of interface-based programming wasn't a clever new idea thought of by
An interface, like a class, is a distinct data type. it defines a set of public methods
Interfaces are also the key to COM's ability to send remote method calls across host
Today it's safe to say that COM is more significant than OLE, although it's equally
It's not just the marketing people who have contributed to the confusion in the
loading...
loading...
loading...
Terms of Use, Copyright, and Privacy Policy
© 1997-2009 Barnesandnoble.com llc
