main development tab window, 261–263
main() function
passing arguments to, 102–103
starting Managed C++ programs with, 35
MainArgs.exe file, 103
MainMenu class, 501
MaintAuthors detached database project
passing data
inserting, updating, and deleting dataset rows, 805–806
returning dataset, 804–805
Web service version of, 807–811
Managed C++, 33–102, 169–226
assembly referencing, 192–194
class library, 266–283
adding constructors, member methods, and properties, 274–277
adding manually, 277–280
classes added with wizards, 269–272
compiling projects, 282–283
member variable added by wizard, 273–274
placing project in empty solution, 266–268
saving templates in toolbox, 280–281
updating Class View, 281–282
updating Library Linker File, 268–269
comments, 75–76
creating application, 283–290
creating DeckPlayer project, 283–288
referencing assembly for compilation, 288–290
delegates, 213–219
combining and removing from multicast chain, 216
creating, 214
creating method to be delegated, 214–215
defined, 213
invoking, 216–219 .NET Framework supported forms of, 213
placing method on, 215–216
events, 219–226
building event receiver classes, 222–223
building event source class, 220–221
implementing, 223–226
overview, 219
exceptions, 194–212
ApplicationException, 200
basic coding for, 195–197
catching multiple exceptions, 205–208
catching previously uncaught, 208–210
executing code regardless of, 210–212
nested try blocks and rethrowing, 203–205
.NET Framework, 197–198
overview, 194–195
SystemException, 198–200
throwing ApplicationExceptions, 201–203
flow control constructs, 85–89
if statement, 85–87
switch statement, 87–89
functions, 94–103
function overloading, 100–101
general format of, 94–95
passing arguments to, 95–97, 102–103
prototypes, 100
returning values from, 97–100
"Hello, World!"
codebehind in, 730–731
program in, 33–35
literals, 68–75
Boolean, 71
character, 71–73
numeric, 68–70
string, 74–75
looping constructs, 89–94
breaking out of loops, 94
do-while loop, 90–91
for loop, 91–93
skipping loop iterations, 93
while loop, 89–90
multifile libraries, 177–192
building assemblies from, 182–192
header files, 178–179
namespaces, 180–181
overview, 177–178
source files, 179
namespaces, 67–68
object-oriented, 105–168
abstract classes, 162–165
applying objects to software development, 108–109
class declarations and object instantiation, 119–124
declaring managed classes and structs, 110–119
encapsulation, 106
inheritance, 107
interfaces, 165–168
member methods, 126–145
member properties, 145–156
member variables, 124–125
nested classes, 156–160
overview, 105
polymorphism, 107
type casting between classes, 160–162
operators, 76–85
address of and indirection, 83–84
arithmetic, 76–77
assignment, 81–83
bitwise, 79–80
comma, 81
comparison and logical, 77–78
conditional, 80–81
preprocessor directives, 169–177
conditional directives, 172–175
define directive, 171–172
function of, 169–170
include directive, 175
listing of, 170
using directive, 176–177
statements, 36
type conversions, 65–66
type modifiers and qualifiers, 63–65
auto, 63
const, 64
extern, 64
static, 65
user-defined data types, 53–68
boxing and unboxing, 62–63
reference types, 57–62
value types, 53–55
variable scope, 66–67
variables, 36–53
C++ reserved keywords, 38–39
declaring, 37–38
predefined data types, 39–53
managed class constructors, 129–130
managed code
advantages of, 5
targeted for CLR, 15
managed data, 15
managed operator overloading, 140–145
managed providers, 623
manipulating I/O, 350–364
class hierarchy for, 350
FileStream, 352–355
MemoryStreams, 355–358
overview, 350
streams for, 351–352
using BinaryReader and BinaryWriter classes, 361–364
using StreamReaders and StreamWriter classes, 358–361
mantissa, 69
ManyHeadings.aspx file, 779
ManyHeadings.aspx.h file, 779, 780–781
Math class, 230
member methods, 126–145
destructors, 132–134
managed class constructors, 129–130
managed operator overloading, 140–145
method overloading, 138–139
overview, 126–127
static, 128–129
static class constructors, 131
virtual methods, 134–138
about, 134–136
method overriding, 138
pure, 137
sealed, 137
member properties, 145–156
array properties, 151–152
indexed properties, 153–156
scalar properties, 145–149
static properties, 149–150
member variables, 124–125
static, 125
syntax for, 124–125
members. See also member methods; member properties; member variables
Color, 569
of Image class, 580–581
Point and PointF, 548
PrintDocument, 602
private, public, and protected access modifiers, 110–113
Rectangle and RectangleF, 551–552
referencing .NET Framework class, 863–865
Region, 556
Size/SizeF, 550
MemoryStream.exe file, 357–358
MenuItem class, properties, 501–502
menus, 501–513
creating with MainMenu and MenuItem classes, 501–502
inheritance from Menu class, 501
radio-checked context, 509–513
sample listings
elaborate, 505–508
simple, 502–504
metadata
assembly, 8–10
examining, 858–865
getting metadata out of Type reference, 860–865
getting Type reference, 859–860
"Is" properties, 862
metadata retrieval methods, 861
reflection and, 17
type, 9
method overloading, 138–139
method overriding, 138
method signature, 785, 786
MethodEx.exe file, 127
MethodInfo::Invoke() method, 866
methods. See also virtual methods
for accessing status of CheckedListBox, 438–439
adding to Managed C++ class library, 274–277
ComboBox control, 433–434
creating delegated, 214–215
destinations for Move() and MoveTo(), 344
double buffer, 595–599
of event keyword, 220, 221
File and FileInfo Open, 347–350
FileSystemInfo class, 337
for getting Type reference, 859–860
Graphics class, 538–539
Dispose(), 539
Interlocked class, 841–843
MemoryStream, 355
metadata retrieval, 861
for Monitor class, 845
overloaded methods of Open, 347–350
Path class, 339
placing on delegates, 215–216
reflection with static, 866
RichTextBox control, 420
StreamReader class, 358–359
StreamWriter class, 359
TextBoxBase, 413–414
Thread class, 819–820
Timer component, 444
unbuffer, 593–595
unique ListView control, 451
XmlDocument class, 692–693
XmlTextWriter class, 679–680
XPathNavigator, 704–705
MFC (Microsoft Foundation Classes), 373–374
Microsoft
about .NET initiative, 1–2
origins of GDI+, 528
root namespace, 229
Microsoft Foundation Classes (MFC), 373–374
Microsoft intermediate language (MSIL), 11–12
MightyLabel example, 394
MinuteTimer.exe file, 447
modes
ListBox control, 426–427
ListBox of all XML monster file, 708
View property, 450
Monitor class for thread synchronization, 843–847
Monster file sample listings
adding new Monster to DOM tree, 700–703
creating goblin, 680–683
invalid Monsters.xml, 676–677
ListBox of all XML, 708
Monsters.dtd file, 673
Monsters.xml file, 675–676
Monsters.xsd file, 674–675
New_Monster.xml file, 686
splitting into nodes, 668–672
updating Monster DOM tree, 697–699
updating XML, 684–686
XML, 662–663
MonthCalendar controls, 489–492
properties of, 489–490
sample listing for, 490–492
MonthCalendar.exe file, 492
MouseDown event, 384
MouseEventHandler event, 384–385
Move() and MoveTo() methods, 344
MSDE 2000 database server, 610
MSIL (Microsoft intermediate language), 11–12
multicast chaining
combining and removing delegates from, 216
defined, 213
multicultural applications
building console application, 913–917
building Windows application, 909–913
MultiCulturalApp.exe file, 913
MulticulturalDates.exe file, 908
MultiException.exe file, 208
multifile libraries, 177–192
building assemblies
new assembly method, 188–192
traditional methods of, 182–188
header files, 178–179
namespaces, 180–181
overview, 177–178
source files, 179
multiline comments, 75–76
multiple catch blocks, 205–208
multiple platform support, 20
multithreaded programming, 813–856
.NET Framework class library threading, 815–816
overview, 813–815
synchronization, 837–855
about, 837–838
Interlocked class, 841–843
Monitor class, 843–847
Mutex class, 847–851
ReadWriterLock class, 852–855
ThreadStatic attribute, 838–841
ThreadPools, 834–837
how they work, 834–835
using, 836
threads, 819–834
aborting, 826–829
getting to sleep, 823–826
interrupting, suspending, and resuming, 831–834
joining, 829–831
starting threads, 820–823
thread execution states, 816–818
thread priorities, 818–819
Mutex class for synchronization, 847–851
MyDialog class file, 517–519