.
..
, ,
.
. .
.
..
Brian Johnson
Craig Skibo
Marc Young
Inside
Microsoft
VISUAL STUDIO
.NET
Microsoft Press
Microsoft'
VIUAL TUDI
.NET 2003
2003
004.43
32.973-26-018
53
Microsoft Corporation
53
,
Microsoft Corporation, 2003
, Microsoft Corporation,
2003
<
, - , 2003
XII
Microsoft Press
XIII
XIII
XIV
XIV
XV
XV
XV
2
3
5
5
7
7
7
8
8
8
16
19
19
19
20
21
21
22
22
24
24
26
27
31
31
32
40
45
46
47
VI
48
48
49
51
56
78
78
79
81
82
85
86
86
88
90
91
94
94
95
97
59
59
62
64
65
66
68
69
71
72
73
75
76
77
II
99
100
100
101
102
107
109
111
111
..111
VII
112
120
121
Basic
Basic -
Basic Visual Studio .NET
IDTExtensibUity2
EnvDTE
OnConnection
OnStartupComplete
OnAddlnsUpdate
OnBeginShutdown
OnDisconnection
CommandPreload PreloadAddinScate
LoadBehavior ComrnandLineSafe
SatelliteDLLPath SatelliteDLIAame
FriendlyName Description
AboutBoxDetails AboutBoxIcon
7
?
devenv /setup
121
122
123
125
127
127
128
130
130
131
133
133
137
137
138
138
140
142
144
144
146
147
147
148
149
150
151
151
153
154
155
156
156
157
158
1
161
161
162
15
168
169
173
VIII
8
,
,
VSProject
Visual Studio .NET
Miscellaneous Files
Solution Items
IDE
9 Visual Studio .NET
174
174
175
17
177
182
184
184
187
189
189
195
195
197
197
198
200
200
207
210
212
213
214
214
214
215
.-
218
.vsz-
219
221
222
223
224
, .... 227
227
228
229
231
234
235
WizardBuilder
236
237
10
Windows
Object
238
238
238
241
.. 241
- UIHierarchy
UIHierarchy
UIHierarchy
UIHierarchylterns
UIHierarchyTtem
Toolbox
Toolbox
Task List
Taskltem
Task List
Output
Output
(Designer-Host
Selection
Options
11
Window
TextWindow HTMLWindow
TextPane
Document
TexcDocument
TextPoint
VirtualPoint
EditPoim
TextSelection
TextSelection EditPoint
.
IX
243
243
244
246
246
247
247
248
251
251
252
256
257
259
262
262
264
264
264
265
266
266
267
270
273
273
274
274
278
281
282
282
283
284
285
288
289
292
292
293
293
295
296
297
298
299
299
302
LineChanged
LineChanged
12
CodeEIement
304
308
309
310
310
310
321
322
322
326
III
327
13
328
328
329
330
334
339
342
348
353
357
358
364
365
Command Window
Dynamic Help
XML Help Provider
365
366
367
368
369
370
371
372
376
381
383
384
384
384
388
390
390
.. 390
FileCodeModel CodeModel
CodeElement
Add-
Add-
XI
390
393
398
398
399
400
400
400
404
406
419
419
420
423
42
428
06
441
.
. , ,
. , .
. , ,
, , . , , . , , ,
, .
Web- , .
.
:
Microsoft Visual Studio .NET.
, , .
, , ,
. , , . Big Bang ,
.
2000 ( ) Microsoft
Visual Studio .NET .
, , Windows- Web-
. , ,
, . , : Inside
Visual Studio .NET.
, ,
. , - , Visual Studio .NET.
,
Visual Studio .NET, (IDE) .
IDE.
2002 .
Visual Studio .NET. ,
, , .
, , , , .
, API ,
. ,
.
, , ,
.
, , , ,
. Microsoft Visual
Studio .NET 2003. , .
, Visual Studio .NET 2003 , IDE
, , , Visual Studio .NET 2003 .NET
Framework .
,
Visual Studio .NET. , Visual Studio .NET 2003,
Visual Studio ,NET 2002.
, , -
XIV
.
Visual Studio .NET, . IDE, , ,
, . IDE,
, , .
Visual
Studio .NET. API ,
, , Visual Studio .NET, Visual Studio .NET,
.
,
. , Visual
Studio .NET 2003 Microsoft Visua, SourceSafe.
,
12.
Web: http://www.microsoft.com/
mspre$$/books/6425.a$p. Companion Content More Information . .
Visual Studio .NET.
Program Files\Microsoft Visual Studio ,NET 2003\ Cornmon7\IDE\PubHcAssemblies,
My Documents\Microsoft Press\InsideVSNET,
Visual Studio .NET 2003- , Add Or Remove Programs ( ) Control
Panel ( ). Web- , .
Visual Studio .NET 2003, , Visual Studio .NET 2002.
Visual Studio .NET 2002
, -
XV
. ,
.
, Visual Studio .NET
2003. Visual Studio .NET 2003 Professional Edition, ,
, . Visual C# .NET,
Visual Basic .NET Visual C++ ,NET, , ,
, , ,
.
brianjjo@botmail.com.
,
, .
http://groups.msn.com/insidevsnet/. Microsoft Press (. ).
Visual Studio .NET,
,
Microsoft: news:// msnews.microsoft.com. Visual Studio .NET
microsoftpubiic.v$net. , , ,
Yahoo: http://grottps.yaboo.com/group/vsnetaeieiin/. .
Microsoft Press
, ,
. Microsoft Press World Wide Web no :
http://www.microsoft.com/mspress/support/
Microsoft Press, :
http://www.microsoft.com/mspress/support/search.asp
, , ,
, , Microsoft Press
:
Microsoft Press
Attri: Inside Microsoft Visual Studio .NET 2003 Editor
One Microsoft Way
Redmond, WA 98052-6399
:
MSPINPUT@MICROSOFT.COM
, , . Microsoft Visual
Studio .NET 2003 . http://msdn.microsoft.com/vstudio/
1
Visual Studio .NET
Microsoft . Visual
Studio .NET, 2002 , .
.NET Microsoft Web- XML, 2002 }'. Visual
Studio .NET 2003 .NET.
Microsoft .NET Server 2003-
1.1 .NET Framework.
.NET Visual Studio .NET .
(IDE). , ,
Visual Studio ,NET .
Windows- Windows- .
,
.NET, Web- XML. .
Visual Studio, 1998 .,
. , (Visual C++, Visual Basic, Visual InterDev Visual J++),
. Visual Studio : Win32, MFC, COM, ActiveX, Active Template Library
(ATL), Java. DirectX Web. - Windows, Visual Studio 6. Visual Studio 6
Visual Studio .NET , Microsoft C/C++ Visual
C++ 1.0. , MS DOS Windows. Web- XML , , .NET Visual Studio .NET.
, .NET
Visual Studio .NET .
.NET
- MS DOS , Windows
3.1, , : ,
, ,
, MS DOS. .NET, , .NET
, Windows MS-DOS.
.NET Framework . ,
, .
(common language runtime, CLR), , , . , CLR, .NET Framework. . 1-1 ,
CLR .NET Framework.
/' .
CIR
. 1-1. NET Framework CLR
NET Framework
.Visual Basic JffiT
Visual C++ .NET
MSIL
JIT-
MSIL
H MSIL
. 1-2. NET
,
Visual C++, , Visual Studio
.NET , . , IDE, . .
Visual C++ .NET, C++ Visual Studio .NET, ++ , .
7.1 . Microsoft Visual C++ .NET 17 12 , IDE .NET
.
: /GL
/GL .
, , , .
, /GL,
. .
(inline) ,
.
Microsoft, , . ,
/GL
. ,
. , .
,
, . /(75 ,
.
. cookie
. , cookie .
, .
,
.
_set_security_errar_bandler.
Writing Secure
Code1 , , : Visual
Studio .NET . ,
, 7 , , . ,
, Visual Studio
.NET, .
: /
,
. /RTCn , (/RTCs), (/RTCs) , ,
(/RTCc).
/GS,
.
/RTCn /,
. /RTCn Visual Studio .NET.
, .
Xoeapd .. . . : , 2003. . .
IDE Visual
Studio .NET (Property Pages),
Solution Explorer: ,
, Properties.
. 2.
Visual C/C++ .NET . Microsoft Visual Studio .NET , . Windows.
Microsoft , . .NET Framework,
API Windows-,
, Visual Studio .NET, , Visual Studio .NET, . .
7. MFC 7, Windows XP,
Windows 2000 ATL 7. DHTML,
MFC-. , , ATL MFC , CSfring,
ATL- MFC. MFC.
ATL ATL. ATL- Web- ISAPI,
Web- XML. ATI-
Web- XML ATL .NET-.
, ,
Standard Template Library (STL) - (CRT).
C++
C++ C++ (Interface Definition Language, IDL),
, , ATL,
, >
.
Visual C++ ANSI/
ISO C++. Visual C++ .NET 2003 C++
98%.
(IDE)
.NET , . Visual Studio .NET , . Windows, Web-, .NET.
-, Visual Studio .NET IDE ,
Visual Studio 6.
IDE. , , Visual
Studio .NET .
-, , Visual Studio .NET, CLR.
Visual Basic .NET Visual 0# CLR. Visual C++
CLR,
Windows. , .NET, MSIL, , CLR
, : Visual C# Visual
Basic .NET. CLR , CLR- . , , . .NET , ,
- , .
, , Visual Studio .NET ,
IDE .
IDE
. API
IDE, , Visual Studio.
,
IDE Visual Studio ,NET .
IDE , .
Web- . IDE, : Solution Explorer,
Class View, Properties . , IDE (. 1-3).
API , Visual Studio .NET, , F. IDE. API -
Visual Studio .NET
My Profile (. 1-4). ,
, . My Profile IDE.
, Visual Studio
Visual Studio .NET. .NET Visual Studio 6, , ,
Visual Studio .NET Visual Studio Developer,
. , , .
10
. 1-4-
Visual Studio NET
IDE.
Visual Basic Visual InterDev .
C++ Visual C++ 6, , ,
, . , Visual Studio Developer Alt+7
Ctrl+Alt+D. ,
IDE , , , (Keyboard Scheme). . 3-
:
Visual Studio .NET, API , |
(Macros IDE). 4,
. Alt+Fl 1, IDE .
Project Explorer, IDE .
, , - IrtsideVSNET, Samples.
AutoHideToggle, , - :
Visual Studio .NET, WiridQwAutdtiideAll Visual Studio .NET.
, . WinetawAutolJnbideAB."
Reset
11
Sub AutoKideToggleO
:
ER With
Snd Stib
, ( ,
).
( Apply). 4 ,
, . 3 .
Help Filter , Visual Studio .NET . ++, MFC ATL,
, ,
. -
12
Filtered By Search, ,
My Profile. 14 , .
My Profile Visual Studio .NET
. At Startup Show Start Page (no ),
IDE Get Started , . :
, , IDE,
.
( ) IDE, . IDE
, , Command . Visual Studio .NET , .
13
erances
ussemblylnfo.vb
Wizard, vb
WiiardFrm.vb
. 1-5-
Solution Explorer
(I ThumbWizard
+: *!* ThumbnailWi;ard
;-, *!* WinWapper
:
'- * Base; and [nherfaces
Gf HandK) As SysCem.lp
appkaCionObject
+ -** WcardFrm
CpdCity
0,0
100%
WghtToWt
No
Show] nT a sto
Fake
Minimum5ize
502, 390
Auto
SnapToGrid
i StartPosiBon
True
CenlerParent
;Tag.
Thumbnail Wizard
Tart
The text contained J
. 1-7. Properties
, it
Server Explorer (Ctrl+Alt+S)
Server Explorer
. , , . ,
. . 1-8 Server Explorer ; ,
Visual Studio .NET, .
.
Toolbox (Ctrl+Alt+X)
15
Server Explorer
Data Connections
Servers
, brianjoSlQO
Event Logs
&t Message Queues
Performance Counters
B]|g Services
?ij SQL Servers
master
model
msdb
Northwhd
^t tempiih
briarqoSSO
(3 Event Logs
S? Message Queues
[3 Performance Counters
*jjij| Services
Q| SQLServer;
Enfibrer I
Data
Windows For ITS
lit ftoiriter'
A
Label
UnH.abel
ffl
Button
jsbi
|j Main-Menu
[7 ChedSox
(* RadioButtcfi
Panel
CheckedListBox
CkobaardRing
. 1-9- Toolbox
Command Window (Ctrl+Alt+A)
16
IDE, ,
Visual Studio
.NET , , Command Window.
Command Window . (Command)
(. 1-10).
(Immediate) , , .
, immed.
,
>cmd.
*> , .
.
tlommand WHiilii
>Pilc.NewFil
Ffc.NewFile
1-10.
Command Window Visual Studio NET
IDE
Macro Explorer (AU+F8)
17
Macro
^ InsideVSNET
3 MyMdcros
'^g Samples
| Dev5tudio6Editor
| mateflddfn
'
nr
| Debugger
| V5Editor
SI Beginning Of Function
i3 Cents-Screen
^BB
tED CountGccurrences
DoFotWholeRle
53 EmacsStylelndentLine
& FillCommentParagraph
FixLineEnds
S InsertDate
insertTirre
Dfer |
18
Tools IDE
, Tools IDE.
.
1. Ctrl+Alt+A, Command "Window, Tools.ExtemalTools, External Tools.
2. Add, ,
IDE Fobier.
3> Command 1....
4- Arguments IDE. (
C:\Program Files\ Microsoft V:sual Studio .NET 20Q3\Cornrnon7\lDE}.
5. .
, Crnd.exe
Visual Studio .NET. . -,
Visual Studio .NET Command Prompt Tools, Microsoft Visual Studio .NET 2003.
Visual Studio .NET Command Prompt
,
.
Visual Smdio vsvars32.bat.
Common7\Tools.
Cmd.exe, , C:\Program
Files\Microsoft Visual Studio .NET 2C03\Common7\Tools .
( : , ,) , , vsvars32,
Visual Studio .NET.
Tools Command.
External Tools: Add,
(Command Prompt) cmd.exe Command. S(ProjectDir) Initial Directory ( ).
, . , ;, .
, , Common7\IDE . C:\Piogram Files\Microsoft Visual Studio .NET 2003\Common7\IDE. Devenv.exe
. vsvars32.bat,
Devenv.exe.
19
Devenv
. ,
.
20
IDE
, , IDE.
. 1-12.
.NET-,
- Visual C++. IDTExtensibility2. Visual C#. , Web,
#, Visual Basic .NET.
Microsoft ,
IDE Visual
Studio .NET. http:// nisdn.microsoft.com/vstudio/
downloads/automation.asp.
, Visual Studio .NET .
5 , .
21
2 Visual Studio .NET,
IDE .
Visual Studio ,NET
.
2
Visual Studio .NET
Visual Studio .NET ,
( ),
. , ,
, ,
, - .
.NET- /.
! Visual Studio .NET . , ,
. ,
,
Visual Studio .NET Solution
Explorer (Ctrl+AIt+L) (. 2-1). Solution Explorer ( ) ,
,
, .
Visual Studio .NET , , , Visual Studio.
23
. 2-1.
,
( , Visual Studio), ,
Visual Studio .NET 2003 Microsoft Visual Basic .NET, Visual
C, Visual J# Visual C++ .NET.
, , ,
.
.
Windows Forms Windows-
, .
Web Forms Visual Studio Projects, My Documents, Web-, Web- ,
. Visual Studio .NET ,
. .
:
. ,
, , , .
Chaptr02, , . Visual C# Windows
Application Sampledl.csproj.
Sampled.sin. ,
SampIeOl,
. . .
24
,
. HTML-, , ,
XML-, . . , Miscellaneous
Files Solution Explorer, Show Miscellaneous Files In Solution
Explorer Documents Environment Options (.
2-2). : Miscellaneous Files, IDE
, , Fue.OpenFile.
, IDE , , , . IDE Miscellaneous Files.
Miscellaneous Files, .
: , Visual Studio .NET,
Miscellaneous Files. -
Environment
General
4- Documents
Dynamic Help
Fonts and Colors
Help
International Setting?
Keyboard
Projects and Solution
Task list
Web Browser
^ Source Control
j Text Editor
03 Analyzer
Q Database Tools
iH) Debugging
ll^j HTML Designer
Settings "
" -use current document window, if saved
Detect when file is changed outside the environment
f Auto-feed chances (if * )' modified inside the
Environment)
s" AiojvwftlngofreacS-Qnlyfiles, wain when attempt to save
i"? f te using directory of currently active document
fjKellaneous rles prefect saves last
stems
Help
26
Solution Property Pages , . , ,
,
, ,
, .
Solution Property Pages (. 2-4) ,
Solution Explorer, Ctrl+Alt+A Project.Properties
Command Window >
Properties.
!?.J Configuration *
CPPWinj.
Ncns
CSWebApp
40T.J
C5*'eb5ervice
Non;
CSWnApp
Hen;
VBWfbApp
Non.'
27
. , ,
.
Common Properties Project Dependencies. ,
. Project Dependencies , , , .
Common Properties
. , , , , . , .NET-, Visual Studio .NET . , , , .
,
, . Debug Release ,
, Configuration Manager, . Solution Property Pages Build
(Buud.ConfigurationManager).
Visual Studio .NET : . . ,
, .
, , .
, , . , , .
(.sin) ,
, , .
. ,
Visual Studio .NET 2002, Microsoft Visual Studio Solution
File, Format Version 1.00, ,
Visual Studio .NET 2003, Microsoft Visual Studio Solution File, Format Version -WO.
infif '' mmrmnrnmi'iTf "i *1*11 ^^ !^
28
.sin , , ,
. ( 2-1).
2-1.
Chapter02.sln
Microsoft Visual Studio Solution File, Format Version 7.00
Projectr{F184BG8F-C81C-45F6-A57F-5A8D9991F28Fr) * "VBWinApp",
"VBtfinAppY/BWinApp.vbproj",
487AFF922-38D5-46lC-AQ78-859080BFCFBFr
EndP reject
Project('4F184B08F-C81C-4SF6-A57F-5ABD9991F28F}") = "VBWebApp",
"http://locainost/VBWebAppABWebApp . vbproj " ,
"{0654F4FC~7144-457A~9D73-A14!)ECDODB40}"
EndP reject
Projeetr4FA04EeO-3G1F-11D3-BF4B-aOC04F79EFBCr) " "CSWinApp",
"C$WinApp\CSWiriApp . cspro j " ,
"{9D585FB1-AA56-4227-A814-23F16E4F07E4}"
Preject("{FAE04ECO-301F-1103-BF4B~OOC04F79EFBC}"> = "CSWebApp",
"http://localhOst/CSWebApp/CSHebApp.CsproJ",
4AB66I)7EB-1>B6F-45EB-AE70-B97;!02AB52F1}"
Project("{8BC9CEB8-8B4A-1!DO-8D11-OQAOC918C942}")
"CPPWif32\OPPWiRa2. vcproj",
"{912ECF9E-5ABA-4E85-8955-2SOCrC464C377}"
End!P reject
Projeot("{E6FOF86B-F3D1-11D4-857e-30Q2A516ECE8}") - "VJConsoleftpp",
" VJConsoleApp\VJConsoleApp . v j s p ro j " ,
-{2022B3FD-6AFB-4912-8687-4BOE257A48A1)"
End Project
Project('4FAE04ECO~301F-1tD3-BI:4B*OOC04F79EFBeK'> "CSWebService",
"http://localhost/CSlebServicfr/CSWeb8ervice,csproj"1
"{22A37BFE-687D-44E6-9COC-711735BC5018}"
EndP reject
Global
GlobaI^ctiort{Solution.Gonfi8uration) - preSolution
ConftgName.O = Debug
ConfigNaffle,2 PostCHD
ConfigNase.3 * PostE^lorer
ConfigNaffle.4 = Release
EndGlobalSeetion
GlobalSection(ProjectBe^entfencies)
postSolution
GlobalSection(ProjectConfiguration) - postSolution
{D7AFF922-38D5~461C-AiS7B-S5908QBFCF8F}.Debug. ActiveCfg = Debug|.NET
{D7AFF922-38D5-461C-AG7B-859G8QBFCFBF}.Debug.Build. 0 = Debug).NET
{D7ftFF922-38D5-46lC-A078-8590BOBFCFBF}.Defeug1.ActlveCfg = Debug|.NET
{U7AFF922-38&5-481C-A07B-859GBQBFCFBF}.Debugl.Build,& ~ Debugl.
{D7AFF922-3805~461CAQ78-85908Q&FCFBFbPostCHu, ActiveCfg * ftelease|.NET
{D7AFF922~38D5-461C-AQ7B-859Q8QBFCFBFbPostGMB. Build.0 = Raima).NET .
{D7AFF922-38D&-46tC-AQ7B-859Q8QBFCFBF}.PostExplorer.ActiveCffl =
Release).NET
iS7AFF922-38D5-461C-A07B-859080BFCFBFbPQstExpaorer.Build. 0 =
Release i- NET
{D7AFF922-38DE-461C-AG7B-85908QBFCF8F}.Release.ActiveCfg *
29
-..'.''
ReJeasel-tET
{07AFF922-38D5-461G-A07B-B59080BFGFBF).Release.Build,0 Release!.SET
{D654F4FC-7144-457A-9D73-A149ECDODB4Q}.Debug.ActiveCfg = Debugt-NET
{DS54F4FC-7144-457A-9D73-A149ECD0084Q}.Debug.Build.Q - Debugl-NET
{D654F4FC-7144-457A-9D73-A149ECDGBB40}.Debu^l.ActiveCfg - Oebug{.
{D654F4FC-7144-457A-9D73-A149ECDODB4QbDebug1.Buiia.O = Defeugl-WET
{D654F4FC-7144-457A-9073-A149ECDOOB40},PostCHD.ActiveCfe Release!.NET
iD654F4FC-7144-457A-9073-A149ECDODB40}.PostCHO.Build,0 = Release|.MET
{D654F4FG-7144-457A-9D73-A149ECD00840>.PDStExplorer,ActiveCfg
Releasel.NET
{D654F4FC-7144~457A-9D73-A149ECDODB40}.PostExplorer.Suilcl.O =
FteleasBl.HET
{D654F4FC-7144-45rA-9D73-A149EGDODB40>.Release.AGtiveCfg = Release|.
{D54F4FC-7144-457A-9D73-A149ECDODB40).Release.Build.0 = Release!.NET
{9B585FB1-AA56-4227-A814-23F16E4F07E4).Debug.ActiveCfg = Debugi,ET
{9D585FBVAA56-4227-A814-23F16E4F07E4bOebug.Build.0 = Debug|.HET
{9&585F81-AA56-4227-AB14-23F16E4F07E4}.Debug1.ActiveCfg * Debugir.HET
{9D585m-AAS6-4227-AB14-23F16E4F07E4}.Debtjg1.Build.0 uebugtl-NET
{90S8SF81~AA56-4227~A814-23F164F07E4}.PostCHO.ActiveCfg = Debugl|-NET
{90585FB1-AA56-4227-A814-23F16E4F07E4}.PostCMD.Build.0 = Debugl[.KET
{9D585FS1-AA56-4227-AB14-23F164FQ7E4>.PostExplorer.ActiveCfg =
Debugl|.
{90S8&F81-AA56-4227-AB14-23FieE4F07E4bPostExplorer.Build.0 *
Debugl|,NET
.J*t
Release\,NET
{AB6607EB-DBSF-45E9-AE7D-B972D2A652F1}.Release.ActiveGfg * Rele.asef.NEl
{AB66D7EB-DB6F~4SE8AE7D-B972D2A652F1}.Release.&uild.0 * Releasej.NET
(912ECF9-5A8A-4E85-8955-2flOBC464C377}.Debug.AetiveCfg * DebugIin32
{912EeF9E-5ABA-4EB5-8955-28SDC464C377bDebu8.Build.0 Debug|Win32
. ^. .
30
{912ECF9E"5ASA~4ES5-8955-2BQDC464C377bDebug1.Actlvefg = DebugJW1R32
^912ECf9E~5ABA-4E85-8955-2BODC464C377}.De^ug1.Bulld.6 = BebugfWin32
{912ECF9E~5ABA-4E85-8955-2Bt}flC464C377}.PostCMD.AetiveCfg =
PostCMD|Win32
{912ECF9E-5A8A-485-8955~2BQDC464C377>.PQSteM0,BLJild.0 = PostC*ffi|Win32
{912ECF9E-5ABA-4E85-8955-2800C484C377}.PostExplorer.AetiveCfg *
PostExplorer|#ifi32
{912ECF9E-5ABA4E85-S955-2BOC3464C377b PostExplorer. Build.t PostExplorer|Win32
(9l2ECF9-5ABA-4E85-8955-2BOD::464e377}, Release, ActiveCfg =
Release|Wtn32
{9129-5~485~8955-201)46437?1. Build. 0 = Release[Win32
{2Q22B3Fa-6AFB-4912-8687-4809:>57A48A1}.Debug.ActiveCfg * Debug|.NET
*2G22B3FD-6AFB-4912~8687-4B00;>57A48A1}.Debug.Buil<j,0 * Oebug|.NET
{2022B3FD-6AFS-49l2-8687-4BQ9;?57A48A1}.Debug1. ActiveCfg =
{2022B3FD-8AfB-4912-8687-4B09;?57A48A1}.Debugl,Build.0
{2022B3FE)-6AFB-4912-86B?-4B0@:157A48A1}, PostCHD, ActlveCf g = Release f. NET
{2Q2283FB-6AFB-4Sl2-8687-4B09;?57A48A1.}.PostCHD. Build.S = Rel&8*e~f .NET
{2022B3FD-6AFB-4912-8687-4B09;!57A48A1}.Postxplorer.ActiveCfp *
Releasej.NET
^2022B3FP-6AFB-49l2-8e87-4B09E!57A48A1}.PostExplorer.Build.0 =
Release[.NET
{2022B3FD-6Af:8-49l2-a687-4B09;'57A48AlbRelease.ActlveCfe = Release! .NET
{2Q2283H3-6AF8-4912-8687-460957A48A1).Release.Build.6 = Releas&|.
{2237--44-9-7117355018}.Debug. ActiveCfg = Debyg|.NET
{22A37BFE-687D-44E6-9COG-7117a5BC5018bDebug. Build. 0 = Debug).NET
{22A37BFE-6870-44E6-9COC-711735BC60t8}.Debugl,ActiveCfg Debug[.NET
{22A37BFE~687D~44E6-9CGC-711735BC5018}.Debug1, Build. S = Oebugl-NET
: {22A378FE-68'7D-44B-9CaC-711735BC5018}.POStCMO.ActiveCfg = ReleaseJ.HET
{22A378FE-887D-44E6-9COC-7117358C5018}.POStCHD,Build. 0 = Release}.NET
{22A37BFE-687D~44E6-9GOC-7l1735BC5018}.PostExplorer.ActiveCfg Release I.NET
{22A37BFE-687D-44E6-9COC-7l1735BC5018}.PostExplorer.8yild.6 =
RsleaseJ.NET
{22A378FE-687D-44E6-9COC-7117358C5018bfEelease,ActiveGfg * Release(.NET
{22A37BFE~687Q-44E6~9COC-711735BC5018J.Release,8ulld.O = fieleasef.NET
EndGlobalSection
GlobalSectionCExtensibilityGlolials) = postSolution
EirdGlobalSection
G10balSectioci(Extei>sibilityAdd::ns) * postSolution
EndGlobalSectiofl
EndSlobal
, , , . , ;: , , (.suo). ,
.sin .suo, )'
, .suo, .
31
, .suo, ,
. , , , , Task List. , , .suo ,sln. , .suo , , e-mail.
Visual Studio .NET .
, , . , . , Visual
C++, , Solution Explorer. ,
, .
Visual C++ , . , ,
Visual C++ ,
. Windows Forms
. Web Forms , .
Visual Studio .NET 2003 (. 2-1):
. 2-1. Visual Studio .NET 2003
Visual C++
Visual Basic .NET (Web)
Visual C# .NET (Web)
Visual Basic .NET
Visual * .NET
Visual J#
32
AilFiles Project
Solution Explorer. , . -JM (code-behind), ASP.NET. . 2-5 .
Sobjtioo Enptorer CSWebftpp
. 2-5.
Visual
, ,
, , IDE,
. . .NET MSIL (Microsoft Intermediate Language),
,
Property Pages. ( Solution Explorer
Properties .)
Property Pages Solution Property Pages,
.
, ; .
, Visual Studio .NET,
. Visual Studio .NET ! ,
.
33
Configuration Manager Configuration
Manager Property Pages Build.ConfigurationM anager Command Window. ,
, Configuration Project Contexts, New . New Project
Configuration (. 2-6).
NewProjept Configuration
Project Configuration Nane;
<
. 2-6.
Cancel
Help
, Visual Basic .NET, Visual C# Visual Jt, Property Pages. ,
Windows Forms Web Forms,
.
. 2-7 General, Common Properties
Visual Basic .NET Windows Forms.
General Configuration Properties. :
Configuration, Platform, Configuration Manager , Common Properties.
,
. , Assembly
Name, Output Type, Namespace. Common Properties
Page Layout, (Flow Grid)
Web Forms Windows Forms: Target Schema,
34
Web-, , , .
VUtofinApp Properly Panes
* General
Designer Qetents
References Ruth
Configuration Propel
i Output Type
| QtfxJt Nar.ieipa
; Startup OC]ecI
Nqmt
art the oUpolfite that hoM
. 2-8.
.
,
.
Configuration Properties , (build).
-
35
I
False
' Check for flrttmBtic OvftrFlowJl. False
\ fJkm unsafe cede block*
. 2-9.
False
Debugging (. 2-10) , Web Forms Web- XML. , Start URL. , URL, Web- XML,
Start Application. .
. 2-10.
Command Line Arguments. : ' :
"
, .
,
. ,
,
. ,
, , .> ,
.
Advanced (, 2-11) , . Visual C Advanced Configuration Properties
DLL, .
. Windows 4 ,
.NET 512, 1024, 2048,4096,8192 16384- Incremental
Build , /doc
. /doc , , , ,
Incremental Build False, .
Visual C++
Property Pages Visual C++ ,
. , ,
Visual C++. , .
|j Confntr Properties
-jj omfifMatiun Propertta
'7
- '
Inrremtnlal buBd
EniWe the inoerenti
. 2-11.
. 2-12.
Visual C++
C/C++
, ,
, .
, .
, ,
.
. . .
Linker
Resources
38
. 2-2.
MIDI
()
. 2-13-
39
;
, . , : , , , - Tools Visu.tl
, Studio .NET. Windows Explorer , ( , ;>.
.) -
, >jer.exe , .
; 1. PostExplorer.
2. Post-Build Event Command Line:
Explorer,exe $(TargetSir)
3. ,
, .
, Windows Explorer . -, < i , , Buildlog.hf .
Property Pages
(. 2-3).
. 2-3. , Property Pages
SfConftgurationName)
S(DevEnvDir)
S(FrameworkDir)
S(FrameworkSDKDir)
$ (Frame workVersion)
S(Inbent)
S(lnputDir)
S(InputExt)
S(Inputl-ileName)
S(InputName)
S(InputPath)
Visual Studio .NET
.NET Framework
.NET Framework SDK
.NET Framework
,
Visual Studio .NET
,
( + )
S(lntDir)
S(NoInherit)
t(OutDir)
S(PlatformName)
S(ProjectDir)
, Win32 .NET
,
S(ProjectExt)
f.vcproj)
. , .
40
. 2-3.
()
S(ProjectFileName)
t(ProjectName)
t(ProjectPatb)
S(RemoteMacbine)
S(SolutionDir)
S(SolutionExt)
S(SolutionFileName)
(CPPWm32.vcproj)
(CPPWin32)
i;
( )
,
(.sin)
(Chapler02.sln)
(Chapter02)
S(SolutionName)
;
(.)
(CPPWin32.exe)
(CPPWin32)
Visual C++ .NET
Visual Studio .NET
S(SolutionPath)
S(TargetDir)
S(TargetExt)
S(TargetPtteName)
S(TargetName)
$(TargetPatb)
S(VCInstallDir)
S(VSInstcUlDir)
, ,
(. 2-4). , Visual Studio Integration Program (VSIP) .
. 2-4.
Visual Basic .NET
Visual C#
Visual C++
Visual J#
Deployment
.vbproj
.csproj
.vcproj
.vjproj
.vdproj
CSWinApp.csproj
<VisualStudioProject>
ProjectType * "Local"
ProductVersiori = "7.10,2215"
SchemaVersion = "2,0"
ProjectGuid = "{9DC32270-2155-414F-9BE5-C593ADE47FFD}"
'-' -
<Build>
<Settings
Applicationlcon = "App.ico"
AssejiblyKeyContainerName = ""
AssemblyNanie = "CSWinApp"
AssfiBblyQrigiflatorKeyFile = "
DefaultClientScript = "JScript"
DefaultHTHLPageLaywat = "Grid"
- EtefaultTargetSchem = "IE50"
DelaySign = "false"
OtrtputType = "WinExe"
PreBuildEvent - ""
PostBuiIdEvent = ""
RootNaiespace "CSWiRApp"
RunPostBuildEvent = "Ort&uildSuccess"
StartopObject = ""
>
;:;..'-;
41
'' '
.- "
<Config
Uame = ""
AllowUnsafelocks = "false"
BaseAddress = "25212672"
CheckForQverflowUnderflow = "false"
ConfigurationOverricteFllB =
DefineConstants * "DEBUG;TRACE"
DoGuiaentationFile a ""
DebugSymbols * "true"
FileAlignraent = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize - "false"
(btputPath "bin\Debug\"
RegisterForCoBtlRterop = "false"
ReiflovelntegerCfiecks ~ "false"
TreatWarningsAsErrors = "false"
WarningLevel - "4"
/>
<Config
Name ~ "Release"
AllowUnsafe81ocks = "false"
BaseAddress = "285212672"
OfceokForGverflowUnderflow * "false"
ConfigurationSverrideFile = "
DeflneConstants = "TRACE"
DocumentationFile
DebugSyrabols = "false"
FileAUgniaent * "4096"
IncreraentalBuild ~ "false"
. . .
42
NoStdtib - "false"
floWam = ""
Optimize - "true"
GtttpurtPath = "bln\fielease\"
flegisterForConilnterop = "false"
ReeioveZntegerChecks * "false"
TreatWarnlagsAsErrors = "false"
WarniRgLevel - "4"
Name = "Debugl"
AllowUnsafeBlt'Cks = "false"
BaseAddress = "21521267^"
CheckFofSyerflo^ntferflow = "true"
ConflguratlonCverrideFtle ""
DeflneConstants = "DEBUG;TRASE"
DocyraentationFtle = ""
~ "true"
= "4096"
Incremental Etui Id = "false"
NoStdLib = "fnise"
Optiitize - "fulse"
fiegisterForCofrrlnterop - "false"
aeiiovelntegerClrecks * "false"
TreattfarningsAsErrors ~ "true"
WarningLevel = "3"
</Settings>
<References>
Name = "Systwir
AssemWyNaifte * "System"
"C: \WINDOWS\Hicrosoft , NET\Fraiaework\v1 . 1 . 4322\Systeni. tttl"
f*
Reference
Nasie - "System. Data'
AssemblyNaiae = "System. Data"
HiRtPath
"C:\WINDOWS\Mic rosoft . NET\Fraraewor k\v1 . 1 . 4322\Systeni. Data.
A
43
</8ullt>
<Include>
<File
fielPath - "App.ico"
BuildActiofi - "Content"
Belfath "AssemtJlyInfQ.es
SubType - "Code"
BulldAetion = "Compile"
/>
. . ..".
<Fle
:."
RelPatti = "Forni.es"
SubType - "Form"
BuildActlon = "Compile"
RelPath = "Fomt.resx"
Depend = "Formt.cs"
BuildAction * "Embeddedflesource
</CSHARF>
</VisualStydiof>roject>
Visual Basic .NET, Visual C#, Visual J# : ProjectNameProjectExt.user.
Visual Basic .NET .vbroj.user,
XML-
. Visual C# 2-3
.csproj 2-2.
, , Debug 1. .suo .user
.
44
2-3.
CSWinApp.csproj.user
<VisualStudioProject>
<CSHARP UstOpervVersion = ". 10.2215" >
<Settlngs ReferencePath = "" >
<Config
Mam = "Debug"
EnableASPDebuijging = "false"
EnableASPXCebusgirvg - "false"
EnableUnieanagiHiDebiigging * "false"
EnableSQLSenmrDebugging = "false"
RefBQteDebug Enabled = "false"
ReraoteDebugHachine = ""
StartAction = "Project"
StartArgumentji = ""
StartPage ""
StartProaram ""
StartURL ""
StartWorkingDirectory =* ""
= "true"
<Cnfig
~ "Release"
Enable AS PDebugg ing = "false"
EimbleASPXDebijgglng "false"
EnableUnmanagadDebugging * "false
EnableSQLServiirDebugging = "false
Remote Be bugrt,abled = "false"
RenoteDebug^aohine = ""
StartAction = "Project"
StartArgiments - ""
StartPage = ""
StartPrograra = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithlE - "false"
Name =
EnableASPDebugging = "false"
EnableASPXDebugglng = "false"
EnableUfiiBanagedDe bugging * "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled ~ "false"
RemoteOebugHachine ""
StartActlon "Project"
StartArguments ""
45
Start Page * *
StartProgram * ""
StartUBL = StartWorkiRgDirectory
StarmtthlE * "true"
</SettriBS>
<OtherProjectSet tings
CopyProjectDestinatiofiFolder
CopyProjectUncPatfi = "
CopyProjectOptiofl = "0"
P'rojeetView = "ProjeetFiles"
ProjectTrust = "0"
</CSHARP>
</VisualStudioProjeet>
Solution Explorer
, . Solution Explorer "
, Web-. , , .
Add Reference,
, Solution Explorer
ProjectAddReference Command Window, Projects
(. 2-14).
: Frojei.1 Directory^
c:\Docurnerits arid Settings\Bnar,\De;ktop\lN5..,
CSWinApp
VBWebApp
i4i.|.
VJConsoleApp
ebSer.
<
Help
. 2-14.
', I,
, .
, , ,
, - . Visual Studio .NET
Project Dependencies (ProjectsProjectDependencies) (, 2-15),
, .
. (
, Visual Studio .NET
.) , Web- XML,
, Build Order.
CPPWin32
CSWehGervice
G CSWinApp
G SstupPpplicatlcn
VBWebAfp
."..". VeWinApp
i ) VJConsoleApp
2-15-
, ,
. Configuration Manager (. 2-16). , , ,
.
. B;itch Build (ProjectBatcbBuild)
, Web (. 2-17).
Batch Build ,
, . Build
,
. Rebuild Rebuild All
. Clean , -
47
,
. : Visual Studio .NET Clean
Visual Basic .NET Visual C#.
Visual Basic .NET Visual C# ,
.
Unit 1| ,ii in Manager
Solulran
. _ _ |
CPPWin32
PostCMD
Win32
C5WebApp
Release
,NET
CSWebService
Release
.NET
CSVrtnApp
Debugl
Setup Application
Release
rlatfo-m _
Release
Close
Help
. 2-16. ,
!'T!^IL^:
j CWInflppl
Debug
.NET
Debug
CSWinAppl
Release
.NET
Release
CSWinApp2
Debug
.NET
Debug
tl
&ebwfcl
dean
Release
Deselect All
Visual Studio ,NET , IDE IDE.}'{ 3 .
3
Visual Studio .NET
IDE
Visual Studio .NET , . Visual Studio .NET
. ,
, , IDE.
(Code Editor) . ,
IDE, . ,
, ; , , Web- .
Visual Studio .NET 7.0 7.1 , (outlining), .
,
Command Window (Ctrl+Alt+A) , . , Visual Studio .NET.
49
- IDE . -
IDE ,
Dockable Window.
(Object Browser) (Ctrl+Alt+J) ,
- IDE. - IDE , >
.
, , ,
Dockable, ,
.
, , Visual Studio .NET
. ,
Visual Studio .NET , ,
, (Code Editor).
, IDE.
,
IDE, (Text Editor), , , ,
, , , . , .
. 3-1 IDE: ,
-|
1"}
-^
L'fi
~1 Toa chonr;
i i i*J.B'
7-r-gi3ter iBe XtlO-in jiy ijuiiaine
: ;sstais ptc.!^
STDMETHOEIBT
pApplication->Query Interface!
. 3-13-1116
ILPVOID'l Cai_l-DTtl :
50
. ,
, , .
, , , ,
, .
(Navigation Bar) . Visual C# (Types) (Members).
Visual Basic .NET (Class Name) (Method
Name).
. Visual Basic .NET .
.
+ -, , /
(. ).
(Margin Indicator Bar) .
. ,
, , - , -. , (. 3-2). , , .
( .)
.
. 3-2.
,
,
. .
, . -
51
. ,
.
,
. . (MDI), Visual Studio 6,
Options.
, , , .
:
,
(Code Editor), (Designer),
(Solution Explorer) (Class View).
, . Ctrl+Alt+1, Solution Explorer.
# Enter. Windows- Web-, ,
. ' '
#-, F7. , - , ,
'> SliifHF?.
Ctri+Ait+L, Solution Explorer,
Enter.
, IDE. CtrRTab Ctrl+F6,
-...., , Class View, CtrH-Shift+C.
IDE,
,
.
, , Web- ,
. ( - ,
Visual Studio .NET !)
, , , , .
, Microsoft Windows,
, , . CUA- (Common User Accessibility),
, IBM
52
. :
, Windows-,
Microsoft Office. ,
Microsoft.
Windows . Microsoft Windows
User Experience (Microsoft Press, 1999).
Visual Studio .NET (. 3-1):
. 3-1.
New
Open
Save
Save All
Print
Ctrl+N
Ctrl+O
Ctrl+S
Ctrl+ShifH-S
Ctrl+P
FileNewPile
Ftte.OpenFUe
FileSaveSelectedltems
FileSaveAll
FilePrin!
New File.
, . ,
, . ,
(Command Window) , . , LJserMotioacpp, Ctrl+Alt+A, , File.NewFile UserMotion.cpp. , ,
, , 4 , ,
Ctrl+N.
, . , (. 3-2).
Shift,
Ctrl.
. 3-2.
()
-
-
Ctrl-t- -
CtrH--
End
Home
-
-
Shift+ -
Shift+-
Ctrl+Shift+-
Ctrl+Shift+ -
Shift-bEnd
Shift+Home
Shift+-
Shift+-
. 3-2.
()
53
()
Page Down
Page Up
Ctrl+End
Ctrl+Home
Shift+Page Down
Shift+Page Up
Ctrl+Shift+End
Ctrl+Shift+Home
, .
(. 3-3):
. 3-3.
Ctrl+X
Edit.Cut
Ctrl+C
Edit.Copy
Ctrl+V
EditPaste
EdiWndo
EditRedo
EditSdectCurrentWord
EditSelectAll
Ctrl+Z
Ctrl+Y
Ctrl+W
Ctrl+A
:
. Clipboard Ring. - .
. , , , . , -.
Ctrl+Shift+Insert Ctrl+Shlft,
. : , Insert .
Insert s , ,
. ( .) Insert , , .
.
(. 3-4). , , Ctrl+T
* *,
Ctrl+Shift+T .
EditLineTranspose. Alt+Shift+T
Ctrl+T
Ctrl+Shift+T
Alr+Shift+T
Edit.CharTranspose
EditWordTranspose
EditLineTranspose
Dockable ,
IDE, WindowDockable , , .
IDE ,
(Ctrl+AIt+A) Tools.Options.
Options (. 3-3). Jinvironment Keyboard,
Keyboard. IDE: , .
IDE - .
nvironment
General
Doomnents
Dynamic Help
Fonts and Colors
Help
. 3-3-
Assign
ShertcutcurrenayuseiJby:
Keyboard Options
55
, . ,
. , ,
.
Visual Studio .NET (chorded
shortcut). , Ctrl . IDE , , . , Ctrl+, (Ctrl+) Visual
Studio .NET . -
,
, . WindowDockable
Ctrl+,, Ctrl+D (Ctrl+, Ctrl+D), Press Shortcut Key(s). Assign, .
Options,
Options, Show Commands
Containing Tools.Options Ctrl+,, Ctrl+O IDE ,
.
[DE,
, .
Keybindings Table
, Visual
Studio .NET, , Options . , ,
IDE .
Web- Visual Studio .NET hup://
msdn.microsqftom/vstudio/doiimloa(is/autornation.asp. C++,
, Visual Studio .NET Visual C++ .NET. Visual Studio .NET .
Visual Studio .NET, IDE .
Visual Studio .NET Help . Keyboard Help (. 3-4).
Keybindings Table
, IDE,
. , .
, Ctrl
. Microsoft Excel,
.
56
6 Keyboard Help
(f<Cj
.,--,.,;!-,-!!,-,-;,.-
Build BuldSdution
Build. Cancel
Build Compile
Dal abase. Run
D a 1 abase. R unS el ection
Daiabase.Steplnto
Debug App^iCodeChanges
Debug. Autos
Debug.BreakAII
Debug Breakpoint
Debug CalStack
D ebug. CleartIB i eakp oinl s
Debug. Disassembly
Debug EnableBreakpoint
Debug. Except ions
Debug Immediate
Debug. Locals
Debug. Memory!
Debug. Memory2
Debug. MemoryS
Debug. Memoi)4
Debug. Modules
D ebug. N ewB reakpont
Debug. QuickWalch
. 3-4.
_*]
1 Ke'Brnding
Scope
Global
Global
Global
Global
Global
Global
Global
Globa
Globa
Globa
.
Globa
Globa
Globa
Glob
Chl+Shft+B
D[l*6reak
ClrltR
Drl+E
DrltQ
AK-F5
Alt-FlO
Dil+AKW.A
Drl*AK+Bieak
Drl+AbB
Clrl+AK-C
1 Dil*ShilH-F9
CtrltAlt'D
Orl+F9
Pil-Att*E
Cli i- 1 ir|
CltHAINV, L
CM+AlttM, 1
CtrltAII+M, 2
QrlAlttM.3
Dri+AII+M.4
CMwW+U
QrltB
Shi't+
i , ,
Globa
Globa
Globa
Globa
Globe
Globa
Globa
Globa
Keyboard Help
. , IDE Visual Studio, Options Text Editor.
(All Languages), Text Editor (. 3-5).
jyj Environment
5ource Control
Text Editor
General
*2J All Languages
Gerierd
^ Tabs
j Baiic
C*
Indenting
!
i! selecBons cortfSct.
'' Stock
* Smart
Tab size:
Indent size;
[7
j HTML/XML
:
|
3 PL/SQL
Jj Plain Text
SI T-5QL
03 T-5QL7
3-5.
i This page sets option; for al languages, Tochange options For only
language., setect fee de sred tangyage From the bee on bhe foFt.
, Indenting () None,
Block Smart.
57
-*
-i
. 3-6.
[ STAThread]
static-void..Henn[stnng[] -ergs]
, ,
, , , Tab;s Options , , . , Ctrl+A. Ctrl+K, Ctrl+F
{EditformatSelection), .
Formatting Options (. 3-7).
, IDE. Basic -
58
VB Specific. #.
Indentation
.....................
InteiseflSe Msrr
S* IntetHsense preseterts rrp*t frequently used-membefs
dear ftstay
Cancel
. 3-7-
Help
Formatting #
. Leave Open
Braces On Same Line As Construct (. 3-7). # .
, , . :
static void Main(string[] args)
I
, , EditFormatSelection.
, , , #
, K&R, , . EditformatSelection, -
. EditFormatDocument,
. ,, Leave Open Braces On Same Line As Construct, ,
.
,
( )
. , IDE,
.
, ,
Fonts And Colors, Environment
Options. , IDE (. 3-8): , , ianpo .
. 3-8-
Iterr foreground:
I Selected Text
j Inactive 5el acted Text
Indicator Margin
I Line Numbers
iVisible White Space
1 Brace Matching
; Automatic
iterr background:
ID Automatic
Custop)..,
Sample:
AaBbCc&rYyZz
60
Environment
Genera!
Documents
Dynairic Help
$> Fonts and Color;
Help
International Settings
Keyboard
projects and Solution'
Task List
Web Browser
Source Control
Text Editor
/
ataba?e Tools
i_j Debugging
Qj Device Toob
. 3-9-
Custom...
|t_ompiler Error
CSS Property Name
CSS Property Value
iCSS Selector
Sample:
61
L i d e n t i f i e r type chancie
L operator
L s e p a r a t o r character
L- o p e r a t o r
identifier t*pe characte
separator character
Const d i r e c t i v e
Is* d i r e c t i v e
HE I s e l f d i r e c t i v e
tEnd It d i r e c t i v e
*E*t*rnalSource d i r e c t i v e
TIF ... B E N D I f preprocesso
It directive
K i t . . . Then..-HEIse d i r e o t i
X
identifi
identif i
opeiator
identifi
operator
. 3-. Index
Dialogs And Tool Windows
. 3-11. ,
1 1 i g X i a :i j '. s h t \ ' t j \ Ad d I
. 3-12.
IDE, ,
. Regedit REG-.
62
REG-
Regedit. IDE,
.
no-Mtcrosoft'oBCKM
, Microsoft , , , ,
Windows, , . Microsoft
: ( ), ,
. (, - j:
.) , .
.
- , ,
,
, Text Editor,
General Options.
. Options.
, ,
. ,
Visual Studio .NET, / . : , ,
.
Macros.Samples.UtiUties.TurnOnLineNumbers
MacrosSampls.Utttities.TurnOffUneNumbers.
(InteiHSense) ,
,
. TumOnLineNumbers,
, Ctrl+Alt+A, :
>alias
Inon Macros.Samples.Utilities.TurnOnLineNumbers
63
, Inon, (
). ,
TurnOffLineNumbers, :
>alias Inoff Macros.Samples.Utilities.TurnOffLineNumbers
TurnOffLineNumbers Inoff.
, . : Numbers Keyboard Environment Options. ,
, Assign.
: TurnOnLineNumbers Ctrl+,, Ctrl+N (N ), TurnOffLineNumbers Ctrl+,, Ctrl+Shift+N. . 3-13 ,
, .
^3 Environment
General
I Brian's Shortcuts
Documents
Dynamic Help
: numbers
* M a cr s . 5 amples . Utilities . TurnOnLineNumber s
"|ari+7ctrM^hlrt^^
Use QBW sharteyt ire
|aobal
PressshoftcLEkeyfs);
~~23l
Shortcut (1 usedfey:
Hefo
. 3-13-
TurnOffLineNumbers
, / ,
, ? , . ,
. , Visual Studio .NET Customize. Customize Commands Macros,
Samples.Utilities.TVirnOnLineNumbers .
, .
, ( Customize ). Turn On Line Numbers.
TurnOffLineNumbers (. 3-14).
. 3-14.
TurnOffLine Numbers
, , , .
(outlining) . . 3-15
, .
. , , .
, Ctri+M, Ctrl+P (EdttStopOutlining).
. Ctrl+M, Ctrl+O
(Edtt.CoUapsetoDejmitions). CollapsetoDeftmtions
. Ctrl+M, Ctrl+L
(Edit.ToggleAllOutUning) .
, .
Ctrl+M, Ctrl+H (EditHideSelectiori).
. , Ctrl+M, Ctrl+U (EditStopHidingCurrenf).
, , (. 3-5).
clon(IDlspaloh
: iOnCc
HPESULT hr - a OK;
OnP:
OnBl /(U*<Jfl-TAMT'...
Ouery3totu3 (B5TR , EnvCTE: :-/1 1
Exec [B3TR be^cCaiOMaire, nvDTE: ivaCoicfEiaridExeoOption CMecuteOption^
1
|
;,;
"t
<
~ --^
+f
*J
.
..
'
cdi
thi
IN,
. 3-15. /2(3 ,
. 3-5.
Ctrl+M, Ctrl+P
Ctrl+M, Ctrl+L
Ctrl+M, Ctrl+M
Ctrl+M, Ctrl+H
Ctrl+M, Ctrl+U
Ee&tStopOutiming
Edit.ToggleAllOutlining
Edit.ToggleOullmingMxpansion
EdtiHideSelection
E4itStopHidingCurrent
66
(IntelliSense) , - , . API, ,
.
, , . , ,
.
, .NET Framework , .
Web- XML, .
: , , .
, . . , IDE, , . : , ,
. ,
, .
, , . , . , Text Editor
Options. , ( All Languages, ),
General Statement Completion Auto List Members.
(Parameter Information).
,
, Hide Advanced Members.
Visual Basic .NET , , .
.
, Ctrl+J (. 3-16).
, , - *, Tab.
Formatting # Options
Visual Studio .NET 2003 , Visual C# .
static v o i d M a i n ( s t r i n g [ ]
67
?;
- Read
-i* ReadLine
- ReferenceEquals
::.
,
. 3-16.
Ctrl+J
, .
3-17, Ctrl+Shift+. . -
.
1
arga)
fl TOOO:
//inc
Console.Write(
117 of 13 void Consde.Write (string format, object atgO, object argL)
Format: The format string.
. 3-17.
Ctrl+Shift+
, ( ), .
.
.
,
. ,
. Alt+- ,
Ctrl+J.
, , , ,
, . Quick
Info, , . . , Ctrl+K, Ctrl+I.
Visual , -
'
, ///. ,
, .
. Visual Visual
C++ , .
(), [] {} .
#if, #efoe #/ .
, ?
. , Fonts And Colors Environment Options.
Display Items Brace Matching. Bold
Foreground Background Automatic,
. , ,
.
, , Visual Studio .NET.
IDE, , ,
IDE. , ,
.
, ,
IDE. Visual C# Console,
(. 3-18).
System.Console. : ,
Ctrl+Alt+F3 (HelpSearch) , .
Help
Console Members
. 3-18.
69
, - IDE, (Properties), . ]
.
Ctrl+Fl. , IDE, ,
. -
, , ,
. - F1, .
Ctrl+Alt+F3 , . , , Ctrl+Fl , . 90% .
Vim (Vi improved) , Visual
Studio .NET .
Keybindings Table, .,
IDE 1100 . 400
. ,
.
Visual Studio .NET . (Command Mode) . ,
(Immediate Mode) ,
, . : immed , >cmd . , (?):
>? i
:
>? i = 7
7
>? i + i
14
, (>):
i
7
i +1
14
>Edit.Find i
>immed
70
,
.
immed. , EditFind,
.
els .
. , .
, ,
. \
.
>\ main|args /regex
\ :
( ).
.
, ( . 4).
Visual Studio .NET Ctrl+Alt+A.
Find Standard,
Ctrl+D (Edit.GoToFindCombo). Find
.
(>), ,
, .
, Find , , (. 3-19)
File.NewBlankSolutkjn
Fite.NswFile
FJe.NewProject
. 3-19- Find
,
, . Visual Studio .NET , .
,
Visual Studio .NET.
Common User Accessibility (CUA), Windows Office
Find, Ctrl+F (. 3-20). Find (Match
Case), (Match Whole Word) (Search Up),
(Search Hidden Text).
, , .
Find what;
~
~ Match sshote word
Search
''' Curren
^~ Al documents
f~ Search yp
. 3-20. Find
Find , IDE , Dockable ,
, - IDE.
Find, IDE. , .
,
Floating ( Close
). .:
.
Replace (. 3-21) Ctrl+H.
Find, (Replace With).
, .
, , .
tt*tir
jengme
Search
^ Current do
<" (Hspendocumerts
f Current prefect
Search
Mark All
Hefe
. 3-21. Replace
Find and Replace (Ctrl+Shift+F) (. 3-22)
Replace In Files (Ctrl+Shifc+H)
. ... Look In, : , . Find In Files Find Results.
Find
Replace
Find in files
Replace in files
Ctrl+F
Ctrl+H
Ctrl+Shift+F
Ctrl+Shift+H
EditFind
EdttReplace
EdilFindinFiles
FileReplaceinFiles
Use Find and Replace (wildcards)
. , Wildcards . .
, . ,
01, 02. , H03XD04 . ., ,
73
, #,
, ?,
. , , Find Use
Wild Cards. ?0# '
- ).
. '.
, ,
, , : '. , < >
.
, ' , , . , class
/', class Class 1. , , , ,
, , , .
, , [!]. , , ,
, ?0#, , . [!]0# .
[ ] , , . , D,
: H03X[AD]0#.
, ,
, , ,
. ,
Visual Studio .NET (. 3-7):
. 3-7. , Visual Studio.NET
[! ]
[]
.
Visual Studio .NET, , ,
. Visual Siudio
,NET 70 -
74
, . , Use
Regular Expressions Use.
- [ ] .
, . ,
d Find What [a-d]. [a-d]b
ab, bb, ch db.
, , , . [" ]
. , ft-vjs as, bs, cs, ds, ts,
us, vs . . .
- ,
. S . : < , > . . , int, <mt. , int. To
integers int, mint . , int , >.
.
, . ,
#-, MessageBoxSbow , ;
<MessageBox.Show\(:q|(<,>)\);
,
. , < . MessageBoxSbow , .
\ , ,
. :q . ((**)\'))- | :q , MessageBoxSbow , ,
<> . . ,
. , , .
, ,
. , ,
,
(white space), . :Wb ', ( ) .
: <MessageBoxShow\(:(j\(<.>):Wh*\);. -
75
, : <MessageBoxSbow\(
Wb':f^(<.>):Wb'\);. ?!
. Mastering Regular Expressions*, Jeffrey E. E Eriedel
(O'Reilly, 1997) Writing Secure Code, Second Edition, Michael Howard David
LeBlanc (Microsoft Press, 2003)'-
, .
. 3-8 , .
. Visual Studio .NET ( Help Find , Visual Studio .NET).
. 3-8.
[]
/7
< >
$
I
:q
:Wh
. - (),
.
, .
.
.
.
,
.
, .
.
.
.
, .
Find , Edit.Find , , Enter.
, ,
. , ,
:
Edit.Find
Class /Wild
Find
Find. ,
, Find.
, , Edit.Find /options:
^. *. : *, 2003. , .
76
>Edit.Find /options
/wild /doc /names /sub
,
Find Visual Studio .NET (. 3-9).
EditJleplace, EditFindinFiles EditJKeplaceinFiles.
, help Edit.Find.
. 3-9. Find
/case
/doc
/hidden
/markall
/open
/options
/proc
/set
/up
/regex
/wild
/word
/
/d
/h
/m
/o
/t
/P
/s
/u
/1
/w
EditFind /reset, . , .
.
, .
, Ctrl+I. , (. 3-23).
.
, . , , Ctrl+I.
, . Ctrl+I, ,
.
, Ctrl+Shift+I. .
, Enter Esc.
77
//THPORTMJT'
. 3-23-
Ctrl+I
IDE,
IDE ,
, . 4 , IDE .
4
Visual Studio .NET
79
Ctrl+Shift+R Recorder (. 4-1) RecordmgModule, . : ,
.
**%
. 4-1.
Recorder
. , Connect .
Find Find In Files. , ];
, ,
.
80
.
1.
2.
3.
4.
5.
Ctrl+Shift+R, .
Ctrl+F, Find.
Connect Find What.
Find Next.
Ctrl+Shift+R, .
TemporaryMacro, RecordingModule
(. 4-2).
Map in Fxplorer
3 Macros
!+' - InsldeVSNET
!- -
1
S. Si MySevedMacros
'-' j RecordingModule
. 4-2.
Macro Explorer
, .
, (, Tab
Replace) . Visual Studio .NET
, .
Imports EnvDTE
Imports System.Diagnostics
Public Module RecordingModule
Sub TemporaryMacroO
DTE.ExecuteCommand("Edit.Find")
DTE.Find.FindWhat = "Connect'
DTE.Windows.Item("Connect.cpp").Activate()
DTE.Find.FindWhat = "Connect 1
DTE.Find.Target = vsFindTargot.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.Backwards = False
DTE.Find.MatchlnHiddenText = False
DTE.Find.PatternSyntax = _
vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.Action = vsFindAction.vsFindActionFind
DTE. Find. ExecuteO
81
End Sub
End Module
, Ctrl+Shift+P MacrosMacrosRecording^odule.TemporaryMacro. Find .
Connect Connect.cpp,
DTEWindowsltem(Connect.cpp)Acttvate(). Connect.cpp , IDE, ,
. ,
.
, TemporaryMacro
Macro Explorer
.
Macro Explorer IDE Visual Studio .NET.
, , IDE Macros
Tools Macro Explorer.
, , .
Macro Explorer
Macro. Macro
.
, Command Window. ,
(, 4-1):
. 4-1.
ToolsLoadMacroProject
TooisJVeti'MacroProject
ToolsMacrosIDE
4-1116
82
. 4-2.
ToolsNewmodule
ToolsJVewmacro
Toolsdit
New Module,
Macro Explorer.
Macros IDE .
Macros IDE .
Macro Explorer
. Run ToolsJtun , Rename .
Macros IDE. Delete , a Edit Macros IDE.
Macro Explorer, Macros IDE.
, , IDE! , ,
IDE , .
Visual Studio .NET, Macros IDE.
Macros IDE
Macros IDE Visual Studio ,NET.
Macros IDE. Macros IDE
IntelliSense, IDE.
: Project Explorer. Visual Studio .NET , , Samples
Project Explorer Macros IDE (. 4-3).
,
,
, .
, , , , ,
Samples , .
, IDE Visual Studio .NET.
New Macro Project
Macro Explorer Tools.NewMacroProject Command
Window, New Macro Project (. 4-4).
.
Alt+Fl 1, Macros IDE, .
83
utmtjej
ptutmtlef
InsidtVSNET
lyM
. 4-3-
.
'. \-
"j-j | lM4pdJf*ieiKiiment
DTE.find.FindMhat - ta.Texc
End SuJj
Waffle;
'i TextMacros
Lccation.'
Open
Help
: IDE
Macros IDE IDE Visual Studio .NET, Visual
Studio Macros IDE. B Visual Studio .NET
, , .
Macros IDE . ,
IDE Visual Studio .NET, Customize.
Commands Tools Macros IDE
, . , rosIDE . .;' IDE, .
,
, Macros IDE, a
Visual Studio .NET.
Visual Basic .NET. Add Reference, Macros IDE Project Explorer (. 4-5). .
__]_
System, Security
System , Servic e P rotes s, dl
System, Web.d
System, Web. Mcbile.dll
System. Web , RegularExpr e s si.
System. Web, S ervices. dll
1.0,5000.0
1.0.5000.0
1.0.5000.0
1.0.5000.0
i,0.5000.0
1,0,5000,0
C:\WINDC'WS^Mfcrasoft.NET,..
C:\W1NDC WSlMicrosoft.rJET...
C:\WINDt'WS\Microsoft.NET,..
C:\WMX >WS\Mtrosoft.NET...
C:\WINDC'WS\Micro5oft.NET...
CilWJNDC'WSlMitrosoft.NET.,,
5ystem.Xml.dll
VJSBrowserStiilib
1,0,5000.0
L.0,5000,0
1.0.5000,0
7.0.5000.0
C;YwifCCW5\Mii:rosoFt.MET..,
C;\WWDC'WS\Mto-osoft.NeT...
C:\WINDCW544icrosQft.NET...
C:\Wir\DC WS\Micro5oft.NET...
V JSharpCodePravider
Select
Tyoe
. 4-5-
Add Reference
,
C:\Program Fi!es\Microsoft Visual Studio .NET 2003\Common7\IDE\PublicAssemblies.
Add Reference. , , . , , ,
85
COM . , .
FileNewFile Visual Studio .NET. , ,
, . : , , Command Window. , , TDE :
Imports EnvDTE
Imports System.Diagnostics
Public Module NewFile
Sub NewTextFileC)
DTE.ItemOperations.NewFile("General\Text File")
End Sub
End Module
, NewFile
NewTextFile.
Text File General New File. NetvFile,
, . ,
, IDE.
, , .
, .
: Macro Explorer IDE Visual Studio .NET.
, . : Command Window. , , .
, alias, . IntclliSense , , , ,
:
>alias nf Macros.InsideVSNET.Chapter04.NewFile.NewTextFile
/ Com. nand
Window. , Ctrl+Alt+A tn nf. , Options . ,
Ctrl+,, Ctrl+,, Ctrl+N. , (. 3).
86
Imports. API
Visual Studio .NET EnvDTE. . 5-12. ,
. , , , . . ,
IDE. , , ,
.
IDE. IDE.
, . .
, , , . , , Document
DTE , .
, . IDE DTEActiveDocument,
Document. (: Visual Studio .NET
, IDE.)
, TextDocument.
TextDocument , ,
: StartPoint TextPoint,
, EndPoint , , a Selection TextSelection, .
TextPoint
. TextPoint ,
. TextPoint
,
.
, . , .
87
ActiveDocument, EditPoint
ActiveDocument :
Sub CommentWholeDoc()
Dim td As TextDocument = ActiveDocument.Object
Dim sp As TextPoint
Dim ep As TextPoint
sp = td.StartPoint.CreateEditPointO
ep = td.EndPoint.CreateEditPointO
sp.lnsertC'/* ")
ep.Insert(" */")
End Sub
Visual C# Visuaj C++
, . , , .
IntelliSense, .
:
HTML-.
Visual Studio .NET 2003, , . ts TextSelection ,
DTEActiveDocumentSelection-.
Sub HTMLCommentO
Dim ts As TextSelection = DTE.ActiveDocument.Selection
ts.Insert("<l- ", vslnsertFlags.vsInsertFlagsInsertAtStart)
ts.Insert(" ->", vslnsertFlags.vsInsertFlagsInsertAtEnd)
End Sub
TextSelection Insert
Selection. Insert ; ,
, vsInsertFlags,
. Insert vsInsertFlagsAfStart,
vslnsertFlagsAtEnd. . 4-3.
. 4-3. vsInsertFlags
vsInsertFlagsCollapseToStart
vsInsertFlagsCollapseToEnd
vsInsertFlagsContainNeivText
vsInsertFlagsInsertAiStart
vsInsertFlagslnsertAtEnd
TextPoint.
TextPoint.
.
.
.
88
Visual Studio .NET Window DTE Windows. , Window, . ,
Window CommandWindow, OutputWindow, TaskList, TextWindow ToolBox.
OutputWindow . , print/ Console.Write MsgBox MessageBoxShow Windows-.
OutputWindow , , .
,
MsgBox. MsgWin, )'.
MsgBox, .
Sub MsgWin(6yVal msg As String)
Dim win As Window = DTE.Windows.Item(Constants.vsWindowKindOutput)
Dim cwin As Window =
DTE.Windows.Item(Constants.vsrtindowKindCommandWindow)
Dim ow As OutputWindow = win.Object
Dim owp As OutputWindowPane
Dim cwp As CommandWindow = cwin.Object
Dim i As Integer
Dim exists As Boolean = False
' , Command Window.
' , .
, Command,
If (DTE.ActiveWindow Is cwin) Then
cwp.OutputString(msg + vbCrLf)
Else
, .
, ,
.
For i = 1 ow.OutputWindowPanes.Count
If ow.OutputWindowPanes().Item(i).Name() = "MsgWin Output" Then
exists = True
Exit For
End If
Next
,
,
.
If exists Then
owp = ow.OutputWindowPane;;(). Item(i)
89
Else
owp = ow.OutputWlndowPanes.Add("MsgWin Output")
End If
1
Output , ,
,
win.Visible = True
owp.Activate()
owp.OutputString(msg + vbCrLf)
End If
End Sub
MsgWin , ,
Visual Studio .NET. ,
Command Window. ,
Command Window. , , , MsgWin
Output MsgWin Output.
Samples, Visual Studio .NET,
, .
MsgWin, . , IDE :
Sub MsgWinTestf)
Dim wins As Windows = DTE.WlndowsO
Dim i As Integer
For i = 1 To wins.Count
HsgWin(wins. Item(i).Caption.ToStringO)
Next
End Sub
' Output ,
' ,
win.Visible = True
90
owp.Activate()
owp.OutputStringCmsg + vbCrLf)
End If
End Sub
spfl DeuelopriiPiH Cnvtroiu
fS&tj
Jaeb
*AutoHideTogglF
US CMKtBd D^p^nds
-Jl ,*
aTemp 1= Nothing Then
1
If ce rn nr,4 in th
!; j li
Output
IxplOi
lit
tdl
, ,
. -,
.NET, , ,
.
-, , Visual Basic,
, , , . ,
, Visual Basic: .
,
. Utilities, , Utilities. OutputWindowPaneEx,
InsideVSNET.Utilities.dll bin\debug
91
owp.ActivateO
For i = 1 To wins,Count
owp.WriteLinefwins. Item(i).Caption.ToStringO)
Next
End Sub
, QutputWindowPane, OutputWindowPaneEx , Output. , IDE . Write , , .
,
System.Console.Wnte System.ConsoleWritel.ine
.NET Framework.
IDE IDE .
, , IDI:,.
, IDE.
92
Project Explorer Macros IDE. EnvironmentEvents. , IDE.
( ):
Public
Public
Public
Public
Public
Public
Public
Public
Public
Public
Public
Public
, , IDE. DTE,
. , .
, Class Name
(. 4-7).
DetxrggerEvantf
t
t
DTEEvwTts
FindEyents
MiHFJesEvents
Output wndouEvHfc
SoluSonltBrsEven
. 4-7.
Class Name
, Method Name
, (. 4-8).
, ,
.
.
MsgWin .
93
. P u b l i c Hailule Er
. 4-8.
Method Name
IDE.
, , . , ,
, .
, Visual
Studio ., . ,
, :
,-.\
<_lA
**^
SK . ,
, Disable Event Handling Code
Warning , .
94
, , ,
.
Usenet.
, .
, ,
Visual Studio .NET, Macros
IDE Project Explorer.
Ctrl+E FtieSaveSelectedltemsAs,
Export File. File Export.
Export File .vb,
FtieAddExisitingltem (Shift+Alt+A).
*: EnvironmentEvents,
, .
,
. , , .vsmacros .
, IDE Visual Studio .NET
StorageFormat . Macro Explorer
StorageFormat Properties Binary (.vsmacros) Text
(UNICODE).
, Visual Studio .NET. . 4-9
Samples .
. 4-9- ,
95
, ;; IDE.
. ,
EnvironmentEvents.vb .
. , , , .
.
Visual Studio .NET , Samples
Visual Studio .NET . MakeAddin
,
. , . : , , .
1 AutoHideToggle MakeAddin. , , .
, . , , .
Visual Studio .NET , Ctrl+Shift+N
New Project. Other Projects,
Extensibility Projects, Visual Studio
.NET Add-in (. 4-10).
i ( -1 '',. i
^:
1 AutoHideTo
. 4-.
96
,
Visual Basic .NET, IDE.
, Ctrl+Alt+A,
Command Window, Macros.Samples.MakeAddin.MakeAddinFromMacroProj. (. 4-11) , , .
Visual Studio Macros
Entei the name the MacraPrqect to an
_J3
Cants
lAutoHrieToggle)
. 4-11. ,
, , , . , MakeAddin . , (. 4-12), , MakeAddin
.
* ( in ! Miir.fD Project
. 4-12. ,
MakeAddin
, F5 ;
Visual Studio .NET IDE. Tools IDE , ,
. . 4-13 ,
AutoHideToggle .
. IDE, 1.
,
1, ,
. ,
Visual Studio .NET, ,
My Profile Start Page
Windows Layout. ,
, .
. 4-13.
97
AutoHideToggle IDE
Visual Studio .NET.
,
Visual Studio .NET.
4 Visual Studio .NET ,
IDE. , , , .
, DLL ( ),
IDE ( ). Add-in Wizard,
, .
101
Add-in Wizard
File | New | Project, Visual Studio .NET New Project . Other Projects
Extensibility Projects, Visual Studio .NET Add-in
(. 5-1); Add-in Wizard.
Project types
"~^1 3* Projects
* 03 Visual C++ Projects
LJ Setup and Deployment Projects
- CJ Other Projects
Si Database Projects
.*; \M Enterprise Template Projects
Shared Add-in
| Solution 1
. 5-1.
Add-in Wizard . .
Add-in Wizard : *, Visual Basic .NET Visual C++ [ Active Template Library (ATL)]. ,
, -.
- IDE Visual Studio .,
Macros IDE . ,
IDE Visual Studio .NET,
Macros IDE. ( .)
. .,
.
Add-in Wizard ,
, .
, , .
102
, (
).
,
Visual Studio .NET.
,
,
, Visual Studio .NET
About.
, Add-in Wizard : , DLL , ,
Windows Installer (MSI),
.
DLL, Add-in Wizard Class Library
. Connect, , Connect. Connect
IDTExtensibility2', IDE. (Connect IDTCommandTarget,
.)
IDTExtensibility2 (. 5-1):
. 5-1. IDTExtensibility2
OnStartupComplete
OnAddlnsUpdate
OnBegmShutdown
OnDisconnection
.
, Visual Studio .NET.
Visual Studio .NET.
, Visual Studio .NET .
.
Connect.cs ( 5-1) ,
# (
).
5-1. , Add-in Wizard
Connect.cs
namespace MyAddinl
{
using System;
using NiorosGft,Office.Core;
using Extensibility;
uslfig System. fiuntlae. InteropEiervices;
103
using EnvDTE;
/// <summary>
/// The object for implementing an add-in,
/// <seealso class=*iDTExtensibility2' />
[GuidAttrioiiterSA857E49-7873-45D2-8335~FCCD4123738E"),
ProgldCftyAdtfinl. Connect")}
public class Connect : Object, Extensibility. IDTExtensibility2,
IDTCotBifiandTa rget
{
Hi <8Ufflmary>
/// Implements the constructor for the add-in object.
/// Place your initialization code within this method.
/// </sumuiary>
... pg.blic Connect
\
///
///
IDTExten.sibility2 interface,
; if (connectMotJe ==
ExteRsibility.ext_ConhectMode.ext_Gm_Ul^tup}
object tJcontextQUIDS * new objecttl { };
Coflfflands GoflHitands = applicationObject.Cofflieands;
_Couiffland8ars commandBars =
applicationQbject.GoifflnandBars; '
try
;;,:;-
! ;;
. , i mp.
104
}
/// <summary>
/// Implements the OnOisconnection method of the
/// IDTExtensitollitya interface.
/// Receives notification that the add-in is being unloaded.
/// param term='disconnctMode'>
/// Describes how the add-in is being unloaded.
/// </param>
/// <param terei^'custom':'
/// <suaieiary>
///
Implements the OnAiidlnsUpdate method of the
/// IDTExtensibility? interface.
/// Receives notification that the collection of add-ins
///
has changed.
/// </summary>
/// <param terna* custom' >
/// Array of parameters that are fcost- application specific.
/// </param>
public void QnAddInsUpdate( ref System. Array custom)
/// <sufflBiary>
///
Implements the OnStartupComplete nethod of the
///
lDTExtensiblllty2 interface.
105
tit <>
/// Implements the QnfieflinShutdown method of the
///
IDTExtenslblUtyZ interface,
fit <summary>
/// Implements the QueryStatus method of the :
///
lOTCoffiBiandlarget interface.
///
This is called when the command's availability is updated.
/// </summary>
/// <param term-'commandNanie'>
/// The name of the command to determine state for.
/// </param>
/// <param te rra= ' neededText ' >
/// Text that is needed for the command.
/// </param>
/// <param term' status '>
/// The state of the command in the user interface.
/// </>
I. /// <param term='commandText'>
/// Text requested by the neededText parameter,
/// </param>
public void ClueryStatusCstring commandName,
EnvDTE.vsCommandStatusTextWanted neededText,
ref HnvOTE.vsCoBiBiafidStatus status, ref otiject commandText)
{
if (neededText ==
EnvDTE.vsCoiftiftanclStatusTextWanted.vsCoffliBandStatiisTextWaRtedfifone)
status,, =
. ,. .
106
{vsGoiBmandStatus)vsCOfflmantlStatus.vsCommandStatusSupporteci
vsCofflfflandStatus.vsCoBfflafidStatusEnabled;
jfl <summary>
///
Implements the Exec method of the lOTCoiaftandTarpet Interface.
///
/// </summary>
/// cparatn term='GQnimaRdNaBie'>
///
///
///
///
///
///
///
///
! :: :
handled = false;
if (execstteOption *
t)
if CcosraandNanie ** "HyAddin1.0oanect,HyAddin1")
{
hancfled = trte;
return;
using,
. ( Connect.cs , Add-in Wizard
using ,
, , .)
using: EnvDTE Extensibility;
107
Connect.cs ,
Add-in Wizard, ,
( ) MSI-, , Windows-
.NET Framework. ( ,NET Framework ; . 13-) , , MSI-
Windows Explorer, Visual Studio .NET. , Install
(. 5-2). .
108
. 5-2.
10 Slcrosoft.OMicei
*- -...
Comment Web Pagei
Detected Dependencies
^ dotnetf(redist_>a6.,T5
fi .
:
l dfeolb
^ EnvDIE.dH
i|3 ExtensMty.dl
MyAddr,1tl,
!3 tffee.di
$- stdcte
C-eate
i,
ATLJHFCIrace led
[GuIdlttrlBute [-41857
OLE/COM Obhct
Spyt*
External Tools,.,
'
i
id OnJiddlnsUcdat
UL_
. 5-3.
109
, ,
Tools | Add-in Manager,
(Add-in Manager) (. 5-4). Add-in Manager : , ,
.
Startup
Command Une
DLL, Class Library. DLL ,
-; Visual Studio
.NET (devenv.exe) Macros IDE (vsaenv.exe). Add-in Wizard , Visual Studio .NET.
, Solution Explorer, Properties, Configuration Properties | Debugging Property Pages (. 5-5),
.
Visual Studio
.NET, , , Start Debug ( F5).
Visual Studio .NET .
Visual Studio .NET,
, , , Visual Studio .NET.
, . .
Macros IDE Visual Studio .NET.
, Macros IDE Visual Studio .NET Macros
IDE. , , Visual Studio
110
i Properties
|3 ilorfigurejior Properbe
BuU
Debugging
Advanced
Fal
Fal
. 5-5.
: Visual Studio .NET,
. ,
DLL, . (, Microsoft CLR
Debugger, .NET Framework SDK, . 5- 6).
application
system. Object
-. xtensibihty.eit .ConnectMo*
eddlnlnst
System. Obct
System, Array
111
,
, Visual Studio .NET
. IDE: .
,
. Visual
Studio .NET . . ,
.
DTE.
DTE application OnConnection-,
DTE DTE.
DTE, .
,
Solution, Project Projectltem
.
Document TextDocument IDE.
TextSelection TextPoint ; EditPoint ~
, , , . ( ,
, , Addlns(Q) COMException
Activate @#&%*!.)
.
DTE, DTE.
. , Documents Document
112
, .
( ) Item .
Item , VARIANT.
Item .
1.
Count, SystemJnt32, long.
Collection, -;
Parent,
.
Add ; Remove Delete . (Delete ,
, ToolBoxTab;
Remove , Addln.)
DTEvents .
Object, .
;
, Visible True.
, , FullName.
Activate
; , Activate .
, Visual Studio .NET, a
. , Visual Studio .NET . Visual Studio .NET.
, , Visual Studio .NET, .
#, .
DTEEvents ~ . EnvDTE,vents,
(. 5-2). Events
, ,
, .
113
. 5-2. EnvDTE.Events
BuildEvents
QnBitildBegin
OnBuildDone
OnBuildProjConfigBegin
OnBuildProjConfigDone
AfterExecute
BeforeExecute
OnContextChanged
OnEnterBreakMode
OnEnterDesignMode
OnEnterRunMode
OnExceptionNolHandled
OnExceptionThroivn
DocumentClosing
DocumentOpened
DocumentOpening
DocumentSaved
ModeCbanged
OnBeginSbutdown
OnMacrosRuntimeReset
OnStartupComplete
FindDone
ItemAdded
ItemRemoved
ItemRenamed
PaneAdded
PaneClearing
PaneUpdated
OnChange
AfterClosing
BeforeClosing
Opened
ProjectAdded
ProjectRemoned
ProjectRenamed
QueryCloseSolution
Renamed
ItemAdded
ItemRemoved
ItemRenamed
TaskAdded
TasteModified
TaskNavigated
TaskRemoved
LineChanged
WindowActivated
WindowClosing
WindowCreated
WindowMoved
CommandEvents'
DebuggerEvents
DocumentEvents'
DTEEvents
FindEvents
MiscFilesEvents ( ProjectltemsEvents)
OutputWindowEvents'
SelectionEvents
SolutionEvents
TaskListEvents'
TextEdits-Events'
WindowEvems'
C# ,
, ' get .
get.
5 1116
114
. 5-2,
, , . Visual Studio .NET ; , .
, .
.NET Framework - (. ), . , _$<
>_< co6btmun>Evenfficmdler. , , ,
, +=. , . .
, , ,
, ,
, , .
, ButidEvents.OnBuildBegin ( ) . :
void OnBuildBegin(vsBuildScope scope, vsBuildAction action);
Visual Studio ,NET
scope action-, scope , (, ), a action (, , ).
- , .
:
public class Connect : Object, Extensibility. IDTExtensibUity2
private void OnBuildBegin(vsBuildScope scope. vsBuildAction action)
{
//
, . . 5-2
, BuildEvents, OnBeginButid jMspBuiMEventsJ3nBeginBuildEi>entHandler. :
public class Connect : Object, Extensibility. IDTExtensibility2
I
public void OnConnection(object application,
115
Extensibility.ext_ConnectMode connectMode,
object addlnlnst,
ref System.Array custom)
applicationObject = (_DTE)application;
addlnlnstance = (Addln)addlnlnst;
buildEvents = applicationObject.Events.BuildEvents;
buildEvents.QnBuildBegin +=
new _dispBuildEvents_OnBuildBeginEventHandler(
this.OnBuildBegin):
!
public void OnDisconnection(
Extensibility. ext_DisconnectHode disconnectMode,
ref System. Array custom)
buildEvents. OnSuildBegin -=
new _OispBijildEvents_OnBuildBeginEvent Handle (
this.OnBuildBegin);
I
'
private _DTE applicationQbject;
private Addln addlnlnstance;
private EnvDTE. BuildEvents buildEvents;
: QnConnection OnBuildBegin
, a OnDisconnection
.
! , .
, Visual Studio
.NET . , , - . ,
, , *, ..
116
, . EnvironmentEvents,
, . 5-2, Macros IDE. EnvironmentEvents , , Class Name, , , Method Name (. 5-7). Macros IDE .
Oyste
<s?ateB
<5ysten
Ofaten
ContewtStacici-ttcibgtej! > P-jti:c V:^li-:vent3 tebuggerEventa A^ EnvDTC.DebuoaerEven
. 5-7.
, EnvironmentEvents. He , Automatically generated code, do not modify* ( ; ), .
EnvironmentEvents , (, EnvironmentEvents).
, : . ^ MyWindowEvents :
<System.ContextStaticAttribute()> Public WithEvents
MyWindowEvents As EnvDTE,WindowEvents
117
, , ,
, EnvironmentEvents,
MyWindowEvents Class Name
Method Name.
EnvironmentEvents . , Macros IDE EnvironmentEvents, ,
.
DTEv<mts\
MyWindowEvents = DTE.Events.WindowEvents
. ,
, .
, - . DTEEvents ,
: OnStartupComplete, , Visual Studio .NET, OnMacrosRuntimeReset, , . EnvironmentEvents , :
Public Module EnvironmentEvents
Public Sub DTEEvents_OnMacrosfiuntimeReset() _
Handles OTEEvents.OnMacrosRuntimeReset
MyModule.MyWindowEvents = DTE.Events,WindowEvents
End Sub
Public Sub DTEEvents_OnStartupComplete() _
Handles OTEEvents.OnStartupComplete
MyModule.MyWindowEvents = DTE,Events.WindowEvents
End Sub
End Module
- ,
Visual Studio .NET. . , , . , WindowClosing
, Task
List. DTEEvents (. 5-3) .
II
118
. 5-3.
DTE.Events
CommandEvents
DocumentEvents
OutputWindowEvents
TaskListEvents
TextEditorEvents
WindowEvents
Document
TextDocument
Window
, IDE.
. 5-3 , WindowEvents
Window. Window EnvDTEWindows, Item EnvDTE.Constants.vsWindowKindxxx.
Window WindowEvents, . , Macro Explorer:
.
<System.ContextStaticAttribute()> Public WithEvents _
KacroExplorerWindowEvents As EnvHTE.WindowEvents
Sub InitializeMacroExplorerFilter()
Dim macroExplorerWindow As EnvDTE:.Window
macroExplorerWindow =
DTE.Windows.Item(EnvDTE.Constants.vsWindowKindMacroExplorer)
MacroExplorerWindowEvents =
DTE.Events, WindowEvents(macrci Explore rWindow)
End Sub
Sub MacroExplorerWindowEvents_WindowActivated(
ByVal GotFocus As EnvDTE.Window,
ByVal LostFocus As EnvDTE.Window)
Handles MacroExplorerWindowEvents.WindowActivated
:
Macro Explorer.
End Sub
:
? Output ,
FflteredEv&nts.
1,
119
2. ,
3. Enter.
Output LineChange< I
fired ( LineChanged).
4. , Output *DocumentSave<.i
fired* ( DocumentSaved )
' ' . . DocumentEvents TextMditorEm&ts &
,
. !
;:
,
1. InttializeJPtlteredEvents. New Fik- - '
DQcumentSaved\iLmeCb&nged'?%&,
,
2. New Fite Enter. Output
LineChanged fired*.
J. . : Output :'';
.
4. , Output.
5. New File. Output DocumentSaved fired*,
, Visual Studio .NET, ! ,
; .
. 5-4.
. 5-4.
Visual C
Visual Basic
Visual C++
CSharpBuildManagerEvents
CSbarpProjectsEuents
CSharpProjectltemsEvents
CSharpReferencesEvents
VBBuildManagerEvents
VBlmportsEi >ents
VBProjectsEvents
VBProjectltemsEvents
VBReferencesEvents
CodeModelEvents
VCProjectEngineEventsObject
120
,
, , : VBProjectsEvents, CSharpProjectltemsEvents . . ( Visual C++ ,
.) , DTEMvents.GetQbject. , , #-:
<System.ContextStaticAttribute()> Public WithEvents
CSharpProjectsEvents As EnvDTE.ProjectsEvents
Sub InitializeCSharpProjectsEvents()
CSharpProjectsEvents = DTE.Events,GetObject("CSharpProjectsEvents")
End Sub
, ,
CSharpProjectsEvents, ]! #-.
. Addin Wizard
. , . ' , .
6-1 Basic.
, . .
, : , ExtensibilitylDTExtensibility2. Basic.cs, #,
, Basic, IDTExtensibility2
5 : OnConnection, OnStartupComplete, OwAddInsUpdate, QnBeginShutdawn OnDisconnection. Main,
Basic, , DLL
OnConnection. Basic ,
.
122
6-1. Basic
Basic.cs
using System;
using Systffl.Windows. Forms;
using Extensibility;
public class. Basic : I8TExtensibtUty2
t
Basic
6-1
Basic.cs, Basic
:
esc /t: library /: "c:\program files\microsoft visual studio .net 2003\
common7\ide\publicassemblies\extensibility. dll" basic. cs
/(.-library #,
DLL (Basicdll), a tyii2.r/r;c:\programjiles\microsofl visual studio net 2003\common7\ide\publicassemblie$\extensibility.dH , Extensibility (Extensibility.dll). Extensibility
: IDTExtensibility2 , ext_ConnectMode ext_DisconnectMode, , OnConnection OnDisconnection .
123
, ,
.
, CSC.rsp, <WinDir>\Microsoft.NET\Framework\<Version>\CSC.rsp. , /r:*c;\programflles\microsoft visual studio .net 2003\common7\ide\publicassemblies\extensibility.dll->, Basic ;
esc / t : l i b r a r y basic.cs
Basic -
Basic.dll. , , , .
Visual Studio
.NET: Visual Studio .NET , , . , Visual
Studio . Visual Studio .NET
Visual Studio 6, . , Visual Studio 6
- , Visual Studio .NET .
, -. .NET Framework ,
,
, - .NET- . , .NET-,
, -. ,
.
HKEY_CLASSES_ROOT\<ProgID> , ProgID ,
IDTExtensibility2,
HKEY_CIASSES_ROOT\<ProgID>\CLSID ,
CLSID , IDTExtensibility2,
HKEY_CLASSES_ROOT\CLSID\<CLSID> , CLSID ,
IDTExten$ibility2.
HKEY_CLASSES_ROOT\CLSID\InprocServer32 , , IDTExtensibility2, , .
. 6-1 Basic.
Visual Studio .NET -.
, , , Visual Basic 6, , (,
.NET Framework ).
124
E* SHV
i ^J BDATu
t Jj 1
I U
ATSCChannelTurHRwiilBt.l
Nora*
^9Klas^f^=-l]D^eCA-a9lB6^
Type
FEGJSJ
[
Baslc.VerMn-D.D.O.O^Cirturp-neutral.PublkteyTok..
v-
W^ Co"IBUtsrV*EY_CI.ASK.- RO
. 6-1.
-: Basic
, :
.NET Framework Assembly
Registry (RegAsm). Baste -
regasm /codebase basic.dll
, RegAsm
, , /codebase
, /codebase
CLSID\InprocServer32\CodeBase CLR .
RegAsm ProglD CLSID jciacca,
'. (. GL1D FUID CLSID.)
ProglE) , . , :
namespace Outer
i
namespace Inner
:
ProglD Outer JnnerMyClass. Basic
, ProglD Basic,
125
HKEY_LOCAL_MACHINE\SOFT^rARE\Microsoft\VisualStudio\7.1\AddIns\<ProgID>
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\AddIns\<ProgID>
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSA\7.1\AddIns\<Progro>
HKEY_CURRENT_USER\Software\Microsoft\VSA\7.1\AddIns\<ProgID>
IDE Visual
Studio .NET.
Macros IDE.
Add-in Manager ,
Mdlns. HKEY_LOCAL_MACHINE
, _CAL_MACHINE , , - >-
126
, .
HKEY_CURRENT_USER , , HKEY_USERS; ,
. ProglD ,
ID TExtensibility2.
Basic (RegEdit)
(, ):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7,1\
AddIns\Basic
Visual Studio .NET Tools j Add-in Manager, Add-in Manager (. 6-2). : Add-in Manager
Basic Add-in Manager ProglD,
Addlns. (
ProglD, .)
Add-in Manager
Avaflable Add-ins
DJ
G
Description:
Cared
. 6-2.
HelD
. 6-3-
, Basic
127
. , ,
, Visual
Studio .NET IDTExtensibtiity2. , Visual Studio .NET IDTExten$ibility2.
IDTExten$ibility2, ,
. . 6-4
.
OnConneciion
1
OnAdatnsUpdate
QnStartupCoinptete
2
OnAddinsUpdate
.
Visual Studio .
OnBegmStwWo
QnBisconnection
1
,
, ,
1
. 6-4.
Add-in Manager
QnAddliisUpdate,
128
II
, , .
: nection , , OnDisconnection
. .
: , , ,
. OnAddlnsUpdate. , OnAddlnsUpdate. ,
. , Visual Studio .NET
. , OnConnection,
, :
OnAddlnsUpdate.
Add-in Manager,
OnAddlnsUpdate pan ,
/. , , OnAddlnsUpdate. , , , , OnAddlnsUpdate,
, - .
: , ,
OnAddlnsUpdate, , / Connected. ( . 7.) . .
, -
LifeCycle. IDTExtensibility2, Output ( 6-2). LifeCycle Visual Studio .NET, Add-in Manager. , Basic, lDTExtensibility2. OnStartupComplete,
Add-in Manager Startup LifeCycle,
Visual Studio .NET. OnBeginShutdown
Visual Studio .NET LifeCycle .
6-2. LifeCycle
LifeCycle.cs
namespace InsideVSNET
{
namespace Addlns
Sing EnwDTE;
using Exteftsibility;
using InsicfeVSNET. Utilities;
129
usirrg Syste;
using System.fiuntine, InteropServices;
COoldAttribute("DOC34F40-6A93-4601-8458-5A972E9C8D24")]
public class Life-Cycle : IDTExtensibilltyS
{
, ,
, Visual Studio .NET. (
, )
LifeCycle , File
New | Blank Solution. LifeCycle, File | Add Project
| New Project Visual C# Projects j Empty Project Add New Project.
, CS- LifeCycle.cs, File j Add New Item Code
File Add New Item.
130
II
: (output type) , ;
, DLL,
Properties.
Property Pages Common Properties | General , 1
Class Library Output Type.
-, Visual Studio .NET
, -.
- Configuration Properties | Build
LifeCycle Property Pages True
Register For COM Interop,
Apply ,
Register For (
Interop. Configuration Properties | Build,
, .-
,
Register For COM Interop.
6-2 CS-.
, , ,
EnvDTE, Extensibility, Utilities , . , References Solution Explorer Add Reference
. .NET Add References envdte, extensibility InsideVSNET.Utilities. LifeCycle.dll
.
IDTExtensibility2
, IDTExtensibility2. Visual Studio .NET ,
, /
Visual Studio .NET.
Visual Studio .NET , IDTExtensibility2
Visual Studio .NET.
EnvDTE
IDTExtensibility2, EnvDTE. EnvDTE
Environment Development Tools Extensibility ( ), : Visual Studio .NET. Visual
Studio .NET ,
131
140 , EnvDTE. , , , :
DTE ;
DTE.Addln , ;
DTEAddlns Addln, , IDE Visual Studio .NET;
DTE.Solution.Addlns Addln, .
DTE,
DTEAddln DTEAddlns, , . DTESolutionAddlns .
8.
IDTExtensibtiity2
, . ,
, , , IDTExtensibility2. , AddIn.Qbje< /.
IDispatch.
DisplayMessage MyAddln.Connect:
Dim dispObj As Object = DTE.Addlns.ItemC'MyAddln.Connect").Object
dispObj.DisplayMessage("IDispatch a message to you.")
OnConnection
, IDTExtensibility2 OnConnection. , IDE. OnConnection :
public void OnConnection(object application,
ext_ConnectMode connectMode,
object addlnlnst,
ref Array custom);
application EnvDTE&TE, . application
EnvDTEDTEClass, EnvDTEJDTE. EnvDTE._DTE. . _,
application DTE _DTE , (. , ,
EnvDTE.) , - , DTE,
OnConnection DTE .
132
, , ,
nvDTE. , , , Visual Studio
.NET, . EnvDTE
.NET Framework; EnvDTE
- Framework Pascal- .
EnvDTE . (.
, .)
(Design Time Extensibility, DTE) Visual Studio. , Visual Studio
.NET -. EnvDTE, Add Reference,
Type Library Importer (Tlblrnp) (dte.oib).
, . Env&TE ,
.
, Visual Studio Visual Studio .NET,
, Shift-
connectMode , . Extensibility.,ext_ConnectMode (. 6-1).
. 6-1. Extensibility.ext ConnectMode
ext_cm_AfterStartup
extjzm_Startup
ext_cm_External
sxt_cm_CommandLine
ext_cm_Solution
ext_cm_UlSetup
(Int32)
0x00000000
Visual Studio .NET,
0x00000001
Visual Studio .NET.
0x00000002
. ( Visual Studio .NET.)
0x00000003
.
0x00000004
.
0x00000005
.
connectMode
. , ext_cm_UISetup, ,
IDE. ( ext_cm_UISetup Add-in Wizard.)
133
addlnlnst
Addln, . (
Addln - .) ,
IDTExtensibility2 custom, , . Visual Studio .NET custom .
OnStartupComplete
OnStartupComplete ,
Visual Studio .NET. OnStartupComplete:
public void OnStartupComplete(ref Array custom);
, | OnConnection, .,
Visual Studio .NET
. OnStartupComplete,
, Visual Studio .NET .
OnAddlnsUpdate
OnAddlnsUpdate , Visual Studio .NET. . OnAddlnsUpdate :
public void OnAddInsUpdate(ref Array custom);
-
OnAddlnsUpdate. . , ,
, , . , DTEAddlns,. Addln ( ) Addln
Connected, . Addlns , AddlnsJtem ProgID
( 1). , COMException, , Addln.
InsideVSNET.Addlns.LifeCycle:
public void QnAddInsUpdate(ref Array custom)
{
try
Addln addln =
this.dte.Addlns.Iten("InsideVSNET.Addlns.LifeCycle ");
134
II
catch (COMException)
{
// InsideVSNET.Addlns. LifeCycle
// .
, , InsideVSNET.Addlns.LifeCycle .
LoadUnload ( 6-3) , : , OnAddlnsUpdate.
6-3. LoadUnload
LoadUnload.cs
namespace insideVSNET
; i
; :(
":-.:
using EnvDTE;
using Extensibility;
ysiRg IfisideVSHET. Utilities;
asiog HIcrosoft. Office. Core;
using System;
" using Systeie. Collections;
using System. Runtime. IrmsropServiees;
Prog Id {"LoadUnload. Connect")]
135
this.addlnstist[addIn.ProgIO} = addln,Connected;
this, output * new QutputWin.dowPaneEx(tbis,dte, this. title);
J
{
1 ' .;:'=:
if addln. Connected !=
Ct>ool)thls.addInsList[addIn.Progie 3)
{
string action = addln. Connected ?
"loaded" : "unloaded";
this, output. WriteLiRe(addIn.ProgID +
" was " + action, this. title):
else
I
string action = addln. Corrected ?
" and loaded" : String. Eftpty;
this. output, WriteLine(addIn.roglD *
" m$ added" + action, this. title);
. , ,
1 36
this.addlnsListtaddln.ProglO] * addln,Connected;
LoadUnload
addlnslist Sortedl.ist. , QnAddlnsUpdate,
LoadUnload , DTEAddlns-.
, . 6-3:
this.addlnsCollection.UpdateO;
foreach (Addln addln in this.addlnsCollection)
if
(this.addlnsList.Contains(addln.ProglD)}
if {addln. Connected 1=
(bool)this.addInsList[addIn.ProgID])
{
string action = addln. Connected ?
"loaded" : "unloaded";
this. output. WriteLine{addIn.ProgID +
" was " + action, this. title);
addlnsCollection DTEAddlns,
Update ,
. (Add-in Manager ,
Update) Update,
addlnsCollection ,
. , Connected .
, ,
Connected , (true)
(false).
137
addlnsList, , OnAddlnsUpdate.
, :
else
I
string action = addln.Connected ?
" and loaded" : String.Empty;
this.output.WriteLine(addIn.ProgID +
" was added" + action, this.title);
!
this.addInsl_ist[addIn.ProgID3 = addln.Connected;
i
Connected
, .
LoadUnload, , (, , , ), ,
OnBeginShutdown
OnBeginShutdown-.
public void OnBeginShutdown(ref Array custom);
, IDE . JDE , OnBeginShutdown , , IDE
, . , IDE,
IDE.
OnDisconnection
OnBeginShutdown ,
; OnBeginShutdown
IDE. OnDisconnection
, OnBeginSbutdoum. OnDisconnection :
public void OnDisconnection(ext_DisconnectMode removeMode,
ref Array custom);
IDTExt&nsibility2.ext_DisconnectMode removeMode , . ext_DisconnectMode . 6-2.
ext_DisconnectMode , extjConnectMode-.
, . , , ext_dm_UISetupComplete,
, , .
138
. 6-2. Extensibility.ext_DisconnectMode
ext_dm_HostSbutdown
ext_dm_Userlosed
ext_dm_UISetupComplete
ext_dm_SolutionClosed
(Int32)
0x00000000
Visual Studio .NET.
0x00000001
, Visual Studio .
0x00000002
.
0x00000003
, .
, Visual Studio .NET,
, ProgID, Addlns. , . .
CommandPreload PreloadAddinState
IDE: ,
. ,
IDE .
, ,
, ?
CommandPreload PreloadAddinState.
CommandPreload 0x1, Visual Studio
.NET, IDE IDE (, }. . 6-5 , Visual Studio .NET
.
, ;
, , , . .
Visual Studio .NET
, CommandPreload 0x1, ,
. , Visual Studio .NET ,
, ,
. CommandPreload , , Visual Studio
.NET 0x2
139
/ns
1?
extern
* -;
exljcmJ
extjfmj
0xtj$m_UfSettipGofnplets
CommandPfeload 0x2
. 6-5-
1 40
II
devenv /setup
IDE (
, IDE), CommandPreload 0x2 0.x 7 PreloadAddinState. Visual Studio .NET
. , .
LoadBehavior CommandLineSafe
LoadBehavior , ,
. . 6-3 LoadBehavior. ,
,
. :
.
141
. 6-3. LoadBehavior
ID UNLOADED
0x0
ID_STARTUP
IDJLOADED
ID_COMMANDJJNE
0x1
0x2
0x4
.
.
.
1DJJNLOADED IDJLOADED ,
Addln.Connected.
ID_STARTUP Visual Studio .NET
IDE. ,
, IDE, , . ,
, ,
.
ID_COMMAND_LINE , . : Visual Studio .NET 2002 , . 2002
, Add-in Manager (
, ID_STARTUP).
CommandLineSafe ID STARTUP ID_COMMAND_UNE,
, . CommandLineSafe, 0x1, , , , . CommandLineSafe
CommandLineSafe, 0x0, , . CommandLineSafe
.
?
, Visual Studio .NET - , , , .
, ,
,, , ,
, ,
. , Visual Studio .NET
2002 ,
:
, .
Visual Studio .MET 2003.
1. ,
2. Visual Studio .NET , IDjCOA 'MANDJJNE, extj:m_Commendline nection .
. , .
142
II
; 3. extjmjCommandLine .
Visual Studio .NET 2002
. IDjCOMMANDJUNB ; f; , iD_STAR*WP, Visual Studio ; |
.NET 2002 ext_cm_Comrnan4Line ,
; Visual Studio =
.NET 2003. Visual Studio .NET 2002,
, ID_STARTUP ,
, Syst&mnmronment,CommandLine ;
if (Regsx.IsMatcMSysteHi,Environment.CommandLine, "/build"
i
// .
System.Console.WriteLine("Command-line build- phooey on GUI!");
>
.else
<
// .
MessageB0x.Sftuw("6UI for yoyf");
}
QnConnectian,
, .
SatelliteDLLPath SatelliteDLLName
,
.
. ,
, DLL DLL , , .
,
DLL.
DLL SatelliteDLLPath SatelliteDLLName. SatelliteDLLName DLL ( , DLL
). SatelliteDLLPath DLL
DLL ,
, ,
DLL. , U.S. English 1033, DLL
U.S. English <SatdliteDLLPath>\].033\<SatelliteDLLName>. -
143
144
FriendlyName Description
FriendlyName Description
. , , Add-in Manager, FriendlyName Description Description .
FriendlyName Description ,
ID DLL ( ^resource ID>). DLL ; Add-in Manager Plus.
AboutBoxDetails AboutBoxIcon
AboutBoxDetails AboutBoxIcon About Visual Studio .NET (. 6-6). FriendlyName Installed Products;
, AboutBoxIcon Product
Details, AboutBoxDetails.
AboutBoxDetails, AboutBoxIcon
, About ; .
About Wicrssuft Development f nviroiimeni
0.96
iesewf
oltCperi*t.
ratrascft .NET FrsmeweV 1.0
Copyright j 998.B3I31 Mkroseft Corporation.
1.0.3705
6-6.
AboutBoxDetails , FriendlyName
Description: ID,
DLL ( #<resource ID>).
AboutBoxIcon , ,
:
145
! ,
, Win32, , , . ( Add-in Manager
Plus ,)
Icon Browser, ,
Web-: http://www.kennyandkarin.com/kenny.
-1116
1 46
,
: : ! : ? , , Visual Studio .NET
,
: , , . , ... !
(IDE). .
?
Microsoft Windows , , , . , , . Windows SDK,
, Visual C++, - ,
, .
, Microsoft Visual Basic .NET Microsoft Visual C# . (,
.
, , , - ,
Visual Studio .NET IDE ,
Win32. - IDE Visual Studio NET
, . .
, . ,
File | New File. (add-on) [ (add-in)], Visual
C++ .NET, Visual Basic .NET Visual C# .NET, Visual Studio .NET , .
II
148
Win32- ,
, Visual Studio .NET , .
(GUID) , GUID .
, GUID,
, GUID, .
. GUID, ,
, GUID, , , , New File
New Project. , GUID, ,
. , ID , , GUID . GUID ID
.
Visual Studio .NET
(, )
. , -
. .
Visual Studio .NET , , Command, Commands. , ,
Command ,
foreach (Visual C#) For Each (Visual Basic .NET),
, , Command.
Sub WalkCommandsO
Dim cmd As EnvDTE.Command
For Each cmd In DTE.Commands
'
EnvDTE.Command.
Next
End Sub
149
OOAA00573819}", 222)
, ,
GUID ID ( ) . CommandsJtem
.
GUID ID , Visual Sludio
.NET
. : ,
, , , , , , , . ,
( - ),
. Command , :
Sub FindFileOpenCommandByNameO
Dim command As EnvDTE.Command
command = DTE.Commands.Item("File.OpenFile")
End Sub
GUID ID , GUID
Command. GUID ID, ]
FindFileOpenCommand, . ,
:
Sub FindQuidlDPairt)
Dim guid As String
Dim id As Integer
Dim command As EnvOTE.Command
command = DTE.Commands.Item("File.OpenFile")
guid = command.Guid
id = command.ID
MsgBox(guid + ", " + id.ToStringO)
End Sub
Options
(. 7-1). Environment | Keyboard, .
150
Environment
General
Document:!
Dynamic Help
Text Editor
Database Tools
J3 Debugging
.
ia HTML Designer
ftsss shortcu
Global
Shortcut csitentfy used
Canes!
. 7-1. Options
. EnvDTE.Commands :
Sub CreateCommandListO
Dim command As EnvDTE.Command
Dim output As New OutputWindowPaneEx(DTE, "Create Command List")
For Each command In DTE.Commands
If (command.Name <> Nothing) Then
output.WriteLine(command.Name)
End If
Next
End Sub
Output .
, Nothing.
, , ,
Nothing Visual Basic .NET null #. .NET Framework SystetnString , ("").
, Nothing. Visual
Studio .NET, , , . , .
Visual Studio
,NET .
,
. . , -
151
, ( , ,
),
. Macro Explorer , . DTEExecuteCommand, , , ,
.
File.OpenFtte ExecuteCommand, :
Sub RunFileOpenCommandO
DTE.ExecuteCommand("File.OpenFile")
End Sub
ExecuteCommand , .
, , , 1, , , ; Enter, . ,
, , CommandName ExecuteCommand.
, , ,
, .
.Macros, , ,
, ; .
TurnOnLineNumbers Samples,
Visual Studio .NET, MacrosSamples.Utilities.TurnOnLineNumbers.
, , :
Sub RunCommandO
DTE.ExecuteCommandC"Macros.Samples.Utilities.TurnOnLineNumbers")
End Sub
. ,
, Visual Studio .NET, no GUID, ,
, . \ .
, . , ,
1 52
.
Addlnlnstance Addln, .
Name . , . ,
ToolTip .
MSOButton True, ,
, , ; False, DLL, .
Bitmap MSOButton True, . HTML- CommandUIBmps,
, . /SOButton False,
DLL.
ContextUIGUIDs .
$ystem.Object.
vsCommandDisabledFlagsValue
, . , , , , ,
, . , StatusOption IDTCommandTarget.QueiyStatus, .
AddNamedCommand ,
Visual Studio .NET. , ExecuteCommand, ProgID ,
Name. , , AddNamedCommand, mand, a ProgID MyAddin.Connect,
MyAddin.ConnectMyCommand.
, ,
GUID ID. GUID, , AddNamedCommand, EnvDTE.Constants.vsAddlnCmdGroup;
ID AddNamedCommand 1, 1. , ID,
153
, V i s u a l
Studio .NET , . , , ,
. ; . , , , , , ,
OnConnection IDTExtensibility2, (Add-in Manager)
.
( ),
.
IDTCommandTarget
lOleCommandTarget Win32 SDK, , IDispatch :
public interface IDTCommandTarget
{
public void ExecCstring CmdName,
EnvDTE.vsCommandExecOption ExecuteOption, ref object Variantln,
ref object VariantOut, ref bool Handled);
, ,
Exec. Exec .
CmdName . , , ( ), H.I , .
vsCommandExecOption
vsCommandExecOptionDoDefau.lt, ,
, , .
Variantln , , .
( ), null Nothing ( , ).
154
. , ,
.
: , (latched) (
,
).
QueryStatus IDTCommandTarget. ,
, AddNamedCommand. ( Add-in Manager),
QueryStatus.
.
CmdName , CmdName Exec IDTCommandTarget.
NeededText vsCommandStatusTextWantedNone. ,
Visual Studio .NET.
StatusOption , Visual Studio .NET ,
(vsCommandStatusSupported) (vsCommandStatusUnsupported);
(vsCommandStatusEnablecf); (vsCommandStatusInnisible);
(vsCommandStatusLatcbed).
, * .
CommandText Visual Studio
,NET, .
, , , , Visual Studio
.NET QueryStatus, , .
, QueryStatus, ,
. ,
155
,
. QueryStatus . , ,
, .
. , , , .
/ , , DTExecuteComtnand. ,
, , Visual Studio .NET,
QueryStatus, DTEExecuteCommand
( QueryStatus , , ), ( , .NET Framework).
CommandJsAvatlable. , ,
BuildBuildSolution , :
Sub CheckAvailabilityC)
If (DTE.Commands.Iteoi("Build.BuildSolution").IsAvailable = True) Then
DTE.ExecuteCommancK "Build. BuildSolution")
End If
End Sub
, Visual Studio .NET ,
,
IDTCommandTarget. ; , ProglD
, , AddNamedCommand
Name. Visual Studio .NET
ProglD , ,
ProglD, , . Visual Studio .NET IDTCommandTarget ( , tensibility2~) Exec,
.
, (. 7-2).
Yes, mandJDelete, .
,
IDTCommandTarget, , QueryStatus
vsCommandStatusUnsupported.
156
II
The Add-in supporting this rowi^nd could not be loadod. Do you wisli Co remove the comnand?
Visual Studio Microsoft Office.
, Office,
Visual Studio ,NET.
, .
DTE.CommandBars. Microsofl.Ojfice.Core.CommandBars, Office.dll.
:
Sub GetCommandBarsO
Dim coromandBars As Microsoft.Office.Core.CommandBars
commandBars = DTE.CommandBars
End Sub
,
Visual Studio .NET.
Microsoft.Office.Core.CommandBar, , .
, Microsoft.Office.Core.CommandBarControl,
- CommandBarControl
. CommandBarButton , ; Visual Studio .NET. CommandBarButton,
CommandBarControl-.
Sub GetCommandBarButtonO
Dim commandBarBtn As Microsoft.Office.Core.CommandBarButton
Dim commandBarCtl As Microsoft.Office.Core.CommandBarControl
Dim commandBarCtls As Microsoft.Office.Core.CommandBarControls
' View.
commandBarCtls = DTE.CommandBars.Item("View").Controls
' .
157
commandBarCtl = commandBarCtls.Item(l)
' CommandBarControl ComtnandBarButton.
commandBarBtn = CType(commandBarCtl,
Microsoft.Office.Core.CommandBarButton)
MsgBox(commandBarBtn.Caption)
End Sub
, Controls,
CommandBarPopup, .
New File; , . CommandBarPopup, , , New Project I INfew
Blank Solution Standard:
Sub GetCommandBarPopupQ
Dim commandBar As Microsoft.Office.Core.CommandBar
Dim cmdBarControl As Microsoft.Office.Core.CommandBarControl
Dim cmdBarPopup As Microsoft.Office.Core.CommandBarPopup
' "Standard"
commandBar = DTE.CommandBars.ItemC'Standard")
'
cmdBarControl = commandBar.Controls.Item(1)
' CommandBarControl CommandBarPopup
cmdBarPopup = CType(cmdBarControl,
Microsoft.Office.Co re.CommandBarPopup)
HsgBox(cmdBarPopup.Controls.Item(1).Caption)
End Sub
.
CommandBar, CommandBar, CommandBar, ( ).
DTE.CommandBars CommandBar,
Visual Studio .NET,
, File, Edit, View ;
CommandBar DTE.CommandBars. ,
, . , CommandBar View, View , .
View SQL.
View:
Sub GetViewO
Dim cmdbars As Microsoft.Office.Core.CommandBars
Dim commandBar As Microsoft.Office.Core.CommandBar
1 58
cmdbars = DTE.CommandBars
commandBar = cmdbars. Item("View")
End Sub
, CommandBar ,
, View:
Sub GetMenuCommandBarO
Dim commandBar As Microsoft.Office.Core.CommandBar
Dim cmdBarControl As Microsoft.Office.Core.CommandBarControl
Dim cmdBarPopupView As Microsoft.Office.Core.CommandBarPopup
Dim cmdBarView As Hicrosoft.Office,Core.CommandBar
' .
commandBar = DTE.CommandBars.Item("MenuBar")
' View.
cmdBarControl = commandBar.Controls.Item("View")
' CommandBarPopup
cmdBarPopupView = CType(cmdBarControl, _
Microsoft.Office.Core.CommandBarPopup)
' CommandBar View
cmdBarView = cmdBarPopupView.CommandBar
MsgBox(cmdBarView.Name)
End Sub
, , Tools,
Tools .
, Tools ;
.
, ,
, , .
Command ( Commands )
,
, .
Command AddControl. Visual Studio .NET
. ,
AddControl, ,
Visual Studio .NET .
AddControl CommandBar, .
( 1, , 2 . .).
,
, , . ,
159
(, -
),
. , . , , , QueryStatus
vsCommandStatusInvisible.
,
Controls.Count:
Sub AddControK)
Dim command As EnvDTE.Command
Dim commandBar As Microsoft.Office.Core.CommandBar
' File.OpenFile,
command = DTE.Commands.Item("File.OpenFile")
' Tools.
commandBar = DTE.CommandBars.Item("Tools")
' Tools ,
' File.OpenFile,
command.AddControl(commandBar, commandBar.Controls.Count + 1)
End Sub
:
. 1,
1,
.
, ,
. , .
, . ., Visual Studio .NET , .
, , .
Visual Studio .NET CommandsAddCommandBar,
public object AddCommandBarCstring Name, EnvDTE.vsCommandBarType Type, _
Microsoft.Office.Core.CommandBar CommandBarParent = null, int Position = 1)
.
Name , .
vsCommandBarType. vsCommandBarTypeToolbar,
, , Visual Studio .NET. Ecn
vsCommandBarTypeMenu, . vsCommandBaflypePopup,
.
1 60
II
CommandBarParent , ,
vsCommandBaftypeToolbar vsCommandBarTypePopup, null Nothing ( ).
, , vsCommandBarTypeMenu,
.
Position ,
vsCommandBarTypeMenu.
. ,
Position AddControl.
.
, ,
.
, Visible CommandBar True. ,
CommandBarSbowPopup, :
^, .
Visual Studio .NET
, .
, DLL, {
DLL . 6), CommandsAddNamedCommand, Visual Studio .NET . -
MSOButton AddNarnedComtnand false, . . ,
,
DLL. -, Bitmap (ID) DLL.
Visual Studio .NET
: 16x16 16 . Visual Studio .NET . ,
0,254,0 RGB (red, green, blue). ( - , Visual Studio .NET
Paint Windows.)
, , . CustomBitmap , . , DLL,
, ,
DLL.
, , ,
Tools, . , (CustomBicmap\ CustomBitmapUI\untitled.bmp) , ;
. , AddNamedCommand, .
161
( ) - . - ,
. Visual Studio .NET , Visual
Studio .NET. , , .
- Visual Studio .NET ,
.
,
. Visual Studio .NET,
File Exit ( ),
. V isual
Studio .NET, , , ,
,
, . ,
, *! .
. ,
,
, F5. ,
Visual Studio .NET ( File | Exit ),
. Visual Studio .NET
, . .
.
devenv /setup
. -,
Visual Studio .NET ( MS DOS)
devenv /setup. Visual Studio .NET , CommanciBar,
. devenv /setup
, Visual Studio .NET .
162
! devenv/setup : : , , (,
) .
ResetCmdBarlnfo,
. ResetCmdBarlnfo Tools.
Visual Studio .NET.
/setup. Visual Studio .NET
, .
, devenv /setup .
CommandPreload
(. 6), . Visual C++,
, .rgs, . NET-
, - Visual C++.
-
.NET. . NET Framework ,
SystemJtuntimeJnteropSeruices: ComRegisterFunctionAttribute
ComUnregisterFunctionAttribute. (#) (Visual Basic .NET) ,
System.Type, RegAsm- .NET - (
). , :
[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type t)
;
string progID = String.Empty;
foreach (System.Attribute attrib in t.GetCustomAttributes(false))
{
if (attrib.GetTypeO.FullNaroe ==
"System.Runtime.InteropServices.ProgldAttribute")
I
ProgldAttribute progldAttrlb = (ProgldAttribute)attrlb;
progID = progldAttrib.Value;
!
if (progID != String.Empty)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(
@"Software\Microsoft\VisualStudio\7.1\AddIns\" + progID,
true);
if (key != null)
I
if (((int)key.GetValue("CommandPreload", -1)) == 2)
:
key.SetValue("CommandPreload", 1);
if (((int)key.GetValue("CommandPreload", -1)) == 2)
key. SetValue( "CommandPreload" , 1 ) ;
[ComUnregisterFunctionAttribute]
public static void UnregisterFunctlon(Type t)
{
163
1 64
if (progID != String.Empty)
.
}
? , , , . , ,
ProgID - ProgldAffiibute. , ProgID
.
; 2. 1.
Visual Studio .NET Visual
Studio .NET ( ).
, .
. , Visual Studio .NET
, ,
. ReRegisterCS
.
, . ,
.
,
: . , ,
Tools. , ,
, View.
165
CommandPreload,
.
, ,
, , , Visual Studio .NET, AddN&~
medCommand , Delete, . . - ,
Visual Studio .NET , -::
.
, 10 , ,
10 ,
, .
, Visuiii
Studio .NET . , Visual Studio .NET , , .
Microsoft : Visual
Studio .NET . Microsoft
, : ,;1; , ,
. ,
.
, ; , Visual Studio .NET, ,
. CommandJDelete;
, , , , .
Sub DeleteMyCommandO
DTE.Commands.Item("MyAddin.Connect.MyCommand").DeleteO
End Sub
,
. , ,
- , . . , ( ) / . - , SystemCon-
166
ftgurationJnstallJnstaller Runlnstaller(true).
, Install Uninstatt,
. .
Add New Item Installer Class (. 7-3)Add New Hem - MyAddin
gortes;
| local Project Itarns
Text Rle
Frameset
Stylesheet
Windows
5ervice
XSLT Rle
Bitmap Fife
firisfalierl.es
Open
. 7-3.
caned
Help
System.Diagnostics.Process []processes =
System. Diagnostics. Process. Get ProcessesO;
foreach(System.Diagnostics.Process process in processes)
7
// try/catch.
// ,
//ProcessModule ,
try
{
if((process != null) && (process. MainModule != null))
(
//
// 'devenv.exe'.
string fileName = process. MainModule. FileName;
fileName = System. 10. Path. GetFileName(fileName);
if(System. String. Compare(fileName, "devenv.exe") -= 0)
return true;
>
;
catch (System. Exception ex)
i
return false;
public override void Uninstall(System. Collections. IDictionary savedState)
(
base, Uninstall( savedState);
System. Windows , Forms. MessageBox, Show( "Uninstall" ) ;
while(IsVSRunningO)
I
System. Windows. Forms. MessageBox. Snow( "A running instance of Visual " +
Studio .NET was found. \n\nPlease close all copies of Visual " +
"Studio .NET, then press OK.", "Uninstall...",
System. Windows. Forms.MessageBoxButtons.OK);
}
EnvDTE.DTE dte = new EnvDTE, DTEClassQ;
//
// .
//
// .
dte. Commands. It em( "MyAddinI . Connect . MyAddinI " , -1 ) . Delete( ) ;
.
public override void Install{System, Collections. IDictionary stateSaver)
I
base. Install(stateSaver);
System. Windows. Forms. MessageBox. Show( "Install");
while(IsVSRunningO)
I
System. Windows. Forms. MessageBox. Show("A running instance of Visual " +
"Studio .NET was found. \n\nPlease close all copies of Visual " +
"Studio .NET, then press OK.", "Install...",
167
1 68
II
System.Windows.Forms.MessageBoxButtons.OK);
I
EnvDTE.DTE dte = new EnvDTE.DTEClassC);
}
, .
, (Custom Actions
editor) :
View | Custom Actions. (primary
output) Uninstall Install ,
Custom Actions, Add Custom Action,
Application Folder Select Item In Project
Primary Output From Addin Project Name.
,
.
, .
. , , (. 7-2), Yes,
.
, , .
, DTEMxecuteCommand. , MyAddin.Connect.Command.
:
MyAddin.Connect.Command
MyAddin.Connect.Command My Parameters
IDTCommandTargetExec ,
Varln . Varln
My Parameters. , ( ),
Varln.
. ExecuteCommand;
ExecuteCommand .
, , , , .
, , . , .
Windows
169
/? .
Visual Studio .NET .
/? IDTCommandTargetJExec ExecuteOption,
vsCommandExecOption.vsCommandExecOptionShoivHelp. ,
, ,
Web- . CommandHelp
1
/' .
. , , :
Sub OptionalArguments(Optional ByVal optArg As String = "I am optional")
MsgBox(optArg)
End Sub
ExecuteCornmand,
, . , I am optional,
, .
, ,
, :
/?, .
:
Sub OptionalArguments2(Qptional ByVal optArg As String = "I am optional")
If (optArg = "/?"> Then
Dim helpString As String
helpString = "Usage: OptionalArguments [optArg]"
helpString = helpString + vbLf
helpString = helpString + "This macro will display in " + _
"a message box the passed argument."
HsgBox(helpString)
Else
HsgBox(optArg)
End If
End Sub
,
, . . ,
File, Open File, Ctrl+O, Open File ,
. CommandBindings . -
1 70
II
, , . ; , .
:
Sub GetFileOpenBindingsO
Dim bindings As Object()
Dim binding As Object
bindings = DTE.Commands.Item("File.QpenFile").Bindings
For Each binding In bindings
MsgBox(CStr(binding))
Next
End Sub
, .
:
::+,
|2 +2
.
, . , Ctrl+B HTML-
; (
), .
HTML-, , Ctrl+B
. ,
Global.
, . Ctrl+B , Global,
HTML Editor Design View , , HTML-, .
,
, . Alt, Shift Ctrl. ;
, +.
102- ( Windows-, Windows, , Fn ). , , Fl, F2 . . Esc,
. -, .
Shift Alt, Ctrl, , (, Shift+A ). ,
171
, - , , Shift ( ), Bkspce,
Del, Ins. , F1 F24, Enter. Break, -, -, -, -, Tab. Home, End, PgUp, PgDn, Esc, NUM
*, NUM -, NUM + NUM /, Caps Lock, Print Screen, Num Lock Pause
, .
2 2
. ,
. , , Ctrl+Shil't+D,
Ctrl+Shil't+D.
S . 2 , , 2 .
, Ctrl+Shift+D,O
Global, , :
Sub SetKeyBindingO
Dim command As Command
command = DTE.Commands.ItemC'File.OpenFile")
command.Bindings = "Global:;Ctrl+Shift+D,0"
End Sub
Bindings
, ,
System.Object,
SystemStting:
Sub SetKeyBindingsO
Dim command As Command
Dim bindings(l) As Object
bindings(O) = "Global::Ctrl+Shift+D, 0"
Dindings(l) = "Global::Ctrl+Shift+D, F"
command = DTE.Commands.Item("File.OpenFile")
command,Bindings = bindings
End Sub
,
, , , - , .
, Ctri+O
, , , :
Sub SetKeyBindingsPreserveO
Dim command As Command
Dim bindings() As Object
Dim preserveLength As Integer
command = DTE.Commands.ItemC'File.OpenFile")
' ,
bindings = command.Bindings
172
'
preserveLength = bindings.Length
' 2 (, preserveLength
' 1 , , ,
' 1, 2 ).
ReDim Preserve bindings(preserveLength + 1)
' .
bindings(preserveLength) = "Global::Ctrl+Shift+D,0"
bindingsCpreserveLength + 1) = "Global::Ctrl+Shift+D,F"
command.Bindings = bindings
End Sub
: Setting key bindings valid only when using a
non-built-in key binding scheme ( , , ).
, , Visual Studio
.NET, . , , .
Options Environment | Keyboard, Save As, Scheme Environment | Keyboard .
.vsk ( .vsk) , .
Visual Studio .NET
:
Sub ChangeKeyboardSchemeC)
Dim props As EnvDTE.Properties
Dim prop As EnvDTE.Property
Dim path As String
Dim folder As System.Environment.SpecialFolder
' Scheme Environment, Keyboard,
props = DTE. Properties("Environnient", "Keyboard")
prop = props,Itemf"Scheme")
' , ,
folder = System.Environment.SpecialFolder.ApplicationOata
path = System.Environment.GetFolderPath(folder)
path = path + "\Microsoft\VisualStudio\7.1\scheme.vsk"
' ,
prop.Value = path
End Sub
:
Visual Studio .NET
. .
- , -
173
, .
,
. ,
;
Sub GenerateCofflaandCheatSlisetO
Dim cmd As Command
Dim selection As TextSelection
Dim binding AS String
Dim newDocument As Document
' , .
newDocument ~ DTE.Ite0perations.NewFile(
"ral\Text File").Document
selection = fiewBeciment. Selection
' ;
For Each end In DTE.Commands
If {cmd.Name <> Nothing) Then
Diai str As String
'
' :
str = cmd.Hame
str 9 str.PadHi8ht(7G)
' .
If (cntd.Bindings, Length > 6) Then
For Each binding In cmd.Bindings
str = str + binding
selection.Insert(str + vbtf)
. -str ""
str = str.PadRight(70)
Next
Else
selection.Insert(str + vbLf)
End If
End If
Next
End Stjfc
Visual Studio .NET . , .
Visual Studio .NET (solution)
, , .
, ,
, . Solution Explorer, , . Solution Explorer, , , .
Visual Studio .NET EnvDTESolution, Solution DTE:
Sub GetSolution()
Dim solution As EnvDTE.Solution
solution = DTE.Solution
End Sub
175
,
Solution , . Solution
Solution Explorer . Visual Studio .NET
, ,
. ,
. (, ),
.
, SolutionSai -eAs,
( .sin), .
. , , SolutionSaveAs , .
Create. , . Create SaveAs, TI , :
Sub CreateAndSaveSolution()
DTE.Solution.Create{":\", "Solution")
DTE.Solution.SaveAs("C:\Solution.sin")
End Sub
,
, Solution.Open. CreateAndSaveSoIution, :
DTE.Solution.Open(":\Solution.sin")
, . , ,
. , . ItemOperationsPromptToSave, . ItemQperations, DTE,ItemOperations, .
PromptToSave ,
, , .
, . ,
, , .
PromptToSave Open:
Sub OpenSolution()
Dim promptResult As vsPromptResult
' :
promptResult = DTE.ItemOperations.PromptToSave
1 76
' Cancel,
' :
If promptResult <> vsPromptResult.vsPromptResultCancelled Then
DTE.Solution.Open("C:\Solution. sin")
End If
End Sub
, . . Solution
Close, . Boolean,
Visual Studio .NET .
true, ; false .
Solution Project , ,
, . Item , , . Solutionltem
Item. SolutionJtem
, . , , .
, Visual Studio .NET
, . (Visual Studio
.NET 2003 , ,)
Visual Studio .NET 7.1 ,
Item, .
Projecl.UniqueName.
, :
Sub EnumProjectsO
Dim project As EnvDTE.Project
For Each project In DTE.Solution
MsgBox(project.UniqueName)
Next
End Sub
Solution .
Solution Projects,
, ,
Solution.
, , Visual Studio .NET, ,
Solution . , , Projects. EnumProjects Projects:
177
Sub EnumProjects2()
Dim project As EnvDTE.Project
For Each project In DTE.Solution.Projects
MsgBox(project.UniqueName)
Next
End Sub
Solution Projects ,
, Solution
Explorer. DTEActiveSoiutionProjects.
Visual Studio .NET Solution Explorer .
,
Project . , , .
, . , :
Sub FindSelectedProjectsQ
Dim selectedProjects As Object()
Dim project As EnvDTE.Project
selectedProjects = DTE.ActiveSolutionProjects
For Each project In selectedProjects
MsgBox(project.UniqueName)
Next
End Sub
Visual Studio .NET ,
.
SolutionEvents,
EventsSolutionEvents. , , EnvironmentEvents , SolutionEvents
, .
.
void OpenedQ .
void Renamed (string OldName) . ,
,
.
void ProjectAdded(EnvDTE.Project Project)
. , ,
EnvDTEProject .
void ProjectRenamed(EnvDTE.Project Project, string OldName) .
. EnvDTEProject
7-1116
1 78
. , .
void ProjectRemoved(EnvDTE.Project Project)
.
EnvDTE Project . BeforeClosmg, ,
( , ) .
void QueryCloseSolution(ref 1 fCancel) , Visual Studio .NET .
Boolean. , true, , false. He
,
.
voidBeforeClosingO , , , ( ,
).
,
, .
voidAfterClosingQ .
SolutionEvents ( 8-1)
.
. QueryCloseSolution .
8-1.
Sol ution Events, s
RSiiespace SolutlonEvents
{
using
using
yslng
using
System;
Microsoft,Office,Gore;
Extensibility;
System.Runtime.InteropServices;
using EnvBTE;
(QuidAttribute(''1FFOC2Q3-SG36-4A54-A71A-BOF82BA6GBOC")f
ProgItf("SolutlonEvflfits. Connect")]
179
public CorweetO
solutioriEvents.AfterClosing -- new
_dispSolutionEvent3_AfterGlosingEventHandler(AfterClosing);
solutionEvents.BeforeClosiR^ -= new
dispSoltitionEvents_8eforeClosingEventHandler(8eforeClostng;;
solutionEvents. Opened ~~ new
. . .
1 80
II
SQlutionEvents.ProjectAdded -= new
_dispSalutionEvents_Pro3eetAddedEventHaficller{ProjectAdded);
solutionevents.ProjectRemovetf -= new
.dlspSolutlonEvents^ProjectRemovedEvHntHaftdler
{Projectfletnoved);
solutioflEvsflts.ProjectRenamed -= new
_dispSalutionEvents_ProjectRenamedEventHandler
<ProjectflenaBied);
SGlutionEvents.QueryClQseSolution -= new
_dispSolutionEvents_QueryCloseSolutiofiEventKandler<
QueryCloseSolution) ;
solutionEvents. Renamed -= new
_dispSalutiGnEvenl:s_RenamedEventHandler(Renamed};
//- SolutiorvEvents.AfterClosing:
//- SolutionEvents.BeforeClosing:
public void BeforeClosingO
{
System. Windows. Forms. MessageBox. Sho(
"SolutionEvents.BeforeClosing",
"Solution Events");
181
//- SolutlonEvents.ProJectMded.
// UniqueName .
public void Project Added (F-nvDTE. Project project)
{
System, Windows, Forms. MessageBox, Show{
"SolutionEvents.ProjectAddedXnProject: " + project. Uniqueflaroe,
"Solution Events"};
//- SolutionEvents.ProjectReBioved.
// MniqueName .
void ProjeetRemovad{nvDTE. Project project)
I
//- SolutionEvents.QueryGloseSoluttOfl..
//
// .
public void Renamed(string oldName)
{
System . Windows . Fo rres . HassageBox . Show(
. .
182
: ?
, ,
, . , .NET Framework. , :
public void Connect Sol tit ion Event sQ
{
EnvOTE.SoJutlonEvents solutionEvents;
solution Events = (ErwQTE. SolutionEvents)
applicationQbjeet.Events.SolutionEvents;
solutionEvents.Renaaed + new
dlspSoltiQREvent$_Renafli9dEventHandler(Renaieed);
6 , Visual Studio .NET
. ,
Visual Studio .NET.
183
.
ProgID - ProgID , .
Description . i Visual Studio .NET
1 84
, ,
.
. , . . Projectltems ,
, Projectltem .
Projectltems Projectltem.
Projectltems Projectltem,
Projectltems ProjectProjectltems;
Sub EnumTopLevelProjectltemsO
Dim projltem As EnvDTE.ProjectItem
Dim projectProjectltems As EnvDTE.Projectltems
Dim project As EnvDTE.Project
' :
project = DTE.Solution.Projects.]tem(1)
' :
ProjectProjectltems = project.Prcjectltems
' :
For Each projltem In projectProjectltems
185
MsgBox(projItem.Name)
Next
End Sub
, , .
, , Projectltem, Project!'terns.
, Projectltem
Projectltem, ProjectltemProjectitems,
Projectltems, .
Projectltem Projectltems
:
Sub EnumProjectItems(ByVal projltems As EnvDTE.Projectltems)
Dim projltem As EnvDTE.Projectltem
' Projectltem ;
For Each projltem In projltems
MsgBox(projltem.Name)
' :
EnumProjectltemsCprojltem.Projectltems)
Next
End Sub
Sub EnumProject()
Dim project As EnvDTE.Project
' :
project = DTE.Solution.Projects.Item(1)
EnumProjectItems(project.ProjectItems)
End Sub
EnumProject Projectltems , .
EnumProjectltems, Projectltem,
. Projectltem ,
EnumProjectltems .
Projectltem , .
, Windows Forms Web Forms,
.
(.resx-), Web Forms, ,
. Solution Explorer ,
, , .
Solution Explorer ,
Project Show All Files. EnumProject (. ), ProjectltemProjectitems ,
Projectltem . ^Project ,
Show All Files.
Solution Explorer.
1 86
II
. , Windows Forms (. 8-1):
| References
. 8-1.
Windows Forms
187
( Add-in
Wizard). MyAddinl MyAddin2
Connect.cs. Connect.cs :
Sub FindltemO
Dim projectltem As EnvDTE.Projectltem
projectltero = DTE.Solution.FindProjectItem("Connect.cs")
End Sub
, FindProjecffiem , , Projectltem : Projectltem
Connect.cs MyAddinl Projectltem Connect.cs MyAddin2. ,
, , ! >
, Connect.cs MyAddinl:
Sub FindltemWithFolderO
Dim projectltem As EnvDTE.Projectltem
projectltem = DTE.Solution.FindProjectItem("MyAddinl\Cormect.cs")
End Sub
, Projectltem ,
, :
Sub FindltemWithFullPathO
Dim projectltem As EnvDTE.Projectltem
projectltem =
DTE.Solution.FindProjectltemC"C:\Addins\MyAddin1\Connect.cs")
End Sub
. AddFromDirectory, AddFromFile, AddFromFtteCopy AddFromTemplate
Projectltems ( . 9).
ItemQperations, , .
Projectltems ItemOperations , Projectltems
, . ItemOperations ; , Solution Explorer, , ,
, . . Solution Explorer,
ItemOperations.
, ,
ItemOperations AddExistingltem . ,
. Visual Basic .NET # -
188
. , Solution Explorer ,
. Visual C++ : , , , . , , file.txt \. :
Sub AddExistingltemO
DTE. ItemOperations. AddExistingItein( ": \file.txt")
End Sub
Solution Explorer # Visual Basic .NET , file.txt ,
, .
Visual C++, , .
AddExistingltem , AddNewItem
.
:
public EnvDTE.Projectltem AddNewItem(string Item = "General\Text File" ,
string Name = "")
,
Add | Add New
Item, Add New Item (. 8-2).
Custom
Control
Inhered Use*
189
. ,
Windows Forms
(Local Project Items) .
>, ,
Windows Forms,
. , , , Windows Form*, ,
AddNeu'Item-. Local Project Items\Uf\Windows Form.
.
, .
, .
Projectltem : Remove
Delete, , Delete , ' , .
,
Visual Studio .NET ,
. , . , #
(references node), Setup .
,
.
Visual Studio .NET, , Project.
Object
Project. System.Objecl, , . VSProject, Visual Basic .NET *.
VSProject
VSLangProj.VSProject EnvDTEProject
Visual Basic .NET #. EnvDTEProject
, VSLangProj.VSProject
Project.Object. , ,
Projects Visual Basic #, VSProject
:
Sub
GetVSProject()
1 90
II
,
, ,
IntelHSense. ,
. ,
. -,
- . .
References Visual Basic
#, Add Reference .
VSLangPrqjJleferences, ,
. References VSProjectReferences. , References , :
Sub EnumReferencesO
Dim proj As EnvDTE.Project
Dim vsproj As VSLangProj.VSProject
Dim references As VSLangProj.References
Dim reference As VSLangProj.Reference
proj = DTE.Solution.Projects.Item(1)
vsproj = proj.Object
references = vsproj.References
For Each reference In references
MsgBox(reference.Name)
Next
End Sub
1 , ReferencesAdd
.
(global assembly cache, GAC), Add
. ,
/ . :
Sub AddReferenceToAssemblyO
Dim vsproj As VSLangProj.VSProject
Dim proj As EnvDTE.Project
proj = DTE.Solution.Projects.Item(1)
vsproj = CType(proj.Object, VSLangProj.VSProject)
vsproj.References.Add{"C:\Program Friles\Microsoft Visual Studio .NET "
& "2003\Common7\IDE\PublicAssemblies\extensibility.dll")
End Sub
191
tensibility2, .
, GAC, Visual Basic #
,
.
.
ReferencesAddProject. Project -:
Sub AddProjectReference()
Dim vsproj As VSLangProj.VSProject
Dim proj As EnvDTE.Project
' , :
proj = DTE.Solution.Projects.Item(1)
vsproj = CTypeCproj.Object, VSLangProj.VSProject)
' , :
proj = DTE.Solution.Projects.Item(2)
' :
vsproj.References.AddProject(proj)
End Sub
-
, , COM: GUID
(LIBIU), -,
. , -, a Visual Studio .NET .
Windows Media Player:
Sub AddCOMReferenceO
Dim vsproj As VSLangProj.VSProject
Dim proj As EnvDTE.Project
proj = DTE.Solution.Projects.Item(1)
vsproj = CType(proj.Object, VSLangProj.VSProject)
vsproj.References.AddActiveX(
"{22D6F304~BOF6-11DO-94AB-0080C74C7E95}", 1, 0)
End Sub
Web-
.NET Framework , .
Web- XML. Web- ,
,
. Visual Studio .NET Web- XML Web-.
Web- XML ,
Web Services Description Language (WSDL) WSDL-
- (,
1 92
II
). - Web- XML.
Web-. VSProject
AddWebReference, URL Web-.
Web- TerraServer, Microsoft, . Web- bt(p://terra$erver.bomeadvisor.msn.com/TerraSenice.asmx
Sub AddTerraServerWebRefC)
Dim vsProj As VSLangProj.VSProject
Dim serviceURL As String
' URL Web- TerraServer.
serviceURL = "http://terraserver.microsoft.net/rraService.asmx"
' VSProject .
vsProj = DTE.Solution.Projects.Item{1).Object
' Web-.
vsProj.AddWebReference(serviceURL)
End Sub
: Web- XML
!
, ,
. , , , . . ? , , , Web- ;
TerraServer., Web- GPS-.
# Web-
TerraServer, ,
. , Place,
, , TerraSen'ice.(jefPlaceFacfs.
PlaceJFacts, . ,
, ;
,' ,- , .
193
Imports
,
Visual Basic .NET # Imports using, , , .
, , :
System.Windows.Forms.HessageBox.ShowC"Hello World")
,
, . , Visual Basic Imports-.
Imports System,Windows.Forms
:
MessageBox.Show("Hello World")
Visual Basic
Property Pages (. 8-3) Imports .
, , , Imports.
194
. 8-3-
Property Pages
VSProjectJmports, , . Visual Basic .NET SystemXML:
Sub AddSystemXMLImportO
Dim vsProj As VSLangProj.VSProject
Dim vslmports As VSLangProj.Imports
vsProj = DTE.Solution.Projects.Item(1).Object
vsProj.Imports.AdcK"System.Xml")
End Sub
195
"Project properties")
project = DTE.Solution.Projects.Item(1)
properties = project.Properties
For Each [property] In properties
owp.WriteLineC'Name; " + [property].Name)
owp.WriteLineC'Value: " + [property].Value.ToStringO)
owp.Writel_ine("Type: " + [property]. Value.GetTypeO. FullName)
owp.WriteLineO
Next
End Sub
Property
, . . ,
, Icon.ico
.
Sub SetProjectlconO
Dim project As EnvDTE.Project
Dim [property] As EnvDTE.Property
Dim projectPath As String
project = DTE.Solution.Projects.Item(1)
' Property :
[property] = project.Properties.Item("ApplicationIcon")
' :
projectPath = project.FullName
projectPath = System.10.Path.GetDirectoryName(projectPath)
projectPath = projectPath + "\Icon.ico"
' :
[property].Value = projectPath
End Sub
Visual Studio .NET
Visual Studio .NET . ,
, .
, Microsoft Word, . , Visual Studio .NET , Visual Studio .NET Visual Basic .NET, C# Visual C++.
Miscellaneous Files
,
. Miscellaneous Files,
, -
1 96
, , . Miscellaneous Files
, . Miscellaneous Files
Solution Explorer,
, Tools Options, Environment |
Documents Show Miscellaneous Files In Solution Explorer.
Miscellaneous Files ,
. <MiscFiles>
vsMiscFilesProjectUniqueName. Project Miscellaneous Files:
Sub FindMiscFilesProject()
Dim project As EnvDTE.Project
Dim projects As EnvDTE.Projects
projects = DTE.Solution.Projects
project = projects.Item(EnvDTE.Constants.vsMiscFilesProjectUniqueName)
End Sub
Miscellaneous Files
SolutionProjects, Project , Project, , Visual Basic
.NET #, , null
Nothing SystemNotlmplementedException.
Project,
Miscellaneous Files, Projectltem Projectltems. (. 8-1):
. 8-1. Project, Projectltems Projectltem
Project
Projectltems
DTE
DTE
Projectltem
DTE
Projectltems
Name ()
UniqueName
Kind
FullName
Parent
Item
GetEnumerator / _Neivlinum
Kind
Count
ContamingProject
Collection
Name ()
FtieCount
Kind
Filenames
SaveAs
Save
FsOpen
Open
Delete
Remove
ExpandView
ContainingProject
IsDirty
197
Solution Items
Miscellaneous Files . , Miscellaneous Files,
; , Solution Items,
. ,
, ,
, ,
. Miscellaneous Files,
Solution Items ,
EnvDTEJProject (, ). ' Solution Items , . 8-1, Miscellaneous
Files, Solution Items
SolutionProjects, Solution
Items. vsSolutionltemsProjectUniqueName:
Sub FindSolutionltemsProjectO
Dim project As EnvDTE.Project
Dim projects As EnvDTE.Projects
projects = DTE.Solution.Projects
project = projects, Iten(
EnvDTE.Constants.vsSolutionltemsProjectUniqueName)
End Sub
, , Project,
. , ,
198
Project | Unload Project, Project, , Visual Studio -NET (unmodeled project type). Project,
: DTE, Kind Name.
Project , , ,
. ProjectKind, EnvDTE.Constants.vsProjectKindUnmodeled,
. , :
Sub FindUnmodeledProjectsO
Dim i As Integer
For i = 1 To DTE.Solution.Projects.Count
Dim project As EnvDTE.Project
project = DTE.Solution.Projects.Item(i)
If (project.Kind = EnvDTE.Constants.vsProjectKindllnmodeled) Then
MsgBox(project.Name + " is unmodeled")
End If
Next
End Sub
, , ,
FindUnmodeledProjects
. Visual Studio .NET, Project . ;
.
, ,
,
, . , ,
-,
. : , , , ,
, :
void ItemAdded(ByVal Project As EnvDTE.Project)
void ItemRemoved(Byval Project As EnvDTE.Project)
void IternRenanted(ByVal Project As EnvDTE.Project,
ByVal OldName As String)
:
199
200
Miscellaneous Files
Solution Items, . , Events.GetObject. ,
Visual Basic .NET , VBProjectsEvents
VBProjecffiemsEvents. VJSbarpProjectsEvents VJSbarpProjectitemsEvents Microsoft Visual J#, a eCSbarpProjectsEvents
eCSbarpProjectltemsEvents # Smart Device Application.
eVBProjectsEvents eVBProjectltemsEvents Visual Basic .NET smart device application. ProjectEvents
. , ,
.
,
, . Visual Studio .NET . SolutionBuUd;
SolutionSolutionBuild. ConfigurationManager .
Project.ConfigurationManager,
Visual Studio .NET (solution configurations). , .
,
. ,
,
.
(debug) (release),
. ,
Windows Forms, Visual Studio .NET ,
Windows Forms,
, Windows
Forms. ,
, , .
SolutionConfiguration SolutionContext
SolutionConfigurations, SolutionConfiguration. -
SolutionConfigurations ,
Item
201
SolutionConfiguration . SolutionConfigurationsAdd, :
public ErwDTE.SolutionConfiguration Add(string NewName,
string ExistingName, bool Propagate)
, .
NewName ,
. ( \, /,:, *, ?, , <
>.)
ExistingName ,
, <Default>*.
<Default>, .
Propagate true, ,
, , , . false, , ,
.
SolutionConfiguration , . Activate; ,
SolutionBuildBuild, SolutionConfiguration . , - .
SolutionContexts. , SolutionConfiguration
, . SolutionConfigurationSolutionContexts , .
, , ConfigurationName SolutionContext
, . , :
Sub ChangeProjectConfigurationO
Dim solutionBuild As EnvDTE.SolutionBuild
Dim solutionCfgs As EnvDTE.SolutionConfigurations
Dim solutionCfg As ErwDTE.SolutionConftguration
Dim solutionContext As EnvDTE.SolutionContext
' :
solutionBuild = DTE.Solution.SolutionBuild
II
202
solutionCfgs = solution8uild.Sol.utionConfigurations
solutionCfg = solutionCfgs.Item("Debug")
' :
solutionContext = solutionCfg.SolutionContexts.Item(l)
'
' :
solutionContext.ConfigurationName = "Release"
' :
solutionContext.ShouldBuild = True
End Sub
SolutionContext , ,
, , ,
. , ShouldBuild true.
, , .
,
.
( , F5),
, , , , , .
,
Solution Explorer Set StartUp Projects.
Solution Property Pages (. 8-4),
, Windows Forms.
. 8-4. ,
203
SolutionBuildStartupProjects.
System.Qbject, ,
. , StartupProjects,
: , ( ,
), System.Qbject (
, ).
, ,
. :
Sub SetStartupProjects()
Dim startupProjects(l) As Object
startupProjects(O) = DTE.Solution.Projects.Item(1).UniqueName
startupProjectsd) = DTE.Solution.Projects.Item(2).UniqueName
DTE.Solution.SolutionBuild.StartupProjects = StartupProjects
End Sub
, :
Sub SetStartupProjectO
Dint startupProject As String
startupProject = DTE.Solution.Projects.Item(1).UniqueName
DTE.Solution.SolutionBuild.StartupProjects = startupProject
End Sub
, , , . , SolutionButidStartupProjects, , , Miscellaneous Files
Solution Items, .
Visual Studio .NET ,
SolutionButidStartupProjects .
. Multiple
Startup Projects ; . SolutionBuild StartupProjects .
, , ,
. UserControl,
Windows Forms WinForm.
UserControl Windows Forms, UserControl WinForm. ,
(project dependency).
; 8-5
204
II
WinForm UserControl.
, .
WinFarm
UserControl
. 8-5. ,
WinPonn UserControl
, :
ClassLib, , WinForm.
UserControl. , 8-6.
WinForm
UserControl
ClassUb
. 8-6.
, WinForm ,
UserControl ClassLib. UserControl
ClassLib.
UserControl, ClassLib.
ClassLib, , . UserControl ClassLib ,
. , , WinForm.
.
,
, .
, WinForm UserControl, UserControl ClassLib, a ClassLib WinForm. ,
. 8-7.
ClassLib
. 8-7.
205
. 8-8.
206
II
Next
End If
owp.WriteLine()
Next
End Sub
BuildDependency , . , , WinForm, UserContro!
ClassLib, . BuildDependency
, : AddProject, RemoveProject RemoveAttProjects. AddProject RemoveProject ,
. RemoveAUProjects . SetDependencies
, -
. 8-6:
Sub SetDependenciesf)
Dim buildDependencies As EnvDTE,BuildDependencies
Dim buildDependency As EnvDTE.BuildDependency
Dim project As EnvDTE.Project
Dim winFormUniqueName As String
Dim userControlUniqueName As String
Dim classLibllniqueName As String
' .
For Each project In DTE,Solution.Projects
If (project.Name = "WinForm") Then
winFormUniqueName = project.UniqueName
Elself (project.Name = "UserControl") Then
LiserControlUniqueName = project.UniqueName
Elself (project.Name = "ClassLib") Then
classLibUniqueName = project.UniqueName
End If
Next
buildDependencies = DTE,Solution.SolutionBuild.BuildDependencies
For Each buildDependency In buildDependencies
If (buildDependency,Project.Name = "WinForm") Then
buildDependency.RemoveAllProjects()
' , WinForm.
' :
buildDependency.AddProject(userControlUniqueName)
buildDependency.AddProjct(classLibUniqueName)
Elself (buildDependency.Project,Name = "UserControl") Then
buildDependency.RemoveAilProjectsO
' ClassLib:
buildDependency.AddProject(classLibUniqueName)
207
End If
Next
End Sub
.
, ,
. , .
ConfigurationManager
ConfigurationManager,
Configuration . ,
(, ),
, .
Visual Studio .NET Win32 32-
Windows 8, .NET,
Microsoft .NET, Pocket PC Windows ,
Windows .
, .
.
Item, -.
Item ConfigurationManagerJtem . . ,
Item Configuration ,
. , Solution Explorer Visual C++. Configuration
Win32 :
Sub RetrieveDebugWin32Configuration()
project = DTE.Solution.Projects.Item(1)
config = project.ConfigurationManager.ItemC'Debug", "Win32")
End Sub
ConfigurationManager.ConfigurationRow ConfigumtionManagerPlatform,
. Configuration, , . ConfigurationRow
; Platform
. , , , ,
Win32 Visual C++ .
208
II
, , . ConfigurationManagerAddConflgurationRow.
,
, AddConfigurationRow
Boolean. Propagate
, Propagate SolutionConflgurationsAdd, . SolutionConfigurationsAdd
Propagate, true,
, . AddConfigurationRow Propagate, true, , ,
.
ConfigurationManager AddPlatform, , AddConfigurationRow, . Microsoft ,
. ,
Microsoft.
,
, ,
-
209
. , Win32 .NET; ,
, . , <N/A>,
.
, ,
, ,
, .
, ConfigurationProperties. SetManagedExtensionsProperty, EnvDTEProperties , Visual Studio
.NET .
, Optimize ( Boolean), . , Optimize
.
Sub SwapOptimizationSettings()
Dim project As EnvDTE.Project
Dim configManager As EnvDTE.ConfigurationManager
Dim configs As EnvDTE.Configurations
Dim config As EnvDTE,Configuration
Dim props As EnvOTE.Properties
' ConfigurationManager :
project = DTE.Solution.Projects.Item(1)
configManager = project.ConfigurationHanager
' ,
configs = configManager.ConfigurationRow("Debug")
' .
For Each config In configs
Dim optimize As Boolean
' Optimize .
props = config.Properties
optimize = props.Item("0ptimize").Value
' .
props.Item("Optimize").Value = Not optimize
Next
' .
configs = configManager.ConfigurationRow("Release")
For Each config In configs
Dim optimize As Boolean
' Optimize .
21 0
End Sub
Visual Studio .NET ,
,
. . :
void OnBuildBegin(EnvDTE.vsBuildScope Scope, EnvDTE.vsBuildAction Action);
void OnBuildPro]ConfigBegin(string Project, string ProjectConfig,
string Platform, string SolutionConfig);
void OnBuildProjConfigDone(string Project, string ProjectConfig,
string Platform, string SolutionConfig, bool Success);
void OnBuildDoneCEnvOTE.vsBuildScope Scope, EnvDTE.vsBuildAction Action);
.
OnBuildBegin . .
EnvDTE.vsBuildScope. vsBuildScopeBatch (
> ), vsBuildScopeProject ( ,
Build) vsBuildScopeSolution ( ).
EnvDTE.vsBuildAction vsBuildActionBuild (
), vsBuildActionClean (
), vsBuildActionDeploy ( ) vsBuildActionRebuildAtt (
,
).
OnBuildProjConfigBegin
. string:
, , , .
OnBuildProjConfigDone . , OnBuildProjConfigBegin, Boolean, , : (true) (false).
OnBuildDone
.
211
BuildEvents,
. , , )-. , ,
(ClassLibraryl ClassLibrary2),
, Build | Build Solution, :
OnBuildBegin
Scope: vsBuildScopeSolution
Action: vsBuildActionBuild
OnBuildProjConfigBegin
Project: ClassLibraryl.csproj
Platform: .NET
Solution Configuration: Debug
OnBuildProjConfigOone
Project: ClassLibraryl.csproj
Platform: .NET
Solution Configuration: Debug
Success: True
OnBuildProjConfigBegin
Project: .,\ClassLibrary2\ClassLibrary2.csproj
Platform: .NET
Solution Configuration: Debug
OnBuildProjConfigDone
Project: ..\ClassLibrary2\ClassLibrary2.csproj
Platform: .NET
Solution Configuration: Debug
Success: True
OnBuildDone
Scope: vsBuildScopeSolution
Action: vsBuildActionBuild
.
OnBuildBegin,
OnBuildDone, . Visual Studio .NET 2003 OnBuildProjConfigBegin OnBuildProjConfigEnd
.
,
Visual Studio .NET, , , .
, .
212
II
IDE
.
EnvDTE.Globals. Globals
:
Sub SolutionGlobalsO
Dim globals As EnvDTE.Globals
globals = DTE.Solution.Globals
End Sub
Sub ProjectGlobalsO
Dim globals As EnvDTE.Globals
globals = DTE.Solution.Projects.Item(1).Globals
End Sub
213
// . :
System. Int32 int32;
int32 = System, Int32.Parse(Cstring)globals["BuilijCounter"]);
int32++;
globals["BuildCounter"] = int32.ToString();
else
// . :
globals["BuildCounter"] = I .ToStringO;
globals. set_VariablePersists( "BuildCounter", true);
,
. ,
.
Visual Studio .NET.
9
Visual Studio .NET
. Windows , , , . Visual Studio .NET .
Visual Studio .NET . ,
(New Project wizard),
. New Project,
File | New | Project.
(Add New Item
wizard). , , , Web-.
Solution Explorer Add | Add New Item. Add New Item .
(Custom wizard). Visual Studio .NET ,
.
,
. Visual Studio .NET.
215
-, EnvDTEJDTWizard. Execute ,
, Visual Studio .NET . :
public interface IDTWizard
{
public void Execute(object Application, int hwndOwner,
ref object[] ContextParams,
ref object[] OustParams,
216
. 9-1. ContextParams,
EnvDTE.Constants.vsWizardNewProject,
.
.
, .
, Visual Studio .NET.
true,
, false
.
, , . , New
Project Create Directory For Solution.
, , . true,
.
. 9-2. ContextParams,
EnvDTE.Constants.i>sWizardAddItem.
, .
EnvDTEProjectltems, .
, .
. Name
Add New Item.
,
.
, , , true,
.
,
Visual Studio .NET, , . CustomParams .
, . EnvDTE.Constants.v$WizardNewProject ( ) EnvDTE.Constants.vsWizardAddltem (
). GUID ,
, ivizardResult.ivizardResultFailure retval ID'lWizardMxecute.
217
GUID, ,
, vsWizardNewProject vsWizardAddltem , ,
Visual Studio .NET ContextParams.
,
ContextParams ( 9-1).
9-1. ,
Wizard.cs
using System;
using System.ftuntime-InteropServiees;
namespace BasicWizard
{
[QuitiAttfibLtteC'E5DOA8B2-A449-4d3b-B478-99494D23A58B"),
ProgldAttribute("HyWizard.Wizard")]
public class Wizard : EnvDTE.IDTWizard
{
}
else if(Systen.String.ComparedwizardType,
EnvDTE.Constants.^WizardAddltem, true) ~ 0)
{
string projectNaae = -(strlrujJContextParantsfn;
EnvDTE,Projectltems projectlteis =
(EnvDTE.P roj ectltems)ContextPa rams[2];
string newltentlocation = (string)ContextParaiBsl33:
string newItemNaiae = (string)GontextParaBsI43i
productlnstallDlrectory = (string}GontextParamsC5];
. :), .
218
//01 .
.vsz-
6, , Visual
Studio .NET , , . , , ProgID -"
, .
,
.
.vsz-.
.VS2 .
VSWIZARD 7.0, Visual Studio .NET, Visual Studio .NET 7
. ,
Wizard=, ProgID (ClassID) COM, . ProgID Wizard.cs 9-1) .vsz- :
Wizard=MyWizard.Wizard
ClassID:
imard={E5DOA8B2-A449-4d3b-B47B-99494D23A58B}
ProgID ClassID , . ,
( .vsz- ) . <<=*,
( 0).
:
Param=Hello World
Param=Second line of data
CustomParams
Execute , #:
for(int i = 0 ; i < CustomParams.Length ;
<
string data = (string)CustomParams[i];
219
System.Windows.Forms.MessageBox.Show(data);
.vsz-
, .vsz- , New Project Add New Item.
.
,
.
, , , .
, . 9-1 New Project , Extensibility Projects ( ,
.vsz- ) A Sub Folder. Extensibility Projects A Sub Folder,
, .
A Sub Folder C:\Program Files\Microsoft Visual Studio
.NET 2003\Common7\IDE\Extensibility Projects ( , ).
220
TemplatePatb
VSZFilePath, He Template () ( ).
prjKindVBProject prjKindCSharpProject, VSLangProj.dll, GUID, . , , Visual Basic #,
, TemplatePath , . GUID
. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1 \Projects GUID, , Visual Studio .NET.
Solution.TemplatePath GUID, , .vsz-, New Project
, . vcproj ( Visual C++),
, GUID Visual C++ - {898-84-11DO-8D1191942}. GUID ,
.vsz-, New Project
Visual C++ Projects:
Sub VSZLocation2()
1
.vsz- Visual C++:
HsgBox(OTE.Solution.TempiatePath
"{07CD18B1-3BA1-11d2-890A-0060083196C6}"))
End Sub
.vsz- (. 9-1).
.vsz-, (.ico)
, .vsz-, . .vsz Visual Studio .NET Add-in, vsz. , Visual Studio .NET Add-in.ico,
; .vsz- , , Windows .
Add New Item ,
New Project. , -
221
? :
. ,
,
, . , , , ( ) , , .
, -
222
,
. ,
, . Visual Basic ,
, .
, , ,
, Visual Studio
.NET . 8 , ^ Solution-. AddFromFile
wAddFromTemplate. . AddFromFile
,
, . ,
Solution Explorer , Add |
Add Existing Project . , ,
, , , , ,
. MtTORAddFromTemplate,
. AddFromTemplate:
public EnvDTE.Project
223
AddFromTemplate AddFromFile , . , -
, .
Templates, ,
-, . , .NET Framework, , :
string templatePath =
System.Reflection.Assembly.GetExecutingAssembly().Location;
templatePath = System.10.Path.GetDirectoryName(templatePath) +
"\\Templates\\";
Me?iQRAddPromTemplate , ProjectItems :
AddFromDirectory, AddFromFileCopy, AddFromFile AddFromTemplate. AddFromDirectory
;
, . AddFromFileCopy AddFromFile
, . AddFromFileCopy
.
AddFromFileCopy AddFromTemplate Projectltems
( AddFromTemplate Solution} , AddFromTemplate
, .
:
public EnvDTE.Projectltem AddFromDirectory(string Directory)
public EnvDTE.Projectltem AddFromFileCopy(string FilePath)
public EnvDTE.Projectltem AddFromFile(string FileName)
public EnvDTE.Projectltem AddFromTemplate(string FileName, string Name)
Directory .
FilePath/FileName ,
.
Name . .
Projectltem, , (,
).
, , ContextParams , Create Directory For Solution,
, More New Project.
, New Solution Name,
.
, SolutionAddFromTemplate
224
II
, ContextParams
, ( ContextParams true )
, . . ,
, .
Solution.Create (.
8), .
, ,
, ContextParams.
.
, . , # (#
Class Library Wizard), Class 1, ,
, , (, Wizard,
). ,
,
. ,
. , ,
, . , ,
%CIASSNAME%, :
public class XCLASSNAMES!
(
public XCLASSNAHEXO
//
// TODO: Add constructor logic here
MakeReplacements . , , EnvDTE.TextPoint, 1 1.
Sub MakeReplacements(ByVal projectltem As EnvDTE.Projectltem,
ByVal token As String,
225
TextDocument :
textDocument = window.Document.Object("TextDocument")
' replaceWith:
textDocument.ReplacePatternftoken, replaceWith,
findOptions, textRanges)
End Sub
( Projectltem, Add'
Projectltems), %CIASSNAME% MyClass
:
Sub MakeReplacementsf)
MakeReplacements(DTE.ActiveWindow.ProjectItem,
"KCLASSNAMEV, "MyClass"}
End Sub
,
. , , , Choose Add-in Options Yes, Create A Tools'
Menu Item ( Tools). '
:
Sub DeleteBetweenTokens(ByVal projectltem As EnvDTE.Projectltem,
ByVal token! As String,
ByVal token2 As String)
Dim window As EnvDTE.Window
Dim textDocument As EnvDTE.TextDocument
Dim tokenEndPoint As EditPoint
Dim tokenStartPoint As EditPoint
Dim findOptions As Integer
findOptions = EnvDTE.vsFindOptions.vsFindOptionsMatchCase + _
EnvDTE.vsFindOptions.vsFindOptionsMatchWholeWord
' .
1
, :
window = projectltem.Open(EnvDTE.Constants.vsViewKindTextView)
' TextDocument :
textDocument = window.Document.ObjectC'TextDocument")
' :
226
Exit While
End If
End While
End Sub
, :
public class XCLASSIJAMEX
(
public XCLASSNAHEXO
!
//
XBEGINOPTIONALCODEX
void SomeOptionalCodeO
XENDOPTIONALCODEX
:
Sub MakeReplacements2()
MakeReplacements(DTE.ActiveWindow. Projectltem,
"XCLASSNAHEST, "MyClass")
DeleteBetweenTokens(DTE.ActiveWindow. Projectltem,
"XBEGINOPTIQNALCODEX",
End Sub
:
public class MyClass
I
public MyClassO
"JfENDOPTIONALCOOEX")
227
.
. .
, .
, ,
( DLL ) .
, Visual Studio .NET .
Add New Item, Visual Studio .NET
.vsz- ,
, , ,vsz. Add New Item, AddFromFtieCopy: , , .
, ,
, ProjectltemsTemplatePatb, a
.
Visual Studio .NET :
.
. Visual Studio .NET
, , , , , , , ,
, -, IDTWizard, .vsz- ,
.
, , ,
, . , , ,
.
, Visual Studio .NET IDTWizardExecute. -
228
( ,
), .
,
,
GUID, .
, GUID
.
.
?
, Visual Studio .NET, .
" . Visual
C++ * (Class View), , .
. , DTEJLauncbWOzard
. , C++ Class
View Add \ Add Function Add [ Add Variable,
.
- , lDT&!izard Execute,
Visual Studio .NET. , DTELaunchWizard, .vsz- . .vsz-,
- , .
LaunchWizard - , , vsz-,
, .vsz-.
LaunchWizard Execute .
CustomWizard LaunchWizard.
, ContextParams GUID ,
,
. , :
229
Sub CallCustomWizardO
Dim contextParams(t) As Object
contextParams(O) = "{9A4B2CFF-7A69-4671-BFA5-AEODOC44AEFB}"
C:\samples,
Hello world! LauncbWizard.
GUID {9A4B2CFF-7A69-4671-BFA5-AEODOC44AEFB}, ContextParams,
, .
LauncbWizard ,
. ,
, Web- XML, Windows
Forms Web- XML . Windows Forms : Windows Form
Windows Form, , . Web- XML
, . Web- XML Web-. Web- XML, ,
, .
Web- , Front Page server
extensions, Web- XML,
Web- (Web Service Wizard) .
ChainWizard, , , . Execute :
const string serviceName = "ChainWizardWebService";
object [JcontextParamsChain = new object[7];
EnvDTE.wizardResult wizardResultChain;
EnvDTE.DTE dte = (EnvDTE.DTE)Applicatlon;
// Web-
// Web-.
contextParamsChain[0] = EnvDTE.Constants.vsWizardNewPreject;
contextParamsChain[1] = serviceName;
contextParamsChain[2] = "http://localhost/" + serviceName;
contextParamsChain[3] = System.10.Path.GetDirectoryName(dte.FullName);
contextParamsChain[4] = (bool)ContextParams[4];
contextParamsChain[5] = "";
contextParamsChain[6] = false;
string webSvcTemplatePath = dte.Solution.get_TemplatePath(
VSLangProj.PrjKind.prjKindCSharpProject);
webSvcTemplatePath += "CSharpWebService.vsz";
230
wizardResultChain = cite.LaunchWizard{webSvcTemplatePath,
ref contextParamsChain);
,
, LaunchWizard. TemplatePath .vsz- Web- XML
#. ;
Web- XML. , Web- XML,
, serviceName
.
ChainWizard , Web XML Windows Forms, Web XML
:
, ?
, Visual Studio .NET: ,,
, , - =
. -;
* Web- ASP.NET
(ASP-NET Web Service Wizard) ChainWizard.
# ( Visual Basic .NET)
Mew Project. , IBTWizard CGM1, GUID PragID
- , , .-,
;
Web- #, .vsz-
, . Visual Studio .NET 20Q3\VC#\CsharpProiects
CShaipWefoService.vsz ,
1 ,
.
.vsz-, , ProglD VsWizardVsWizardEngine.7.1 ProglD , .
Visual Studio .NET, . Execute F5 (
Visual Studio .NET devertv.exe ). Visual Studio .NET - /
New Project # ASP .NET Web Service W&ard. - : :
ASP.NET Web Seivice Wizard /
, !* Execute, ' ,
..
231
He .vsz-, , Web- .
XML
, . -,
IDTWizard .vsz- , , New Project
Add New Item.
, - .
,
Windows Form . Windows Form , Next, Back. Finish Cancel
,
. , . WizardLibrary IDTWizard, Context? arams
, .
}', , , , , , , , .
, , . # WizardBuilder,
WizardLibrary ( , < >
,
),
InsideVSNet.WizardLibraryWizardLibrary ( , ).
-, :
[GuidAttribute("1EF6B85C-FD5C-4fb4-BA4D-5ED221195DBF"),
, ,
.
, :
232
II
, , . .vsz- WizardBuilder .
. .NET,
Add New Item Pagel Page2,
.
, , ,
, .
InsideVSNet.WizardLibraryJWizardPage,
. :
public interface IWizardPage
I
void PerformWork1(WizardLibrary WizardLibrary);
void PerformWork2(WizardLibrary WizardLibrary);
string HeadingLabel
f
get;
!
string DescriptionLabel
{
get;
i
System.Drawing.Image Icon
{
get;
)
void ShowHelpO;
void Initialize (WizardLibrary WizardLibrary);
.
PerformWorkl ,
Finish, . ,
.
PerformWork2 PerformWorkl, .
. PerformWorkl, PerformWork2.
PerformWorkl , PerformWork2 , .
233
HeadingLabel , ,
,
. , ,
: , , .
DescriptionLabel ,
.
Icon SystemDrawingJmage, .
ShowHelp Help
, ,
Initialize ,
, .
, , .
IDTWizard Execute, , WizardLibrary (
),
Execute. , WizardLibrary, , :
public override void Execute(EnvDTE.DTE applicationObject);
Execute , , . ,
WizardLibrary AddPage,
, IWizardPage,
, . Execute
, (Pagel
public override void Execute(EnvDTE.DTE applicationObject)
{
Title = "Wizard Builder";
AddPage(new Page1(;
AddPage(new Page2());
234
CawS
. 9-3-
WizardBuilder
IDTWizardExecute ContextParams CustotnParams. Execute,
, , ContextParams . CustomParams , ContextParams,
. . 9-3 9-4
, , , . 9-1 9-2, , .
. 9-3.
ContextAttribute
WizardType
NewProjectName
NewProjectLocation
VisualStudioInstallDirectory
exclusiveProject
NewSolutionName
RunSilent
235
. 9-4.
ContextAttribute
WizanfType
ProjectName
Projectltems
NewItemLocation
NewIt&mName
ProductlnstallDirectory
RunSilent
, . 9-3 9-4, . ,
, ,
.
application DTE Visual Studio .NET,
.
CustomArguments , CustomParam, IDTWizardExec.
,
. , IWizardPagePerformWorkl IWizardPagePerformWork2.
, . System.CollecttonsSpecializedListDictionary. . ,
, customData , EnvDTEProject, Create Project PerformWorkl .
,
.
CreateProject , ;
public EnvDTE.Project CreatePro]ect(string templatePath)
, , ,
. . ,
, ,
,
, .
DeleteBetweenTokens MakeReplacements #-
236
II
, . .
WizardBuilder
WizardBuilder. , WizardUbrary, Execute,
IWizardPage. .
. # WizardTemptate, :
namespace NAMESPACE*
{
/// <summary>
/// Summary description for Classl.
/// </summary>
[GuidAtt ribute( "SQUIDS") , ProgldAtt ribute( "XNAMESPACEX . Wizard" ) ]
public class Wizard : InsideVSNet.WizardLibrary.WizardLibrary
public Wizard ()
{
I!
{
Title = "My Wizard";
XWIZARDPAGESX
237
PerformWorkl . PerformWork2
,
.
. , , PerformWork2 wizard.cs ,
%WIZARDPAGES%.
.
Visual Studio .NET.
10
Microsoft Visual Studio .NET Task List, Solution Explorer, Windows Forms . . , , . , Visual Studio .NET.
Visual Studio .NET ,
. .
Windows
Visual Studio .NET ,
.
Window Windows, DTE.Windows.
Window Windows -, ,
:
Sub EnumWindows()
Dim window As EnvDTE.Window
For Each window In DTE.Windows
10
239
MsgBox(window.Caption)
Next
End Sub
:
Sub EnumWindows2()
Dim window As EnvDTE.Window
Dim i As Integer
For i = 1 To DTE.Windows.Count
MsgBox(DTE.Windows.Item(1).Caption)
Next
End Sub
,
, . ,
Visual Studio.NET. , Item
EnvDTEWindow, . ,
. , . , Visual Studio .NET , ,
,
.
, , . Server Explorer Visual Studio .NET. ,
. Visual Studio .NET
, , . EnumWindows2 Window, ,
.
Windows
. , Window Task List :
Sub FindTaskListWindowO
Dim objWindow As EnvDTE.Window
objWindow = DTE.Windows.Item("Task List")
End Sub
Window.
, WindowsJtem, , . Task List
Show Tasks | Comment, ,
Task List - X Comment tasks shown (filtered), X .
Task List, Item,
240
II
End Sub
GUID
, EnvDTE Windows, GUID
, Visual Studio .NET ,
.
, , GUID, . Favorites. GUID
, , . , Window Favorites:
Sub FindTheFavoritesWindow()
Dim window As EnvDTE.Window
window = DTE.Windows.Item("{E8BQ6F43-6D01-11D2-AA7DEnd Sub
OOC04F990343}")
GUID, , ObjectKind.
, GUID Favorites:
Sub FindTheFavoritesWindow2()
Dim window As EnvDTE.Window
' ,
1
Favorites!
window = DTE,Windows.Item("Favorites")
HsgBox(window.ObjectKind)
End Sub
GUID Favorites .
, GUID,
, , FindTheFavoritesWindow
GUID .
10
241
Object
Visual Studio .NET ,
, . ,
, Object Window. , Object Window Task List
TaskList, , Task List. TaskList:
Sub GetTaskListObJectf)
Dim window As EnvDTE.Window
Dim taskList As EnvDTE.TaskList
window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindTaskList)
taskList = CType(window.Object, EnvDTE.TaskList)
End Sub
,
TaskList, . . 10-1 ,
GUID, Item
Window, , .
. 10-1.
GUID
Command Window
vsWindowKindCommandWindow
EnvD TE.CommandWindow
Macro Explorer
vsWindowKindAlacroExplorer
EnvDTE.UIHierarcby
Oucput window
vsWindowKindOutput
EnvD TE.OutputWindow
Server Explorer
vsWindowKindServerExplorer
EnvD TE.UlHierarchy
Solution Explorer
vsWindowKindSolutionExplorer
EnvD TE.UlHierarchy
Task List
vsWindowKindTaskList
EnvDTE.TaskList
Toolbox
vsWindotvKindToolbox
EnvDTEToolBox
Web-
vsWindowKindWebBrowser
SHDocVwWebBrowser
<>
EnvDTE.TextWindow
< >
System.ComponentModel.
DesignJDesignerHost
HTML
< >
EnvDTEHTML Window
Visual Studio .NET
Window. Visual Studio .NET ,
Window. , EnvDTE.Winf.iows,
MainWindow DTE-.
9-16
242
II
Sub FindTheMainWindowO
Dim mainWindow As EnvDTE.Window
mainWindow = DTE,MainWindow
End Sub
get
'
I
(,
):
10
243
WmWrapper ,
.
- UIHierarchy
(UI-) , - Solution Explorer, Server Explorer Macro Explorer,
UIHierarchy UIHierarchyltems UIHierarchy
, ,
. UIHierarchy
,
UI-. .
UIHierarchy
UIHierarchy, UIHierarchyltems UIHierarchyltem .
UIHierarchy UIHierarchyltems, UI-.
UIHierarchyltem UIHierarchyltems,
, UlHierarchyltemUIHierarchyItems UIHierarchyltems. ,
, ,
, UIHierarchy
Macro Explorer:
Sub GetTopLevelUIHierltemsO
Dim macroExplWin As Window
Dim uiHierarchy As EnvDTE.UIHierarchy
Dim uiHierarchyltems As EnvDTE.UIHierarchyltems
1
-
' UIHierarchy :
macroExplWin = DTE.Windows.Item(Constants.vsWindowKinrfMacroExplorer)
uiHierarchy = macroExplWin.Object
' :
244
II
uiHierarchyltems = uiHierarchy.UIHterarchyltems
1
:
MsgBox(uiHierarchyItems, Item(1). Name)
End Sub
UIHierarchy
- , . UIHiemrcby.Getltem UIHierarchyltem , -
10
245
. , UlHierarchyltem tnsertDate,
VSEditor Samples, :
Sub FindUIHierltemForlnsertDateHacroO
Dim macroExplWin As Window
Dim uiHierarchy As EnvDTE.UIHierarchy
Dim uiHierarchyltem As EnvDTE.UlHierarchyltem
Dim uiHierarchyltems As EnvDTE.UIHierarchyltems
macroExplWin = DTE.Windows,Item(Constants.vsWindowKindHacroExplorer)
uiHierarchy = macroExplWin.Object
uiHierarchyltems = uiHierarchy.UIHierarchyltems
uiHierarchyltem = uiHierarchyltems.ItemC'Macros")
uiHierarchyltems = uiHierarchyltem.UIHierarchyltems
uiHierarchyltem = uiHierarchyltems.Item("Samples")
uiHierarchyltems = uiHierarchyltem.UIHierarchyltems
uiHierarchyltem = uiHierarchyltems.Item("VSEditor")
uiHierarchyltems = uiHierarchyltem.UiHierarchyltems
uiHierarchyltem = uiHierarchyltems.Item("InsertDate")
MsgBox(uiHierarchyltem.Name)
End Sub
, , UfHierarchy.Getltem-.
Sub FindUIHierItemForInsertDateMacro2()
Dim macroExplWin As Window
Dim uiHierarchy As EnvDTE.UIHierarchy
Dim uiHierarchyltem As EnvDTE.UlHierarchyltem
macroExplWin = DTE.Windows.Item(Constants.vsWindowKindMacroExplorer)
uiHierarchy = macroExplWin.Object
uiHierarchyltem =
jiHierarchy.GetItem("Macros\Samples\VSEditor\InsertDate")
MsgBox(uiHierarchyltem.Name)
End Sub
UIHierarchy.Getltem , , . ,
. UIHierarcby.Getltem
Macro Explorer Solution Explorer, Visual Studio .NET
UlHierarchyltem Server Explorer.
UIHierarchySelectedltems UlHierarchyltem
, . , , .NET,
System.Object.
Sub GetUIHierSelectedltemsO
Dim macroExplWin As Window
Dim uiHierarchy As EnvDTE.UIHierarchy
Dim selectedltems As ObjectO
Dim uiHierarchyltem As EnvDTE.UlHierarchyltem
macroExplWin = DTE.Windows.ItemfConstants.vsWindowKindHacroExplorer)
uiHierarchy = macroExplWin.Object
246
II
selectedltems = uiHierarchy.Selectedltems
For Each uiHierarchyltem In selectedltems
4sgBox(uiHierarchyItem.Name)
Next
End Sub
,
UIHierarchy , SelectUp SelectDown, . .
EnvDTE.vsUISelectionType ,
. EnvDTE.vsUISelectiorifypeSelect
, . EnvDTE.vsUlSelectioritypeExtend ,
Shift. EnvDTE.vsllISelectionTypeSetCaret ,
. , , EnvDTE.vsUlSelectionType1bggle . SelectUp
SelectDown . , .
UIHierarchy DoDefaultAction, Enter . , Macro Explorer UIHierarchyDoDefaultAction, .
UIHierarchyltems
EnvDTE,UIHiemrchyItems EnvDTEJUIHierarcbyltem
, - Visual Studio.
,
-, Expanded. Boolean
,
UIHierarchyltems. True ,
* , a False *.
UiHierarchyltem
EnvDTE.UiHierarchyltem, ,
, Collection Name. Select, UIHierarchySelectUp UIHierarchySelectDoivn,
,
UiHierarchyltem, Select. Select
UiHierarchyltem, .
UIHierarchyltem.Object ,
. , Solution Explorer,
EnvDTEProject EnvDTEProjectltem .
UiHierarchyltem ( , .NET
10
247
Toolbox
Toolbox , , , . Toolbox , . ,
, Clipboard Ring, , .
Toolbox, vsWindowKindToolbox
WindowsJtem, Window, ToolBox Window.Object :
Sub FindTheToolBoxC)
Dim toolBoxWindow As EnvDTE.Window
Dim toolBox As EnvDTE.ToolBox
toolBoxWindow = DTE.Windows.Item(Constants.vsWindowKindToolbox)
toolBox = toolBoxWindow.Object
End Sub
Toolbox , , , ToolBoxTabs,
ToolBox.TbolBoxTabs.
ToolBoxTab Toolbox
. ToolBoxTabsAdd, ToolBoxTab. Toolbox :
Sub AddNewToolBoxTabO
Dim toolBoxWindow As EnvDTE.Window
Dim toolBox As EnvDTE.ToolBox
248
II
toolBoxWindow = DTE.Windows.Item(Constants.vsWindowKindToolbox)
toolBox = toolBoxWindow.Object
toolBox.ToolBoxTabs.Add("My commonly used items").ActivateO
End Sub
ToolBoxItem . Select,
Toolbox, Delete, , ,
Name. ToolBoxItem , Toolbox
.
Toolbox
Toolbox , , HTML, COM-
.NET-. Tool-Box TabAdd, : Name ( ,
Toolbox), Data ( , Toolbox) Format ( vsToolBoxItemFormat
).
. ,
Data, Toolbox , ,
, text
(, ), . :
10
249
Sub AddTextToTheToolB6x()
Dim toolBoxWindow As EnvDTE.Window
Dim toolBox As EnvDTE.ToolBox
Dim toolBoxTab As EnvDTE.ToolBoxTab
Dim toolBoxItems As EnvDTE.ToolBoxItems
toolBoxWindow = DTE.Windows.Item(Constants.vsWindowKindToolbox)
toolBox = toolBoxWindow.Object
toolBoxTab = toolBox.ToolBoxTabs.Item{"General")
toolBoxItems = toolBoxTab.ToolBoxItems
toolBoxItems.Add("My Text", "This is some text", _
vsToolBoxItemFormat.vsToolBoxItemFormatText)
End Sub
General Toolbox. ToolBoxItemsAdd,
My Text This is some text, text.
HTML
, , HTML-, vsToolBoxltemFormatHTML
Sub AddHTMLToTheToolBoxO
Dim toolBoxWindow As EnvDTE.Window
Dim toolBox As EnvDTE.ToolBox
Dim toolBoxTab As EnvDTE.ToolBoxTab
Dim toolBoxItems As EnvDTE.ToolBoxItems
toolBoxWindow = DTE.Windows.Item(Constants.vsWindowKindToolbox)
toolBox = toolBoxWindow.Object
toolBoxTab = toolBox.ToolBoxTabs.Item("General")
toolBoxItems = toolBoxTab.ToolBoxItems
toolBoxItems.Add("My HTML", "<b>This is bold HTML</b>",
vsToolBoxItemFormat.vsToolBoxltemFormatHTML)
End Sub
HTML Toolbox,
Toolbox HTML, ,
.
HTML XML,
. HTML XML,
Toolbox XML HTML. Visual Studio .NET HTML/XML HTML-, XML-.
, Toolbox } ActiveX, HTML- %'132- ( MFC), ActiveX. ActiveX, vsToolBoxJtemFormatGUID.
Data CLSID GUID ActiveX ( ) ProgID .
250
II
End Sub
, , Name . .
Toolbox .
Toolbox .NET Framework.
vsToolBoxItemFormatDotNETComponent
.NET. , ,
, Toolbox. ,
WindowsControILibrary.dll :. Toolbox:
Sub AddDotNetComponentToTheToolBox{)
Dim toolBoxWindow As EnvDTE.Window
Dim toolBox As EnvDTE.ToolBox
Dim toolBoxTab As EnvDTE.ToolBoxTab
Dim toolBoxItems As EnvDTE.ToolBoxItems
toolBoxWindow = DTE.Windows.Item(Constants.vsWindowKindToolbox)
toolBox = toolBoxWindow.Object
toolBoxTab = toolBox.ToolBoxTabs.Item("General")
toolBoxItems = toolBoxTab.ToolBoxItems
toolBoxItems.Add("Control", "C:\WindowsControlLibrary.dll",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent)
End Sub
10
251
Sub AddDotNetComponentToTheToolBox2()
Dim toolBoxWindow As EnvDTE,Window
Dim toolBox As EnvDTE.ToolBox
Dim toolBoxTab As EnvDTE.ToolBoxTab
Dim toolBoxItems As EnvDTE,ToolBoxItems
Dim asm As System.Reflection.Assembly
toolBoxWindow = DTE,Windows.Item(Constants.vsWincfowKlndToolbox)
toolBox = toolBoxWindow.Object
toolBoxTab = toolBox.ToolBoxTabs.Item("General")
toolBoxItems = toolBoxTab.ToolBoxItems
asm = System.Reflection,Assembly.Load("WindowsControlLibrary1,
Version=1.0.795.38162, Culture=neutral, PublicKeyloken=6fc70375761725cO")
toolBoxItems.AddC'Control", asm.CodeBase,
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent)
End Sub
Task List
, Task List EnvDTETaskList. TaskList ,
, ,
, .
EnvDTE.TaskList TaskItems, Taskltems,
Task List. Task
List, , , , ,
EnvDTE.Taskltems.
, EnvDTE.Taskltems , EnvDTE.Taskltem. ,
252
Task List . , Task List.
, .
Task List.
, ,
Microsoft Project, ,
. ,
, Project ,
,
. , #
- ? ?
, Microsoft Outlook Visual Studio .NET. , .
TaskltemsAdd, .
Visual Studio .NET:
public EnvDTE.Taskltem Add(string Category,
string SubCategory,
string Description,
EnvDTE.vsTaskPriority Priority = vsTaskPriorityMedium,
object Icon,
bool Checkable = false,
string File = "",
int Line = -1,
bool CanUserDelete = true,
bool Flushltem = true)
- AddTaskListltems. .
Category SubCategory
, Visual
Studio .NET, .
.
: , .
Task List Show Tasks,
, , . Category Add.
, . ,
, .
, .
10
253
Description?
Sort By
Show Description Tooltip
i. ',
Next TasV
Previous Task
. 10-1.
Task List,
Priority
, ^rfrf, Priority,
, , Task List
,
.
, , . Task List . Task List
, . 10-2.
Sub TLAddltemsPriorityO
Dim taskList As EnvDTE.TaskList
taskList = DTE.Windows.Item{Constants.vsWindowKindTaskList).Object
254
taskList.Taskltems.Add("Category", "", _
Descriptionl", vsTaskPriority.vsTaskPriorityHigh)
taskList.Taskltems.Add("Category", "", _
"Descriptions", vsTaskPriority.vsTaskPriorityLow)
taskList.Taskltems.Add("Category", "", _
"Descriptions", vsTaskPriority.vsTaskPriorityMedium)
End Sub
. 10-2.
Task List
Icon
Icon . . . 10-2.
. 10-2. Task List
vsTasklconvsTaskiconComment
qfSjift
vsTaskIcon.vsTaskIconUser
vsTasklcon.vsTasklconSquiggie
vsTasklconvsTasklconSbortcut
j;|i
vsTaskIcon.vsTaskIconComptte
, vsTasklconNone
, .
TaskltemsAdd vsTasklconSbortcut, .
. : vsTasklcon , vsTasklconComment
. .
. 16x16 1 . RGB- 0,255,0 , . . Task List. ,
IPictureDisp
Icon. IPictureDisp
. IPictureDisp .NET-.
P/Invoke- .
(P/Invoke .NET Framework, -
10
255
256
II
CanUserDelete
, , , Delete. false, ,
, TaskltemDelete.
Flushltem
TaskListltemsAdd Flusbltem,
Task List , . , Task List
. Flushltem
false, Task List TaskltemsForceltemsToTaskList.
Task/ten?
Task List Visual Studio .NET Taskltems,
, ?
Taskltem. Category, SubCategory, Checked, Description, FileName, Line Priority Task List. ,
. , Visual
Studio .NET, , . , , IsSettable, (
vsTaskListColumn) true, , false . , , , :
Sub ModifyTaskDescriptionQ
End If
End Sub
Delete , . ,
, , ,
CanUserDelete true false TaskltemsAdd. , , . , , Click
Here To Add A New Task Item Task List, . IntelliSense , Delete , -
10
257
,
.
Navigate Enter,
. Visual Studio .NET , , . , ,
TaskNavigated.
Task List
Task List ,
. , , , TaskNavigate.
, Task List, Enter,
Next Task Previous Task
Task List. ,
TaskListEvents.TaskNavigated. Taskltem , , NavigateHandled, Visual Studio .NET,
. NaingateHandled false , Visual Studio .NET
.
EnvironmentEvents , TaskListEvents
TaskNavigated . ,
- NavigateHandled,
( ), , , .
:
Private Sub TaskListEvents_ TaskNavigated(ByVal Taskltem As EnvDTE.Taskltem, _
ByRef NavigateHandled As Boolean) Handles TaskListEvents.TaskNavigated
1
file...
If (Taskltem. FileName <> "") Then
Dim fileWindow As EnvDTE.Window
Dim textWlndow As EnvDTE.TextWindow
Dim textPane As EnvDTE.TextPane
' , TextWindow TextPane objects...
fileWindow = DTE.IteraOperations.OpenFile(TaskItem.FileName, _
EnvDTE.Constants.vsViewKindTextView)
textWindow = CType(fileWindow.Object, EnvDTE.TextWindow)
textPane = CType(textWindow.ActivePane, EnvDTE.TextPane)
' :
textPane.Selection.MoveTo(TaskItem.Line, 1, False)
textPane.Selection.SelectLine()
258
NavigateHandled = True
End If
End Sub
,
. . Task List,
EnvDTE.TaskListEvents-.
private EnvDTE.TaskLlstEvents taskListEvents;
,
, Object Browser. , , # :
public void TaskNavigated(EnvDTE.TaskItem taskltem,
ref bool navigateHandled)
I
// file...
if(taskltem.FileName != "")
I
EnvDTE.Window fileWindow;
EnvDTE.TextWindow textWindow;
EnvDTE.TextPane textPane;
// , TextWindow TextPane objects...
fileWindow = applicationOb]ect.ItemOperations.OpenFile(
taskltem.FileName, EnvDTE.Constants.vsViewKinrfTextView);
textWindow = (EnvDTE.TextWindow)fileWindow.Object;
textPane = {EnvDTE.TextPane)textWindow.ActivePane;
// :
textPane.Selection.MoveTo(taskltem,Line, 1, false);
textPane.Selection.SelectLine();
navigateHandled = true;
}
\
taskListEvents
TaskListEvents, Events.TaskListEvents. , .
,
Visual Studio .NET. ,
TaskltemsAdd, . , . ,
Events.TaskListEvents :
EnvDTE.Events events = applicationObject.Events;
taskListEvents = (EnvDTE.Ta$kListEvents)events.get_TaskListEvents{"");
10
259
. EnvDTE._dispTaskListEvents_TaskNavigatedEventHandler taskListEvents,TaskNavigated :
taskListEvents.TaskNavigated += new
_dispTaskListEvents_TaskNavigatedEventHandler(this,TaskNavigated);
TaskNavigated Task List, .
TaskAdded TaskRemoved
. , TaskModified, Task List. , /
, . TaskModified , Taskltem
.
,
, ,
,
- . , (
Visual Studio .NET),
. , , Task List . , ,
, . , , ,
Task List. , //TODO: Fix this later Task List Visual C++ # Fix this later, a
'TODO: Fix this later Visual Basic .NET.
, Task List,
Options, . . 10-3 HACK, TODO, UNDONE UnresolvedMergeConflict.
, Name, Add. ,
. Properties.
Properties , ,
. CommentTokens :
Sub GetTokensArrayO
Dim tokens As ObjectO
Dim prop As EnvDTE.Property
Dim props As EnvDTE.Properties
260
prop = props.ItemC'CommentTokens")
tokens = prop.Value
End Sub
General
Environment
General
Documents
Dynamic Help
Font! and Cabrs
Help
International Setting
Keyboard
Projects and Solution
Web Browser
Comment Tokens
token List:
Prtorlty:
HACK
JNoTnvJT
TODO
UNDONE
! UnresolvedMergeConf
^j Options Add-in
|j Source Control
9) Text Edtor
l2i Database Tods
23 Debugging
Qj Device Tools
. 10-3-
The TODO tdosnearmol he renamed or removed, but Che ptionty fat the
token Can be mgdtf d.
Task List
10
261
:
Sub RemoveSecurityTokenO
Dim tokens As Objectf)
Dim newTokens As Object()
Dim token As String
Dim i As Integer = 0
Dim found As Boolean = False
Dim prop As EnvDTE.Property
Dim props As EnvDTE.Properties
props = DTE.Properties("Environment", "TaskList")
prop = props.ItemC'CommentTokens")
tokens = prop.Value
' , .
For Each token In tokens
If token = "SECURITY:3" Then
found = True
Exit For
End If
Next
1
SECURITY ,
.
If found = False Then
Exit Sub
End If
' newTokens.
ReDim newTokens(tokens.Length - 2)
' newTokens,
1
SECURITY.
For Each token In tokens
If token <> "SECURITY:3" Then
newTokens(i) = token
i =i + 1
End If
Next
1
' ,
prop.Value = newTokens
End Sub
, ,
, ,
, TaskListDefaultCommentToken. ,
, , :
Sub InsertTLTokenCodeO
Dim classString As String
262
II
Output
Output Visual Studio .NET , . Output . OutputWindowPaneEx
Output.
Output OutputWindow, ;
Sub FindOutputWindowO
Dim window As EnvDTE.Window
Dim outputWindow As EnvDTE.OutputWindow
window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
outputWindow = CType(window.Object, EnvDTE.OutputWindow)
End Sub
Output
Output (panes),
.
Output. OutputWindowPanes:
Sub EnumOutputWindowPanesO
Dim window As EnvDTE.Window
Dim outputWindow As EnvDTE.OutputWindow
Dim outputWindowPanes As EnvDTE.OutputWindowPanes
Dim outputWindowPane As EnvDTE.OutputWindowPane
1
OutputWindow,
window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
outputWindow = CType(window.Object, EnvDTE.OutputWindow)
' OutputWindowPanes.
outputWindowPanes = outputWindow.OutputWindowPanes
' OutputWindowPane.
For Each outputWindowPane In outputWindowPanes
HsgBox(t)utputWindowPane. Name)
Next
End Sub
OutputWindowPanes . Add :
10
263
Sub CreateOutputWindowPaneO
Dim window As EnvDTE.Window
Dim outputWindow As EnvDTE.OutputWindow
Dim outputWindowPanes As EnvDTE.OutputWindowPanes
Dim outputWindowPane As EnvDTE.OutputWindowPane
' OutputWindow.
window = DTE.Windows.Item(EnvDTE,Constants.vsWindowKindOutput)
outputWindow = CType(window.Object, EnvDTE,OutputWindow)
' OutputWindowPanes.
outputWindowPanes = outputWindow.OutputWindowPanes
' :
outputWindowPane = outputWindowPanes.Add(" New Pane")
End Sub
My New Pane,
. OutputWindowPane.OutputString, , . , Output, , , ] .
. ,
; (ASCII- 13):
Sub DisplaySolutionDirectoryO
Dim files As StringQ
Dim file As String
Dim directoryOutputWindowPane As OutputWindowPane
Dim fullName As String
Dim outputWindow As OutputWindow
outputWindow = DTE.Windows.Item(Constants.vsWindowKindOutput).Object
' :
fullName = System.10.Path.GetDirectoryName(DTE.Solution.FullName}
files = System.10.Directory.GetFiles(fullName)
1
"Solution Directory"; , :
With outputWindow.OutputWindowPanes
Try
directoryOutputWindowPane = .Item("Solution Directory")
' :
directoryOutputWindowPane.ActivateO
Catch
directoryOutputWindowPane = .Add{"Solution Directory")
End Try
End With
' :
directoryOutputWindowPane.Clear()
For Each file In files
' .
directoryOutputWindowPane.OutputStringffile + Chr(13))
Next
End Sub
264
II
QutputWindowPane. . Activate
; Output.
OutputString , a Clear .
, TextDocument, ,
. Eni'DTE.TextDocument , ( .
11).
.NET Framework
Visual Studio .NET. Toolbox Properties. .NET
System.Windowsforms.
, .
IDesignerHost
, , . , Window.Object , System.ComponentModeWesignlDesignerHost.
, SystemWindows.Forms.Control. , IDesignerHostJtootComponent
Forms.Control,
System.Windows.Forms.Control control:
System.ComponentModel.Design.IDesignerHost designerHost;
designerHost =(System.ComponentModel.Design.IDesignerHost)
applicationObject.ActiveWindow.Object;
control = {System.Windows.Forms.Control)deslgnerHost.RootComponent;
SystemWindows.FormsForm System.Windowsforms.Control , Windows Form.
System.Windowsforms.Control ,
, ,
, .
IDesignerHost , SystemJRuntimeRemotmgRemotingException. , ,
10
265
System.Windows.Control, . ,
Macros IDE Visual Studio .NET . , .
IDesignerHost ,
. System.Type,
. Type.Get, . , :
System.Type type;
type = System.Type.GetType("System.Windows.Forms. ListView"};
IDesignerHost.CreateComponent .
, : ,
, , .
, ,
. ,
.
.
listViewControl:
System.ComponentModel.IComponent component;
component = designerHost.CreateComponent(type,
"listViewControl");
,
, , * Controls . Controls , Parent
, . Parent (
)
System.ComponentModelPropertyDescriptorCollection.
, , ,
, .
Parent :
System.ComponentModel.PropertyDescriptorCollection props;
System.ComponentModel.PropsrtyDescriptor propParent;
// listViewControl:
props = System.ComponentModel.TypeDescriptor.SetProperties(component);
// Parent.
propParent = propst"Parent"];
// Parent ;
propParent.SetValue(newControl, designerHost.RootComponent);
266
II
, .
? ,
IDesignerHostRootComponent , SystemWindowsForms.Control. , , . , , SystemWindowsForms.Control.
System.ComponentModel.Design.IDesignerHost designer;
System.Windows.Forms,Control rootControl;
// Window.Object.
rootControl = (System.Windows.Forms.Control)designer.RootComponent
foreach (System.Windows.Forms.Control control in rootControl.Controls)
I
// .
I
PropertyDescriptorCollection
, PropertyDescriptor.GetValue-.
System.ComponentModel.Design.IDesignerHost designer;
System.ComponentModel.PropertyDescriptor propControls;
System.ComponentModel.PropertyDescriptorCollection props;
System.ComponentModel.IComponent component;
System.Windows.Forms.Form form;
System.Drawing.Size size;
designer = (System.ComponentModel.Design.IDesignerHost)
applicationObject.ActiveWindow.Object;
component = designer.RootComponent;
// Size, :
props = System.ComponentModel.TypeDescriptor.GetProperties(component);
propControls = props["Size"];
size = (System.Drawing.Size)propControls.GetValue(component);
// Size :
form = (System.Windows.Forms.Form)component;
size = form.Size;
Visual Basic 6 Form Layout, ,
. Visual Studio .NET , ,
. ,
FormView, .
10
267
, . < > . ( , .)
WindowActivated ,
,
. , (. 10-4),
, . 10-5.
Fri
Sat
'"
,:
:--
':;
3
10
4
11
5
12
6
13
?
14
3
15
16
17
24
18
25
19
26
20
27
21
28
22 <SJg
23
11/23/2002
button!
. 10-4.
Windows Form
. 10-5.
, Visual Studio .NET , . ,
. , Visual Studio .NET .
, , ActiveX , Wmdows.CreateToolWindow.
268
Window,
, Visual Studio .NET. .
Addlnlnst , , . ,
, a ActiveX .
ProgID ActiveX, .
Caption , .
GuidPosition GUID . , WindowsJtem
GUID, . GUID GUID,
WindowsJtem,
GUID; CreateToolWindow ,
GUID.
DocObject ActiveX - IDispatch,
.NET Framework System.Object. ActiveX ,
, . ActiveX Object Window , CreateToolWindow.
VSMediaPlayer
CreateToolWindow. Windows Media Player ActiveX,
. :
void CreateHediaPlayerToolWindowC)
{
EnvDTE.Windows windows;
EnvDTE.Window mediaPlayerWindow;
object controlObject = null;
string mediaPlayerProgID = "MediaPlayer.MediaPlayer";
string toolWindowCaption = "Windows Media Player";
string toolWindowGuld = "{AB5E549E-F823-44BB-8161-BE2BD5D698D8}";
// ,
// Windows Media Player:
windows = applicationObject.Windows;
10
269
mediaPlayerWindow = windows.CreateToolWindow(addInInstance,
mediaPlayerProgID,
toolWindowCaption,
toolWindowGuid,
ref controlObject);
mediaPlayerWindow.Visible = true;
// "Tada":
string mediaFile = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.System);
mediaFile += "\\-.\\media\\taba.wav";
MediaPlayer.IHediaPlayer2 mediaPlayer =
(MediaPlayer.IHediaPlayer2)controlObject;
mediaPlayer.Autostart = true;
mediaPlayer.FileName = mediaFile;
}
- CreateMediaPlayerToolWindow
: OnConnection OnStartupComplete.
Visual Studio .NET. ,
, Visual Studio
.NET. OnConnection. OnConnection Visual Studio
.NET CreateToolWindow OnConnection
, , Act iveX
, . ,
, connectMode, OnConnection.
ext_cm_AfterStartup,
, Visual Studio .NET. , , OnConnection
:
270
II
// ,
// :
CreateMediaPlayerToolWindow();
I
CreateToolWindow , . ,
ActiveX,
; ActiveX .NET
Framework. .NET
, .
.NET Framework,
ActiveX (shim control). ActiveX,
(, Visual C++),
CLR .NET. CLR , .
, Project | Add User Control,
Windows Control Library,
.
(VSUserControlHost), a
(CSHostedControl). . , CreateTboIWindow, ProgID ,
, CSHostedControl:
toolWindow = applicationObject.Windows.CreateToolWindow(addInInstance,
"VSUserControlHost.VSUserControlHostCtl", "C Hosted Control",
"{C4E8F504-E3FB-4828-82F4-DDD1CAE13D39}", ref ObJ);
,
. VSUserControlHostLibJVSUserControlHostCtl,
:
shimControl =
(VSUserControlHostLib.IVSUserControlHostCtl)toolWindow.Object;
IVSUserControlHostCtl , ,
, :
System.Object HostUserControl(System.String Assembly, System.String Class);
System.Object HostUserControl2(System.Int32 HWnd);
10
271
.NET-, . .
Assembly , ,
. ,
C:\Assemblydll. URL , Web-, http://localhost/Assembly.dll. , GAC, System.WindowsForms, Version=l.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c56l934e089, Custom=nutt
SystemWindowsforms,
Class , .
SystemWindowsForm,
SystemWindowsformsButton, Button Windows Forms
.
HWnd .NET, . ,
, ,
CreatelbolWindow,
, .
,
. -,
,
HostUserControl:
VSUserControlHostLib.IVSUserControlHostCtl shimControl;
string assemblyPath;
EnvOTE.Window toolWindow;
object obj = null;
toolWindow = applicationObject.Windows.reateToolWindow(addInInstance,
"VSUserControlHost.VSUserControlHostCtl", "Hosted Control",
"{A71654EC-A72E-40cf-9CD6-63FA3C52C307}", ref obj);
toolWindow.Visible = true;
shimControl =
(VSUserControlHostLib.IVSUserControlHostCtl)toolWindow.Object;
assemblyPath = System.Reflection.Assembly.GetExecutingAssemblyC).Location;
shimControl.HostUserControl(assemblyPath, "MyAddinl.UserControll");
-,
HostUserControl2:
VSUserControlHostLib.IVSUserControlHostCtl shimControl;
string assemblyPath;
EnvDTE.Window toolWindow;
object obj = null;
toolWindow = applicationObject.Windows,reateToolWindow(addIn!nstance,
"VSUserControlHost.VSUserControlHostCtl", "Hosted Control",
"{A71654EC-A72E-40cf-9CD6-63FA3C52C307}", ref O bj);
toolWindow.Visible = true;
272
II
shimControl =
(VSUserControlHostLib.IVSUserControlHostCtl)toolWindow.Object;
assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
UserControll uc = new UserControllQ;
shimControl.HostUserControl3(uc.Handle.Tolnt32());
: Web-
. HostUserControt .NET Framework , GAC URL . Web-. Web*
, ,
, , . Web- ,
, .
Microsoft Internet
Information Services (HS) . Web-oep, , ,
Properties, Property Pages .
Configuration Properties | Build,
Configuration Ail Configurations,
Web- ( C:\Inetpub\wwwroot) Output Path.
Web-cepaepa, http://ioc&\host/assemhlyname.(j,U.
Web-cepsepa , -, , (
GAC , ), Web-, , .NET Framework . -, TypeJnt'ok&Member. , .NET Framework . -,
, , , URL, HastUserControl,
.
10
273
,
, (. 10-6).
I '^ [ ^.:!;'^-^1-"-'' i dP '' epw?'-
Selection
Visual Studio .NET , Properties, , . ,
Solution Explorer,
, , . . Properties. ,
Properties, WindowSetSelectionContainer, System-Object. , , ,
Properties. VSMediaPlayerAdv ( VSMcdiaPlayer) Properties, SetSelectionContainer Windows Media Player, DocObj CreateToolWindow, :
object []propertiesWindowObjects = {mediaPlayer};
mediaPlayerWindow.SetSelectionContainer(ref propertiesWindowObjects);
274
Options
. , Visual Studio .NET
; , . Options : , Tab,
Visual Studio .NET.
Options Properties Property, Properties,
.
,
. , Environment, Source Control
Text Editor, , .
Options, , .
Options:
, Options , , . , Properties, , Options, .
. Options, . Visual Basic .NET;
Text Editor Basic.
Text Editor Options
, ( ).
General Tabs , .
regedit.exe, _ LOCAL_MACHINE\SOFTWARE \Micro$oft\VisualStudio\7.1 \butomationProperties, ,
. Text Editor. ,
, TextEdit or ( ). , . , Basic, ,
Tools Options dialog box, - .
(TextEditor
Basic), DTEProperties Properties-.
Sub GetVBTextEditorPropertieaO
Dim properties As Properties
properties = DTE. PropertiesC'TextEditor", "Basic")
End Sub
10
275
Property Item
Properties. ,
. Properties ,
. ,
PropertiesJtem, . , ,
Properties Property,
. ,
, :
Sub WalkPropertyNames()
Dim categoryName As String
Dim key As Microsoft.Win32.RegistryKey
selection = newDocument.Selection
' , :
key = Microsoft.Win32.Registry.LocalMachine
key = key.OpenSubKey(
"SOFTWARE\Hicrosoft\VisualStudio\7.1\AutomationProperties")
' :
For Each categoryName In key.GetSubKeyNamesO
Dim subcategoryName As String
selection. Insert(categoryName + vbLf)
1
:
For Each subcategoryName In
key.OpenSubKey(categoryName).GetSubKeyNames()
Dim properties As Properties
, Text'Editor Basic, - Tab Size. TabSize. , Property Tab Size Visual Basic .NET
Sub GetVBTabSizePropertyC)
276
II
Property.Value:
Sub GetVBTabSize()
Dim properties As Properties
properties = DTE.PropertiesC'TextEditor", "Basic")
MsgBox(properties.ItemC'TabSize").Value)
End Sub
4 , Tools Options
Tab Size Basic Text Editor. :
Sub SetVBTabSizeO
Dim properties As Properties
properties = DTE.PropertiesC'TextEditor", "Basic")
properties.Item("TabSize").Value = 4
End Sub
, DTE.Properties,
, WalkPropertyNames, ,
Tools Options.
/s?
Visual Studio .NET Is Visual Basic .NET
QbjectJKquats .NET Framework. Is JEquals , . :
Sub CompareWindowsObjectsO
10
"General")
"General")
, ,
, .NET Framework ,
. < > , ,
, , /5
QbjectJEquals . , RepeatetfComtntci: DTEProperties:
Sub OptiraizedRepeatedConstructO
Dim i As loog
(
) , :;
35 .
277
278
II
,
. Options, ActiveX
. Visual Studio .NET , Options
, , . Options,
, ,
, ActiveX,
Options.
Options, , Add-in
Wizard. , Solution Explorer View
| Registry, .
ProgID .
OptionsAddin, , , Yes, Create A
Tools Menu Item, ( 10-7):
Registry on Target Machine
__ HKEY_O.ASSES_ROOT
] IM HKEY_OJRRENTJJSER
, ' Software
.- Microsoft
-; ] ViiudStudto
-, iSi Addtns
-1 OptionsAddin. Connect
iil hV_LOCAL_MACHINE
: C3 HKEYJJ5ER5
j^ User/Machine Hive
. 10-7.
OptionsAddin
Options
, .
Options. Visual Studio .NET Options, , , Options, Options ,
Options. Options ProgID , New | Key Options. Options. ,
Options, Options,
. , Options, Options Add-in, General,
(. 10-8):
10
279
> u HKEY_LOCAL_MACHINE
UJ HKEV_U5ER5
^ User/Machine Hive
. 10-8.
Options
Options ProgID
ActiveX, Options. , , New | String Value Control. , Control Properties
ProgID ActiveX Value.
ActiveX, , ProgID
QptionsAddinPage.QptionsAddinPageCtl.
ActiveX
AciiveX.
,
Windows.CreateTootWindow
.NET Framework,
ActiveX-, .NET-
ActiveX. Tools
Options, -, , ActiveX, -, , ,
, .
Tools Options Visual Studio .NET, , , .
Options.
ActiveX , , Visual C++.
ATL ;
OptionsAddinPage.
ActiveX,
. Options, OptionsPageWizard,
, Tools Options.
.vsz Extensibility Projects,
9 WizardBuilder, Solution Explorer, OptionsAildin
. , -
280
, ProgID , Options,
IDTToolsOptionsPage
Options : ,
. , ActiveX
IDTToolsOptionsPage. :
public Interface IDTToolsOptionsPage
I
public
public
public
public
public
void
void
void
void
void
10
281
OptionsAddinPage,
:
Sub GetSetCustomOptionsO
Dim properties As EnvDTE.Properties
Dim prop As EnvDTE.Property
' Properties :
properties = DTE.Properties("Options Add-in",
prop = properties. ItemfCheckBoxOption")
1
:
MsgBox(prop.Value)
1
:
prop.Value = True
MsgBox(prop.Value)
"General")
End Sub
,
, GetSetCustomOptions. , Tools
Options VSMediaPlayer,
, . :
DTE.Properties{"VSMediaPlayer",
"General").Item("MediaFile"),Value
, Property, , ; .
, Visual Studio .NET.
, .
11
, ( ), . Notepad ()! . 3,
Visual Studio .NET , , , Microsoft .
IDE, ; , . Visual Studio .NET
: ,
.'
(, , .) ,
, , .
11-1 , .
, . . .
11
Window
DTE.ActiveWindow
DTE.Windows.Item("Connect.cs")
283
Window
DTE.Windows.Item("HTMLPage1.htm")
TextWindow
DTE.ActiveWindow.Object
DTE.Windows,Item
("Connect.cs").Object
HTMLWindow
DTE.Windows.Item
("HTHLPage1.htm").Object
L- TextPane
DTE.ActiveWindow.Object.ActivePane
DTE.ActiveWindow.Selection.TextPane
DTE,Windows.Item("Connect.cs").Object.ActivePane
DTE.Windows.Item("Connect.cs").Selection.TextPane
. 11-1.
Window
Window, .
.
: , , DTEActiveWindow , , DTEWiniiows.(<>). ( . 11-1 Connect.cs I (TMLPagel.htm.)
Object, TextWindow HTMLWindow
. , Object, , TypeO/Js ( Visual Basic) is I B C#):
284
, ,
CLR.
TextWindow HTMLWindow
TextWindow HTMLWindow IDE,
, . . 11-1 TextWindow. ActivePane Panes,
.
. 11-1. TextWindow
ActivePane
TextPane,
.
DTE .
TextPanes, .
Window.
TextSelectton
( ParentSelection).
DTE
Panes
Parent
Selection
HTMLWindow TextWindow.
HTMLWindow (. 11-2):
. 11-2. HTMLWindow
CurrenfTab
CurrentTabObject
(HTML Design).
TextWindow, HTML
IHTMLDocument2,
Design.
DTE
DTE .
Parent
Window.
CurrentTab EnvDTE.vsHTMLTabs:
vsHTMLTabsSource HTML vsHTMLTabsDesign Design. CurrentTabObject TextWindow, HTML,
, HTMLWindow TextWindow.
, Design. CurrentTabObject
msbtmllHTMLDocument2, Dynamic
HTML (DHTML) . : Design
HTML : , ,
, . , .
11
285
txtWin = htmlWin.CurrentTabObject
End If
End If
Return txtWin
End Function
TextPane
TextPane .
,
. ,
(splitter bar)
.
.
TextPane
TextPane,
TextWindow. ActivePane Panes, TextPane. , alter ego
TextWindmv HTMLWindow ,
286
II
11
287
AcUvateTopPane ActwateBottomPane, , .
, , :
TextPane? , TextPane TextPanes, , 10
/s?, TextPane
. , TextSelection, ,
, :
Function IsTopPane(ByVal txtPane As TextPane) As Boolean
' : , TextPane .
Dim result As Boolean = False
If txtPane.Collection.Count = 1 Then
result = True
Else
If txtPane.Selection Is txtPane.Collection.Item(2).Selection Then
result = True
End If
End If
Return result
End Function
Function IsBottomPaneCByVal txtPane As TextPane) As Boolean
' : , TextPane .
Dim result As Boolean = False
If txtPane.Collection.Count = 2 Then
result =
(txtPane.Selection Is txtPane.Collection.Item(1).Selection)
End If
Return result
End Function
, Spffi . '
Visual Smdio .NET Wttodow&Spfat ' > . ,
IDE, . ( ,
, , UnsplitAllW 'in- =
daws );
Sub SplitAUWifldowsO
' ; .
. <\ .
288
End Sub
Sub SplltWindow<ByVal txtWin As TextWindow, _
Optional ByVal restoreActive As Boolean * False)
' ;
' .
Dim split As Command = DTE.Commands.IteiB("Mindow.Split")
Olm saveWin As Window
If restoreActive Then
saveWin = OTE.ActiveWindow
End If
txtWin. Parent. ActivateQ
If split, IsAvailable And Not IsSecondParteOpenCtxtWin) Then
End If
End Sub
11
289
Document
Document ; ,
, .
, ItemOf>erations Projectltems (. 8 9). , ItemOperationsNewFile, File | New | File, , . ,
NewFile-.
Sub CreateNewTextFileO
1
: , ItemOperations.NewFile
1
.
Dim
Dim
Dim
Dim
Name NewFile ,
. ,
. , NewFile, Name
, Visual Studio .NET .
<'>> , , , Visual Studio .NET
Name
.
Document: DTEDocuments, WindowDocument DTEActiveDocument. H
DTEDocuments Document.
, ,
Document , , , DocumentsJtem-.
Dim doc As Document = DTE.Documents.Item("HyFile.os")
Window, Document
Document. Document, Window;
,
Document:
Function GetDocument(ByVal caption As String) As Document
1
: Document,
' ,
290
1
Document.
, .
If win Is Nothing Then
win = DTE.IteimOperations.NewFile("General\Text File", caption)
End If
Return wtn.Document
End Function
Document :
Document, Document
. DocumentNewWindow, Window | New Window.
, , ,
, (, nect.cs:I, Connect.cs:2, ..).
, , , .
Visual Basic DocumentNewWindow
*.
,
DocumentParent, , . (
?) , , DocumentWindows;
Sub ListDocumentWindowsO
' : ,
' .
Dim output As New OutputWindowPaneEx(DTE, title)
output.Clear{)
output.WriteLine("- ListDocumentWindows -")
output.WriteLine()
11
output.WriteLine("
291
Next
Next
End Sub
Document,
ActiveWindow. , ,
, ,
.
DocumentActiveWindow ,
.
Document
Readonly, /
. , , , ,
Readonly, .
, Document.Undo
DocumentMedo . , Edit. Undo Redo
, , .
DocumenWndo DocumentMedo , ,
, False. , DocumentReadOnly, ,
, ( )
. Undo Redo , , , .
Document'.TextSelection TextSelection,
,
.
TextSelection . ( TextSelection . .)
DocumentSave
. Save , ; , ,
Save . ( Visual C++
, Save ,
292
II
.) SaveAU
Documents. :
,
Save.
Document.Close vsSaveChanges, (vsSaveCbanges), (vsSaveCbangesNo)
(vsSaveCbangesPrompt, ). Documents CloseAll,
vsSaveCbanges,
.
DocumentSaved , : False , ,
. , IDE .
, ,
, Saved True.
TextDocument
Document IDE, TextDocument
. TextDocument Document,.Object: TextDocument; null Nothing .
TextDocument
TextPoint, EditPoint TextSelection. TextDocumentSelection
, DocumentSelection. StartPoint EndPoint TextPoint.
. CreateEditPoint EditPoint TextPoint; null Nothing
EditPoint .
TextDocument.CreateEditPoint TextPoint
, TextPoint
CreateEditPoint. null TextDocument.CreateEditPoint EditPoint .
,
. :
TextPoint, VirtualPoint EditPoint.
11
293
TextPoint
TextPoint ; VirtualPoint EduPoint TextPoint,
.
, .
Line ,
.
AbsoluteCbarOffset LineCharOffset .
AtStartQfDocument, AtEndOfDocument,
AtStartOfLine AtEndOfLine ,
.
TextPoint LessTban, EqualTo GreaterThan .
TextPoint , . , EditPoint, . TextPoint (. 11-3):
. 11-3. TextPoint
StartPoint
TextDocument
TextPane
TextRange
TextDocument
TextRange
EndPoint
VirtualPoint
VirtualPoint ,
. ,
;
. ,
Tools Options, Text Editor | All Languages | General Enable Virtual Space Settings (. 11-2).
. 11-4 VirtualPoint. ,
VirtualPoint TextSelection, ; , TextSelection VirtualPoint,
, .
294
G-i Environment
ource Control
ext Editor
General
anguages
Statement Completion
%? ijgtotst members
P Hide advanced members
Parameter Information
Settings
| Basic
i '.*
%f vfetual space
~ Word wrap
I C/C++
|CSS
I HTML/XML
numbers
navigation
IP1VSQI
I Plan !
ll T-SQL
. 11-2.
bar
Note: This page set; options PW all ianoueges. Tc change ortlonsfor
one ianguage, select the desired language from the dree on the left,
. 11-4. VirtualPoint
ActivePoint
AnchorPoint
BottomPoint
TopPoint
TextSelection
TextPoint, VirtualPoint
EditPoint. , , VirtualPoint
EditPoint : , EditPoint .
, , , VirtualPoint
:
Function IsVirtualSpace(ByVal vrtPoint As VirtualPoint) As Boolean
' : , VirtualPoint
' .
Return vrtPoint.LineChardffset vrtPoint.VirtualCharOffset
End Function
VirtualPoint VirtualCharOffset, , , . VirtualCbarOffset , LineCharOffset, , .
11
295
:
,
, . .. '
- .
1. .
2. I am fish, Enter.,.
3. , . .
4. Output DisplayTextSeiectionEditPoint-:.
: DisplayColumn TopPoint BottomPoint 1 11
13 .
5. DisplayTextSvlectionVirtualPomts, Display-. .'.'.
Column TopPoint BottomPoint . ,
6. DisplayTextSelectionText , =;
I am a fish..
, VirtualPoint .
.. , VirtuatPomt
.
. I. .
2. , -:;
.
3. DisplayTexiSelectionEditPoints DtsplayTextSelec-..
. . tionVtrtuatPoints. ; EditPoint , :;;'
VirtualCbarQffset VirtualDisplayColumn VinitalPoint
LineCbarOffset DisplayColumn
4. DisplayTextSelectionText ,
, .
,
, . ^ =
, WYSINWYG-"
, , , -".
,
EditPoint
EditPoint .
TextPoint ,
.
EditPoint (. 11-5):
296
II
. 11-5. EditPoint
CreateEditPomt
EditPoint
TextPoint
VirtualPoint
TextDocument
EditPoint TextSelection
EditPoint",
TextSelection
TextSelection :
. (
.)
,
TextSelection. . 11-3 TextSelection
.
AnchorPoint - TopPoint
using System;
Hicroaott.Off
ActivePoint = BottoaiPolnt
ActivePoint - TopPoint
ii-
using- System;
aging
HicrosofC.Office.Core;
.AnchorPoint = BottomPoint
. 11-3-
TextSelection
11
297
Selection
Document
TextDocument
TextPane
TextWindow
Window
TextSelection EditPoint
TextSelection EditPoint
(. 11-7). : TextSelection EditPoint
, 52
, , 52
, .
, , ,
. : , , .
. 11-7. TextSelection EditPoint
Cbart.eft, CbarRighl, EndOfDocument, EndOfl-ine, LineDown, LineUp, MoveToAbsoluteOffset, MoveToLineAndOffset, MoveToPoint, StartOfDocument. StartOfLine,
WordLeft, WordRight
FindPattern
TextSelection
Collapse, GoToLine,
MoveToDisplayColumn.
PageDown, PageUp
EditPoint
FindText
GetLines, GetText
SelectAll, SelectLine
DeleteLeft. Desiructivelnsert,
CbangeCase, Copy!, Cut,
Delete. DeleteWhitespace,
NewLine, Tabify, Untabify
Indent, Insert, ImertFromFue,
PadToColumn, Paste,
ReplacePattern, SmartFormat,
Unindent
ReplaceText
. . .
298
ClearBookmark, NextBookmark, PreviousBookmark,
SetBookmark
OutlineSection
TextSelection
EditPoint
SwapAnchor
Readonly
, TextSelection
, a EditPoint . TextSelection
, : - ,
TextSelection. ( ,
: Macro Recorder ,
, TextSelection,) WYSIWYG, , , TextSelection. ,
, , TextSelecUonLineDoum :
,
.
, EditPoint . , EditPointJLineDown EditPoint
. , EditPoint,
.
, ,
, TextSelection;
, EditPoint.
, . , ,
.
. Visual Studio
.NET, , ' .
11
299
. (
, , ,
.) IDE Visual
Studio .NET ,
. ,
, Visual Studio
.NET.
1. Visual Studio .NET.
2. spelled backwards is Enter.
3. ,
, Undo, (. 11 -4). ( , ,
.) Paste, Enter , . ,
, .
ieiul!.l>e*4loprirent Ifmianmenl [design] T*Mfife1*
. 11-4.
: ,
, ,
300
. .
, DTE.UndoContext: Open
, SetAbortect , , a Close .
Visual Studio .NET ,
. -,
Open try, , .
UndoContextlsOpen, True,
, False ,
, Open. -,
, Close SetAbort. ( , , SetAbort
, Close
, .) -, SetAbort Close - , :
.
! , ,
. ,
Visual Studio .NET. (
, ,
.) , ,
SetAhort Close,
.
, ,
- .
, UndoContextJsOpen . 11-1 .
11-1. ,
UndoContextTimer
<System.ContextStaticAttribute()> Public WithEvents UndoTiraer _
As System.Timers,Tiraer
11
301
* .
, .
If Not AdoTextO Then
UndoTiffler = Hew System.fleers.TimerO
iMdoTiae .Interval - 100
URdoTlaer,Enabled * True
End If
End Sub
' .
OTE.UndoContext.Qpen("Tlmer")
' "Text File" .
Di txtOoc As TextDocument = GetTextOoeument("Text File")
Din editPnt Aa EditPoint = txtDoe.StartPoint.CreateEditPoint
* .
editPnt.!nsert("Here's text in the 'Timer' undo context."
+ System,environment.NewLine)
' .
OTE.UndoContext.CloseO
Catch
success - False
End Try
Return success
End Function
Else
.Dispose()
Nothing
. . .
302
End If
end sub
' , .
win = 9. Windows, IteiB< caption)
Catch
' .
win = DTE.ItemOperatiorvs.NewFiie("Seneral\Text File", caption)
End Try
Return win. Document
End Function
, 11-1,
. , .
,
. ,
Document 1 Document2 Link.
Link . ,
Link Document 1, Link Document 2,
. .
DocurnentZ.
Document2. , Link Docunientl? Link, Link Document2, :
11
303
Link Document2, .
.
, . ,
, , ; , , .
Link , Link Documentl, Document2. Link
Documentl, Document2
, Documentl. , . , Link Documentl.
UndoContext.Open,
True . (+) ,
:
UndoContextsStackLinkfige .
; Soo/ , :
. ,
, .
1. Command Window Macros.InsidVSI4ET.Cfaapterll,TJndo Contexts.StackLinkage Enter. : :
Nonstiictl, Honstrict2 Nonstrict3
NonsErictLinkage.
2. Undo, Redo, ,
,
.
3. Nonstrict2.
4. Nonstrict3 Undo,
Nonstrict3 , Undo rroce-'
. Nonstrictl Nonstrict2 NonstrictUnkage, , NonsfrictLinkage - %,'
. , NonstrictLinkage Nonsmct l ,,,
Nonslrictl NonstricU, .
,
True , 1. True
StackLinkage Strict I, Strict2 Strict3
StrictLinkage. .."
. 4, The application cannot undo*. .
304
II
LineChanged
, , LineChanged. , , , ' :
, , , ,
- , ,
.
LineChanged , ,
.. StartPoint EndPoint
. , TextPoint :
Dim text As String
text = StartPoint.CreateEditPoint.GetText(EndPoint)
, , , , :
Dim doc As Document
doc = StartPoint.Parent.Parent
, Hint, , vsTextChanged (. 11-8). Hint , , , [ Hint , , .
, (hint).]
. 11-8. vsTextChanged
I'sTextCbangedMultiLint'?
vsTextChangedSave
vsTextCbangedCaretMoved
vsTextChangedReplaceAtL
usTextCbangedNewLine
vsTextChangedFindStarting
.
.
, .
.
.
, .
LineChanged , .
, , ,
,
.
; ,
(
11
305
' :
' LineChanged.
DTE,UndoOontext.OpenC"U.rjeChangedAndUndoC0fitexts'')
1
' LineCnanged, .
editPnt.Insert(Environnient.NewLine)
editPnt.Insert("Here's a new line." + Environment. NewLine)
:;
Else
End Try
1
LineChanged.
editPnt . Insert ( Envi rsnsent . SewLine)
editPnt.Inaert< "Here's a new line." + Environnent.Kewline)
End If
. . .
306
II
End Sute
' tineCnanged,
. Public Sub TextEtfitorEveivtslJJlneCnangedC _
ByVal StartPoiat As EnvDTE.TextPoirrt,
ByVal EndPoint As EnvDTE.TextPotflt,
ByVal Hint As Intefer) Handles
Dim output As New 0utputWin6a*PaneExCQTE, title)
output.WriteLineC"- TextEditrEvents1_LineCnanged -")
output.WriteLlneC'Changed text:")
output. WriteLi(StartPoint,CreateE6itPoint.Get Text(ERclPoint))
output.WriteLineO
End Sub
Function ToBoolearKByVal val As Object) As Boolean
Sim bool As Boolean * False
:
* ,
bool * System.Convert,ToBoolean(val)
Catch
End Try
Return &ool
: End Function
LineChangedAndUndoContexts 11-2
. . 11-5
: LineChanged
, , .
. 11-6 , ,
. , , ,
LineCbanged, .
11
-.-.:'
PMC. 7 i-5.
LineChanged
. 11-6.
LineChanged
307
308
II
LineChanged
LineChanged ,
LineChanged, ,
. , , ,
;
Hint, StartPoint EndPoint ,
, .
:
MultipleHandlers LineCbanged. MultipleHanctlers
LineChanged, : LineCbangedlt LmeChanged2 LineCbcmged3. ( , .
,
.)
; , LineChangedl LineCbang&d2
, ,
LineCbanged2 LineCbanged3 .
MultipleHandfers ,
Boolean, , LineCbcmged2. False (
) ReplaceAU LineCbanged2
, True LineCbanged2
. : ReplaceAU
LineCbanged LineChanged3 ,
.
1.
1. .
2. Command Window Mu|tipleHandlers.Coanect,fieplaceAll
Enter.
3. - (, Here's a line)
Enter.
Enter LineChanged, Text Editing
Event Output Window . , LineCbanged 1 LineCbanged3
, ,
2 Hint
1. .
2. Command Window Mult ipleHand lers.Connect.Replac eAU
Enter.
11
309
.
, , ?
, . ,
, ,
. 12 , , .
12
.
, .
, # ( 12-1).
: , , , . ; ,
-, .
*
, *, . , .
12
311
12-1. #
namespace CM Names pace
<
delegate void CMDelegate(int delParam);
:j
field;
enum CMEnura
interface CMInterface<
inf CInterfaee*tetfcodC);
}
I C(Attribute("CHVal"> I
class CMClass
object member-Van
:;;;
int C*tProperty
{
.i.get
{
return 0;
}
;;; ,/"" '
set' ""- -
.
CodeElement. CodeElement
,
. . 12-1 , 12-1 .
312
CodeElement
CMNamespace
CodeElement
CMDelegate
CodeElement
delParam
CodeElemeni
'
CMStruct
CodeElement
Held
CodeElement
CMEnum
CodeElement
Member
CodeElement
CMInterface
CodeElement
CMInterfaceMethod
CodeElement
-I
GMCtess
CodeElement
CMAttribute
CodeElement
memberVar
CodeElement
CMCattbackFunction
CodeElement
param
CodeElement
CMProperty
. 12-1. CodeElement,
12-1
. 12-1 CodeElement
CMNomespoce. , CodeElement
:
.
, :
21 * cout Hello,
world;, Visual C++.
,
Visual C++, Visual C#, Visual J# Visual Basic
API. , ,
, .
;
12
313
;
.
, . 12-1,
CodeElement . FileCodeModel , FiieCodeModeLCodeElements CodeElement .
CMNamespace, CodeElement FiieCodeModeLCodeElements.
( CodeModelCodeElements,
CodeElement ,
, CMNamespace.)
, 12-2
, FileCodeModel CodeModel. .
12-2.
GetFileCodeModel GetCodeModel
cm = txtWin.Parent.Projectltein.ContainingProject.CodeModel
Catch e As.Exception
End Try
End If
Return effl
End function
314
, CodeElement , CodeElement
CMNamespace? CodeElement,
,
CodeElement. : CodeNamespace, CodeStntct, CodeInterface, CodeClass, CodeEnum, CodeVariable, CodeDelegate. CodeProperty, CodeAitribute,
CodeFunction CodeParameter.
, , , CodeFunction
Parameters, CodeParameter . CodeElementXind
vsCMElement, . Kind CodeElement CMNamespace
vsCMElementNamespace, , CodeNamespace CodeElement.
CodeNamespace
CMNamesftace
CodeParameter
CodeStruct
GMStruct
CodeVariable
Field
CodeEnum
GodeVariable
Codelntertace
CMInterface
CodeClass
CMCiass
CodeFunction
CMInterfaceMethod
CodeAttribute
CMAttrlbute
CodeVariable
memberVar
CodeFunction
CMCailbackFunction
CodeParameter
param
CodeProperty
CMProperty
. 12-2.
12
315
output. WriteLineO
Hi fern As FUeCodelitodel GetftleCodeHMfelO
If Not fern Is Hofhlng TTien
RseurseGodeEletEierrtsffciB.GodeEleiBents, 0> ;
End If
ffltf Sub
Sub ftecurseCodeElementsfByVal elements As CodeEleraents, _
ByVal level As Integer)
DlB output As Hew QutputWindowPane&c{DTE)
DiiB indent As Hew StringC ", 4 * level)
Din members As Codefilssients
Dim elem CodeElement
' CodeElements.
For Eaeli elem In elements
' .
output.WriteLI(indent 4 elem.Same)
fseabers = QetMembers(elem)
If Not members Is Netfclng Tnen
' .
RecurseodeEleneftts(Ben?bers, level + 1)
End If
''
- Hext
End Sub
'
--.
'-.
. . .
31 6
II
GetMembers 12-3
CodeElement,
Members . Visual Basic Members
CodeElement, ,
Members. CodeElement ( Query Interface), ,
.
GetMembers , CodeType,
, : CodeClass.
CodeStruct, Codelnterface, CodeEnum CodeDelegate. (, CodeType
Members, , -
12
317
.) CodeElement,
CodeType , CodeElemenUsCodeType.
, CodeType (. 12-3). CodeType
, 12-4. CodeType- CodeType
CodeNamespace. RecurseCodeElementsByCodeType
If CodeNamespace.
CodeNamespace
CMNamespacs
Code Type
CMOelegate
CocleParameter
tfelParam
CodeType
CMStruct
CodeVariable
Field
CodeType
CMEntim
CodeVariable
Member
CodeType
CMtnterface
CodeFunction
CMInterfaceMethod
CodeType
CMCiass
CodeAttribute
CMAttritiute
CodeVariable
memberVar
CodeFunction
CMCaHbackFunction
CodeParsmeter
param
CodeProperty
GMProperty
. 12-3.
CodeType
. . 12-2 12-3 , Members CodeElement, , - . CodeClass Attributes, CodeAttribute, , CodeDelegate CodeFunction, Parameters Code-
318
II
Parameter.
.
12-4.
CodeType
Sub TestReeurseCodeEleiBents8yGQdeType{ )
Dim output As Hew QMtpatWindowParwEx(DTE)
output . Glea r( }
output. WritetineC"- TestFtecurseCodeElementsfiyCodeType -")
output.
81 foe As ! = GetFileCodeHodelO
If Hot fen Is Mottling Tien
RecurseCorfeElementsByCodeType(fMB.Co6eElemeftts, t)
End If
End Sufc
Sub HecurseGodeElefflentsSyGodeType(ByVal elenetits fts CodeEleBents, _
ByVal level As Integer)
Next
End Sub
. .
; ; - : ' . - -'.- . ..
319
12
LJ ScuceFte
- -^J HutaFfet
Cwnen.li
? COM
.. ? "
. Resomci
4tdafK.h
-' i
Stow
* Children
. 12-4.
* ,
CodeSfement,
Output. Output ( 12-4) - CodeClass Details
, CConnect CodeClass; Bases
CConnect: CComObjectRootEx, CComCoClas*
/Dfspatcfefmpl; Children 14 -CodeElejn&nt
CConnect.
Show Definition,
CodeEl&tnent. Show
Definition, CConnect OnConnection, ;te OnConnection, Connect.
( 12-5).
Show Children
4( Children, CodeEl&ment Visual C++
CbUdren Members. Show Children,
- CConnect ~~ Children, '}
(. 12-6). : Members
.
cjierf.
320
, ,
Children. ,
COMJNTERPACE_ENTRY- OMJNTESMCEJffTKy,
, 12-7.
0 Elpltrtr - Myftttttl X .
olution WyAddmr pro
MyBddini
_pDTE - HULL;
eturn S OK;
; STDHETHODIIIP : .CiBjlOdlnsUpdaCE (Sir 1
(
ESCUCn 3_OE;
1
. 12-5-
CConnecl
? COM
- FmalConstiuct
FinalRelease
OilComeclion
:* OnDisconnecHori
.* OrAddrsUpdale
!
On El talup Complete
OnEleginShutdown
> m_FOTE
rn_fAddlnlnslance
? COM
in_pDTE
(Xonnert
CctieMode!
. 12-6.
Show Detirnlran
Show Children
Show Children
12
? COM
. FnaConslrucl
- FnaHetase
* OnConneclen
OnDisconneclion
- OrAddliuHJpdatr
* OnStactupCompH!
* OnBegmShuldonn
m_[CTE
. 12-7.
Kind c
Ltnguagt
COMJNTERFACE^ENTRY
CodeElement
, CodeElement
. CodeElement
. .
CodeElement :
CodeElementFromPoint FileCodeModel CodeElement
TextPoint, EditPoint VirtualPoint. CodeElementFromPoint.
CodeElement CodeElementFromPoint(TextPoint Point, vsCMElement Scope);
CodeElementFromPoint TextPoint,
, vsCMElement, ,
. , 12-1 TextPoint, CMCallbackFunction,
CodeElementFromPoint vsCMElement, vsCMElementPararneter,
CodeElement, \ CodeElementFromPoint vsCMElement, vsCMElementClass, CodeElement, CMClass.
CodeElement vsCMElement, Scope CodeElementFromPoint.
, CodeElementFromPoint,
CodeElement. , CodeElement
CodeElementFromPoint -
322
II
xxxPointParentParentProjectltemfileCodeModel.CodeElementFromPoint.
; CodeElement
TestCodeEl&mentFromPoint TestCodeJEtementProperty -:;
, Scope CodeElement,
CodeElemetitPromPoint CodeElement.
Output,
, . CodeElementFromPoint CodeEh'ment
;; vsCMElement Scope
CodeElement Output.
, , Visual - .
* . , 12-1 '
Visual --. param ^
CMCallbac&Fitttction TestCodeMlemenfFromPoint, Visual - CMCctttbacfePttnction vsCMEtementFunction, CMClass
vsCMElementOass CMNamespac-e vsCMEfementNamespace,
param vsCMEIemeiitParameter*.
:
-' |>: Visual # Visual }# 2 3 ^sCMEt&mentPanxmeter vsCMEtemetitFunctton), a Visual Basic 1 3 ;'"
(vsCMElementParctm&tef). -~
CodeElement. vsCMElementParameter, , vsCMElementFunction,
? CodeElementFromPomt CodeElement ,
, , , .
. : AddClass, Visual C#, .cs, Visual C++
.-, Visual J# .jsl-. ,
, 12-1. :
( , , . ).
, , cAdd-.AddNamespace, AddClass, AddVariable . . Add-, CodeElement,
CodeElement. : CodeElement
12
323
CodeElemeffi
, ; ,
. 12-1 CMNamespace, :
Sub CreateLlsting_12_1{)
Dim fern As FileCodeModel = GetFileCodeModelQ
If Not fern Is Nothing Then
Dim cdeNamespace As CodeNamespace
1
.
Try
cdeNamespace = fcm.AddNamespace("CMNamespace")
Catch e As Exception
End Try
6 .
If Not cdeNamespace Is Nothing Then
End If
End If
End Sub
FileCodeModel AddNamespace
CodeNamespace. AddNamespace Try/Catch,
Add ,
. , , , .
CMDelegate
, , Try/
Catch:
Try
Dim cdeDelegate As CodeDelegate
' ,
cdeDelegate = cdeNamespace.AddDelegate("CMDelegate",
vsCMTypeRef.vsCMTypeflefVoid)
1
.
cdeDelegate.AddParameter("delParam", vsCMTypeRef.vsCHTypeReflnt)
Catch e As Exception
End Try
AddDelegate AddParameter ,
; vsCMTypeRef.vsCMTypeReJVoid , a vsCM-
324
TypeRefmCMTypeReflnt .
, AddParameter,
.
:
Dim cdeStruct As CodeStruct
' .
cdeStruct = cdeNamespace.AddStructC'CMStruct",
-1)
.
cdeStruct.AddVariablef"field", vsCMTypeRef.vsCMTypeReflnt)
Catch e As Exception
End Try
:
, , A/rf-,
, . -1 i&AddStruct
; ^-. :
Try
-1)
.
cdeInterface.AddFunction("CMInterfaceMethod",
vsCHFunction.vsCMFunctionFunction, vsCMTypeRef,vsCMTypeReflnt)
Catch e As Exception
End Try
12
325
Try
' .
cdeClass.AddAttributeC'CMAttribute", "CMVal")
Catch e As Exception
End Try
Try
1
- .
cdeClass.AddVariableC'memberVa", vsCMTypeRef.vsCHTypeRefObject, -1)
Catch e As Exception
End Try
Try
, , : :! 12-1 , - , ,
Add-,. , :,
CreateListing_l2_1 : Visual C#
, , Visual C++ , , Visual J# ,
, , , , a Visual Basic
... :
, .
326
II
. , :
Setup, Help,
V I 2 , IDE Visual
Studio .NET, , .
Ml
13
, ,
-
Microsoft Visual Studio .NET, Windows Installer.
13
329
Visual Studio .NET , .msi. , New Project Setup And Deployment Projects
Project Types. Setup Project ,
.NET Win32, , a Web Setup
Project Web- Web- .
Merge Module (. ) .
Build \ Build Solution, , Configuration Manager . ,
330
III ,
File System
, .msi. File System
, , .
, ,
. File System
, . , ,
Add : Folder , Project Output ,
, , File Assembly
. Visual Studio .NET ,
( ).
Common Files Folder , (C:\Program Files\Common Files).
Fonts Folder , (C:\Windows\Fonts ).
Program Files Folder , (C:\Program Files).
System Folder .
(C:\Windows\System32).
User's Application Data Folder , , (C:\Documents and
Set tings \\ lie ation Data).
User's Desktop , (C:\Documents and Set tings \ \Desktop ).
13
331
,
File System. -
332
III ,
File System.
. , Debug
Release, , , . : , .msi , . , .
File System,
, , Add | Project
Output. Add Project Output Group , , .
.
Documentation Files File System , IntelHDoc. IntelliDoc
#, ,
. Project #.
Primary Output DLL ,
. File System, .
Localized Resources ,
File System DLL .
Debug Symbols
, .pdb, .
File System, ,
.
.msi. , .
Content Files
, .
Source Files , .
Built Outputs ,
. .msi .
, Visual Studio
.NET (,
DLL ), . DLL .msi
, DLL. File System DLL ,
, Solution Explorer Detected
Dependencies.
13
333
, , ,
Exclude. , , , ,
, .msi. ,
File System,
, .
, ,
, ,
.
?
, , , , , .msi. ,
. , VSLangProj.
, ,
VSLangProj, < . , VSLangproj Primary Interop Assembly
(1) VSLangProj.tlb,
. . File System - ( ), .
.msi , Windows Installer .
VSLangProj.tlb,
, , ] >
Visual Studio .NET, , , , .
-
, File System
, -,;
, .
,
Exclude , ,
, , . {VSLangPny , .)
,msi, ! ,
, , . -, .:' , .
Visual Studio .NET, ,
. . .
334
(II
. -,
. , .
, ( VSL.angProj.tib),
, ,
, .msi.
Registry
Registry * , .msi.
, . Registry ,
Add-in Wizard ,
, (
), , Visual Studio .NET , .
Registry Registry Editor
(regedit.exe), Windows. ,
, regedit.exe, ,
Registry. , ,
Registry' Visual Studio .NET, ,
-, C++, : - Registry -
. - File
System, Register Properties vsdipCOM,
. . - ,
DllRegisterServer DUUnregisterServer. , -
, Windows
Installer. , DllUnregisterSewer,
;
, . ,
-
. ,rgs Registry ,
, -, DLL . .
User/Machine
Registry ( ) : HKEY_CLASSES_ROOT, HKEY_CURRENTJJSER, HKEY_LOCAL_MACHINE HKEY_USERS. , Registry-
13
335
Install Setupl fa yourself. o< iat aryone who use* iHs computer
: Back
. 13-1.
Registry * , . ,
, . , .msi.
. , Registry
;
.msi , Windows Installer .
336
III
. 13-1 200 .
Windows Installer.
, MSDN. ,
.msi, {Date] , . ,
. , jl'ime][Date] 10 2002 17:54:35 17:54:35-11/10/2002.
. Registry ,
HKEY_LOCAL_MACHINE\Software\[Manufacturer] HKEY_CURRENT_USER\Software\[Manufacturer]. , ,
; [Manufacturer]
, Manufacturer
Properties, Solution Explorer.
. 13-1.
AdminToolsFolder
AdminUser
AppDatafolder
ARPCONTACr
Author
CommonApp
DataFolder
CommonFuesFolder
ComputerName
Date
DesktopFolder
FavoritesFolder
,
.
1, ,
i
, , 0 .
, ,
C:\Documents and Settings\
,
Data\
-
.
Author, Properties,
.
.
Properties,
Solution Explorer.
,
C:\Documents and Settings\
All Users\Application
.
Data\
, C:\Program Files\Common
, .
Files\
.
CRAIGS4000
.msi.
11/10/2002
C:\Documents and Settings\
.
, C:\Docurnents and Settings\
Internet Explorer.
13
337
(]
. 13-1.
FontsFolder
C:\Windows\Fonts\
InteL
Intel,
: 4 486.
5 Pentium, 6 . .
,
.
,
.msi.
,
.msi.
Craig Skibo
MyPicturesFolder
, .
MsiNTProductType
: 1 1
, 2 , 3 .
,
C:\Documents and Settings\
LocalAppDataFolder
LogonVser
Manufacturer
NetHoodFolder
PersonalFolder
,
.
PhysicalMemory
( ) ,
.msi.
,
.
1,
.
384
PrintHoodFolder
Privileged
ProductID
,
Serial Number User
Information (. ).
ProductName
.
Setupl
,
ProductName Properties
Visual Studio .NET,
.
1.0.0
.msi.
Version Properties,
Solution Explorer.
C:\Progratn Files\
Program Files.
ProductVersion
ProgramFilesFolder
111-7000000
. . .
12-1116
338
III ,
. 13-1.
ProgramMenuFolder ,
Stare.
RecentFolder
RemoteAdminTS
ROOTDRIVE
ScreenX
ScreenY
SendToFolder
ServicePackLeveL
Sen'icePackLevelMinor
SourceDir
StartMenuFolder
StartupFolder
SystemFolder
SystetnLanguagelD
TARGETDIR
TempFolder
TemplateFolder
,
.
1,
,
,
.
( ) .
( )
.
, : , ,
Windows Explorer
Send To.
(service pack).
.
, .msi.
()
I
C:\
1024
768
13
339
. 13-1. ()
Time
UserlanguagelD
USERNA
VersionNT
VirtualMemory
WindowsBuild
WindowsPolder
WindowsVolume
.msi
::.
(LCID),
.
,
.msi.
,
32- NT.
( ),
.
.
, .
, Windows.
17:54:35
craigs
1
576
2600
C:\Windows\
:\
File Types
, Windows, , , , . MS-DOS,
, , ,
Windows , , ,
Windows Explorer, ,
. -
340
HI ,
, / . , Registry, .
File Types Visual Studio .NET
.
, , , . .NET MylmageViewer ,
. ,
, ,
File | Open, (
.myimage) File ) Print.
Windows , .
(.bmp), .myimage.
.myimage , File Types, Solution
Explorer View | File Types. File
Types On Target Machine Add File Type.
Open. , ; ( File Types ) ,
Windows Explorer. , Print Edit. .
Print, , Add Action &Print.
,
.myimage Windows Explorer . ,
. &Print
Properties Arguments Print. -print %1\
-print , ,
. Windows Explorer %1 ,
. .
. ,
, , ,
. Properties Print Verb.
, , Edit Print.
,
. , File Types On Target Machine, Properties.
13
341
Command , ;
, File System, . ,
, , , Extensions. mylmage;
.
, , Windows Explorer, File System
Icon.
,
. Windows Forms Forml,
Forml :
public Form1(string []args)
<
InitializeComponent();
if(args.Length == 1)
I
pictureBoxl.Image = System.Drawing.Bitmap.FromFile(args[0]);
this.Text = this.Text + " - " +
System. 10. Path. GetFileNaine(args[0]};
else if (args.Length == 2}
!
// :
String printCommand = "-print";
string editCommand = "-edit";
if(System.String.Compare(printCommand, args[0], true) == 0)
{
II .
// PrintDocument:
pictureBoxl.Image = System.Drawing.Bitmap.FromFile(args[1] );
PrintDocument printDocument = new PrlntDocumentO;
printDocument.PrintPage += new
PrintPageEventHandler(printDocument_PrintPage);
printDocument.Print();
System.Diagnostics.Process.GetCurrentProcess().Kill();
I
else if(System.String.Compare(editCommand, args[0], true) == 0
{
// .
// MSPaint:
System.Diagnostics.Process.Start("mspaint.exe", "\""
+ args[1] + "\"">;
System.Diagnostics,Process.GetCurrentProcess().Kill();
342
III ,
Main :
static void Main(string []args)
{
Application.Run(new Forml(args));
I
Edit Print, -editfilename -print filename. , -print -edit, :
mspaint.exe ,
, .
, , . MylmageViewer .myimage ,
.
User Interface
.msi,
. ,
, , , . , , Visual Studio .NET, , .
, Properties: BannerText BannerBitmap.
, ,
. ,
;
496x68 , File System.
, , ,
BannerText, , , .
User Interface : Install Administrative Install.
Install. , ;
. Administrative Install .
.msi ~, , msiexec.exe -a mstfile.msi, ,
.msi, ,
. Administrative Install
, Install. Administrative Install User Interface ;
Windows Installer .
13
343
(. 13-2) , .
JPG, 480x320 . , , File System,
Splash User Interface SplashBitmap Properties, , File System.
. 13-2. ,
Inside Microsoft Visual Studio
RadioButtons (2 Buttons), RadioButtons (3 Buttons),
RadioButtons (4 Buttons), Checkboxes (A), Checkboxes () Checkboxes () . RadioButtons 2, 3 4 ,
; Checkboxes 0 4
(. 13-3).
Properties
. (/ , / ), . , Properties
RadioButtons CheckBoxXPropert v (
X 1 4) Checkboxes.
, , Registry,
, , , . 13-1-
344
III ,
BannerText
QChecWxwt
. 13-3- Checkboxes
RadioButtons
(. 13-4) Registry , . ,
; ButtonXValue ,
. , RadioButtons (2
Buttons) , ButtonlValue Button2Value,
1 2 . ,
, BUTTON2. , Registry [BUTTONS] ,
. (Button 1}, ,
, 1-, (Bu(,fon2) 2.
BannerText
Q8utton3
G-Bulton*
13
345
,
, Registry File System.
Textboxes (A), Textboxes (), and Textboxes () (. 13-5). .
, , , ,
User Interface, Properties
EdifXVisible ( X ) False.
, Properties EditXProperty.
, , Registry , . , EditI Properly
Textboxes () EDITA1, ,
[EDITA1], , .
Edi!3:
. 13-5. TextBoxes
Customer Information
Customer Information :
, () ,
, SerialNumberTemplate
Properties. SerialNitmberTemplate
Customer Information.
346
III
]), , , , .
.
#, %, ?, -. # %
, ? - ,
. ,
.
, ,
%, 7. (
.) 0,
, , ,
. . 13-6
<###-%%%%%%%>; ,
4, 5, 6, 7, 8, 9 9 48 7.
, ProductlD.
Customer Information
JM tc I o soil Ress
Enter jraat serial number beknv The installer will use Iliis tnlaimalior for subsequent
. 13-6.
Customer Information
13
347
; , .
, License Agreement, RTF Microsoft Word WordPad. RTF-
License Agreement File System.
License Agreement User Interface,
, Properties LicenseFile RTF.
License Agreement
Please take a moment to read the fcertse agwemenE fw .If you accept Ihe terns below, okk '1
1
Agiee",then"Ne>rt" Qiheiwise click "Cancel .
[[This is some license text. Because the text displayed here is in RTF format,
[you can use different formatting options, such as
Bulleted lists
Bold or Italics
coicr (this is red, although you will not to see the color since
Shis screen capture i? in black in whiie)
mdeven different fonts
2o NotAgrae
348
III
Register Setup
i Now.
. 13-8.
Register User
Windows Installer ,
, , , - .
13
349
. 7
, Visual
Studio .NET, , .
: .NET, Win32. CustomActions, .
Custom Actions,
, ,
File System, Custom Actions .
: Install, Commit, Rollback Uninstall.
, ,
. Install
.msi. ,
Rollback.
,
, Install. ,
Commit,
.
Uninstall, , .
.NET
, .NET Framework , Windows Forms
, .NET, .NET. ,
.
,
, Windows Forms.
Windows Forms ,
File System, Custom Actions , .
, ,
,
. Windows Forms
. Windows Forms , , ,
,msi, .
Windows Forms , , ,
,
* .
350
III ,
.
Windows Forms
. ,
, , .
. , , : ? , , , . , Windows Forms
, .NET Framework,
Custom Actions InstallerClass Properties True False.
False, Windows Installer ,
, True , .NET
.NET
.NET , . , , . ,
,
.NET, Solution Explorer, Add | Add New Item Installer Class.
, System.Con[igumtionJnstallJnstaller Runlnstatter. .msi
, , ; Runlnstaller, . System.ConfigurationJnstalUnstatter , : Commit,
Install Rollback Uninstall. Class View.
, VBScript JScript, File System Custom Actions,
, ActiveX Scripting.
,
Session Session,
.msi. 13-1 VBScript, a 13-2
13
351
JScript. .
13-1. VBScript
VBScriptCustomAction.vbs
' Session
' NSI. HSDN
' !BS-help://HS,^CC,2003/HS.M8DNQTR.2003f=EB.1033/Bisl/vref_8xis,tltm
.
tisgboxCVSScrlpt Custom Action"),
13-2.
JScript
JScriptCustomActlon.js
// Session
// HSI. HSDN
// iiis-heIp;//MS.VSCC.2003/HS.HSIfflQTR.2003FSB.1033/ffiSi/vref_8xis.htai
// .
var wshShell = new ActiveXQDject("ld$cript.Shell"};
Win32
.NET .NET Framework, , Win32. , Windows API
. Visual
C++ Win32.
Win32, Visual C++ Win32-DLL , __stdcall.
unsigned int, .
, ERROR_SUCCESS, Windows Installer , , . MSIHANDLE,
352
III ,
.
Windows Installer, DLL , Custom Actions EntryPoint
Properties. 13-3, Install Entry-Point,
, .
13-3. Win32
Win32CustomAction.cpp
slnclude
Sinclude
include
include
"stdafx.h"
<tctiar.h>
<msi.h>
<Msiquery.h>
return TRUE;
'-
'-
'
:- - :
..-.
:
, .rnsi,
-to . .msi - , , . ,msi ,
, , ,
. . : , ,
, .msi. , ;, . , , . ?
.
.NET, , Processes
13
353
, msiexec.exe,
.
.NET. , .NET Framework .
.NET Windows
Forms .NET, 'X
Processes ,
msiexecexe. * ie
Win32, Processes msiexec.exe. .
Title , OKI ia
. ; ,
.
,
.msi
Launch Conditions
. , Windows XP, , .
Visual Studio .NET. , , .msi
.
, Launch Conditions.
Launch Conditions, Launch Conditions
Add Launch Condition. Properties Condition
, true,
.msi . true, ,
Message. InstallURL false, Web-, . Windows Installer
, .
, Visual Basic
.NET . , ,
. 13-1 ,
User Interface. , ,
354
III ,
,
.
. 13-2 , . ( )
, .
. 13-2.
Not
And
Or
Xor
Eqv
Imp
.
True, True, False.
True, True.
True, True,
. True,
True False.
. True, False
True.
. True, ; False.
True, .
True, , .
True, , , .
True, , .
True, , , .
And. True, .
. True, .
. True, 1 .
. True,
.
. True, 16 ,
. True,
.
Condition.
Not Privileged
.
True, -
(VersionNT = 501) And (ServicePackLevel = 1) True, .msi Windows ( 501) Service Pack 1.
(VersionNT = 500) Or (VersionNT = 501) True, .msi Windows 2000 ( 500) Windows XP ( 501).
(ScreenX >= 800) And (ScreenY >= 600)
True, 800x600 .
Physical/Memory > 128
,
True, 128
13
355
Registry, Launch
Conditions, User Interface File System. , Windows Installer, ,
. Launch Conditions
, ,
. , Search Target Machine Launch Conditions File Search Registry Search.
File Search , .
, .
, File Search, ,
( Properties Folder Filename
). ,
, Depth
, .
, dre.olb.
Visual Studio .NET.
Visual Studio .NET Program Files,
FolderName File Search fProgramFilesFolder], File
dte.olb Depth 20 ( , , ). ,
, FILEEXISTS1 ( - ),
F1LEEXISTS1 File System,
Registry , dte.olb .
356
III ,
Registry Search
File Search , ,
,
. , ,
Visual Studio .NET 2003- Registry
Search. Registry Search,
Search Target Machine, Add Registry' Search . Properties RegKey Visual Studio
.NET (SOFTWARE\Microsoft\VisualStudio\7.1), Value IiistallDir. InstallDir , Visual
Studio .NET. ,
Property. ,
. ( REGISTKWALUEl.) , Launch
Conditions Launch Conditions Add Launch Condition.
Properties, REGISTRYVALUE1 "" Condition, a
Message InstallURL.
.msi , REGISTKWALUE1
, Visual Studio .NET.
, True,
, , Message.
PublioAssemblies
, , , , . Macros .
C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\roE\PublicAsserriblies, ,
Visual Studio .NET.
Registry Searcb, , Visual
Studio .NET, ,
.
, File System,
File System On Target Machine
. Add Special Folder (Custom Folder. Properties Registry
' Search, ( {REGISTKYVftLLiEtJ),
\PublicAssemblies DefaultLocation.
. .msi , ,
13
357
Windows- ,
, DLL. DLL .msi,
. ,
.NET, < >
; -
358
III
. ? , , .msi. , , , , , . ,
, ,
.msi,
.
,
( .msm). : DLL .
DLL , ; ,
.msi. , User Interface Launch Conditions.
, File System Web Custom Folder Module Retargetable Folder.
, , ,
, .
,
Solution Explorer ModuleRetargetableFolder Properties. ; Solution Explorer, Project | Add | Merge Module.
.NET
, Visual
Studio .NET. .NET,
,
.msi. , .
, , .msi , .
, (. 13-9).
? Visual Studio .NET
, .NET Framework, !
# Visual Basic .NET File System, Visual Studio .NET Launch
Conditions , , .NET Framework .
.NET Framework , , .
.msi, ,
.NET Framework, . ,
.
13
359
. 13-9- ,
JVET , NET Framework
, CD, . ,NET
Framework CD ,
.NET Framework, .msi. )~
,
. , ,NET
Framework, .msi.
, .msi.
Setup.exe, . , Windows Installer, .NET Framework. .NET Framework, , .NET Framework .msi, . Properties
.
.NET , dotnetfxredist_x86.msm , . , ( ), .NET Framework, ,
, .NET Framework ( System.XML,
System.Web . .), , .NET Framework. CLR, ,
, ,
, ,
.NET.
.NET Framework , Bootstrapper . Bootstrapper,
Visual C++, . ,
, ,
360
III ,
, . , , ; , ,
,
. , .
Setup.ini, ,
. , , , .NET
Framework. Setup.ini:
[Setup]
InstallNaine=Setup
FrameworkVersionRequired=v1.1
UseLocaleForFindingRedist=1
FrameworkRedlstName=DotNetfx
FrameworkInstallPath=FrameworkRedist
MSIFilePath=Setup.msi
INI ; - , , . .
InstattName . ,
Setup. .
FrameworkVersionRequired .NET Framework, . ,
, .NET Framework . vl.
( ;, ) vl.l. vl.O .NET Framework, Visual
Studio .NET 2002, a vl.l .NET Framework, Visual
Studio .NET 2003 FrameworkRedistName ( .), .NET Framework. DotNetfx.
.
UseLocaleForFindingRedist 1,
CD .NET Framework.
.NET Framework , , , , , ,
, .
,
. 0, .
, -
13
361
.NET Framework, , 0.
FrameworkfnstaUPatb
.NET Framework. , D:\MyProgramSetup FrameworklnstallPath , FrameworkRedist.
.NET Framework
D:\MyProgramSetup\ FrameworkRedist\DotNetfx.exe.
UseLocaleForFindingRedist 1, FrameworklnstallPatb
FrameworkRedistName .
. . 13-3; ,
D:\MyProgramSetup\FrarneworkRedist\9\DotNetfx.exe.
,
. , , .
MSIFilePatb .msi.
D:\MyProgramSetup, Selup.msi, D:\MyProgramSetup\Setup.msi.
. 13-3.
9
12
/6
/7
10
1228. 2052.
18
362
III ,
.msi, , .msi
.
.NET Framework CD Web, Microsoft,
.NET Framework (EULA) Microsoft .NET Framework SDK.
Windows - CD AutoPlay, CD
, Windows CD ,
autorun.inf, , .
autoruainf, CD
CD
:
[autorun]
open=setup.exe
icon=setup.lco
label=My Setup
shell\launch\conunand=Setup.exe
shell\launch=4Install this program
.
open ( ), CD . .NET Framework ,
;
.msi.
icon (
), Windows Explorer CD.
DLL, , .
label , CD Windows
Explorer.
sbelt\verbnnme CD Windows Explorer, , . verbname - . , , , . ,
.
sbelF\verbname\command CD Windows Explorer ,
5#e/^verbname, , .
verbname , ,
. autoruainf
13
363
( ) $jbe#\verbname, CD, .
autorun.inf ,
CD; , .NET Web- Microsoft. 20 , ( , ) , . 13- CD ,
. ( .NET Framework)
SetupCD. CD, .msi CD.
!
: FramewortiRedist
S 10
fjldotnetfx.exe
12
dotnetfx.exe
! 122B
Ijl dotnetfx.exe
:_^J 1^
IP dotnetfx.exe
5 17
^ dotnetfx.exe
FrameworkRedst
I dotnetfx.exe
s autorun.inf
3 5etup.exe
") Setup, ico
2J| Setup,mi
jiJ Setup,msi
is
-gp dotnetfx.exe
_) ^052
^ dotnetfx.exe
Hjp dotnetfx.exe
29
^1 dotnetfx.exe
r
|1 --JotnetFx.eote
. 13-. CD
NET Framework ()
()
, :
.msu Visual Studio .NET,
. .msi
, , , Registry, Web- . . InsideVSNecSetup. , .msi Inside Visual Studio .NET
2005 samples, . Readrnelitm InsideVSNetSemp.
364
III
. Visual Studio .NET MSDN. , .
14
Visual Studio .NET . -,
, MSDN Library,
1,5 . ,
, ,
.
Visual Studio .NET
MSDN, .
III ,
366
j-^i environment
General
Documents
Dynamic Help
Fonts and Colors
. 1
International Setting:Keyboard
Projects dnd Solution
Task List
Web Browser
Settings
{English
Prefer red eofettlcn;
jvisualStudio .NET 2003 Combined Help Collection
5ource Control
Text Editor
ftnalyzer
Database Tools
i|U Debugging
Device Tools
. 14-1- Options
(internally)
(externally) . IDE,
IDE. : , IDE .
, ,
. Contents . Index , . Search .
Search Results. -
14
367
500 ,
, . . 14-2
Microsoft Document Explorer . , Microsoft Visual Studio .NET 2003 Documentation
Microsoft Visual Studio .NET 2003 .
Visual Smdto Nil WifuiT.hiix-ii ,-,He(tin
loot
tfedbv
.
*) Vnual Sfudaj .HE'
:*,MSDN Library
= ^3 vKual studio .N1 i-*gr<
I:
'
Filtered By Search (. 14-3) Look For. ,
CString Visual Studio Macros*,
DataSet Class .NET Framework,
Visual C++ CString Operation
Relating To C-Style Strings Visual C++ Concepts. , .
, .
Search In Titles Only , .
. Match Related Words . , link*
Match Related Words linked*, linking linker. Search In Previous Results ,
.
370
III
. 14-4.
Edit Help Filters
COM/.NET, DocSet Technology:
("DocSet"="NETFramework" OR "DocSet" = "NETFrameworkExtender")
or("Technology"="COMt" OR "TechnolOQy"="NETt" )
.
, , ,
, .
List Of Available Attributes, .
, Calculate, , .
, ,
Command Window
, Vim,
Command Window.
Command Window HelpflHelp. , Fl (Fl keyword)
. F1, , Command Window
>help term, term . F1, , .
Visual Studio .NET.
Fl , , ,
; . , -
371
EditJZeplacelnFtles;
HelpJndex;
FileNewFile;
Debug.Start.
,
F1 , Dynamic Help,
HKCU\Software\Microsoft\VisualStudio\7,1\Dynamic Help
, Display Debug Output in Retail,
, s. . 14-5 Dynamic Help
. , , F1. Index.
tm-ts
ktm-fnjta
product -C*
Prodjct-C*
Product -vs
Pio'^a-fxt
SotuBcn-Siriote
SourceControl-F
SubType-Form
. 14-5.
Dynamic Help
Dynamic Help
Dynamic Help , -,
Dynamic Help Options
(. 14-6). Dynamic Help ; , ,
. ,
Dynamic Help , , . , Samples Getting Started Help (. 14-7),
372
nvironment
General
Documents
Dynamic Help
Forts and Colors
Help
International Setting;
Keyboard
Project! and Solution
Task List
Web Browser
Ci) Source Control
Qa Text Editor
^il Analyzer
U3 Database Tools
iia Debuggng
,Sl Device Tools
Syntax
Help
. 14-6.
jt Window
Code and.TextEditor
Coding Techniques and Programming Practices
Getting Started
Creating and Accessing XML Web Services Wajht;
Installing Help f orVguai Studio
Customizing Oynamk: Hdo
feual Studio .NET
What's New in Visual, audio .MET
introducing Visual Studio .NET
Inside Visual Studio
Macro Information
Web Page
. 14-7.
Dynamic Help
Dynamic Help XML Help Provider ,
14
373
XML- , C:\Program
Fiies\Microsoft Visual Studio .NET 2003\Comnion7\IDE\ HTML\XMLUnks\1033.
Visual Studio .NET Visual Studio 2002.
, : mon7\IDE\HTML\XMLLinks\1033. .xml.
Windows 1033 U.S. English.
Visual Studio .NET , ,
XML-, .
1033 XML- Context.xml,
, Visual Studio .NET.
, XML-,
XML.
Dynamic Help, :
<DynamicHelp xmlns="http://msdn.microsoft.com/vsdata/xsd/vsdh.xsd"
xmlns;xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schefflaLocation="http://msdn.microsoft.com/vsdata/xsd/vsdh.xsd">
Dynamic Help.
. LINKGROUP.
InsideVSNET
(Inside Visual Studio NET. - ,
<LINKGROUP ID="InsideVSNET" Title="Inside Visual Studio .NET"
Prlority="300">
<GLYPH Collapsed="1" Expanded="2" />
</LINKGROUP>
374
III ,
. 14-3.
to
Qf
tf*
7
8
11
pj*'
12
Qp
13
14
gj*-
gf
Confexf
Context , Dynamic Help.
. , , Context.
Context Dynamic Help . Keywords Attributes KItem Altem , , . ,
, .
, .
. ,
, KItem VSAmbient, , VSSolutionExplorer*,
, Solution Explorer.
:
<Keywords>
<!- KItem ->
375
376
III
UnkGroup="IrvsideVSNFr>Si]ppQrt</LIteiB>
</Links>
</Context>
</811>
. 14-8 Visual Studio .NET Web-
Dynamic Help.
. 14-8.
Dynamic Help
. Visual Studio .NET Help Integration Kit (VSIK) 2003,
Visual Studio .NET 2003 MSDN.
Visual Studio
.NET 2003-
,
.
Visual Studio .NHT Help Integration Kit 2003
Visual Studio .NET New Project . Help Projects , .
. 14-9.
Help Integration Kit Visual Studio
.NET, , IDE.
i- :!
rojeci Types;
377
* LJ Visual J# Projects
Convert 1.x
.chm Fie
Convert l,x
Project
Database Project?
Enterprise Template Projects
*Mote
. 14-9.
Cancel
Microsoft Help 2.
Help 2 .
.?, ? , , .
(Help collection definition)
., (Help include) ,HxF, Visual Studio
.NET Help 2 .HWProj. . . 14-4 ,
.
. 14-4. , Microsoft Help 2
.HxS
.
.HxF
,
.
,
,
: . (
) .HxF ( ). ,
, Visual Studio .NET Property Pages (. 14-10),
III
378
Post.;ompile
Navigation
Appearance
ftecorrple
1 InsideVSNET
&ilecttonlD:
Version;
11
|T~
j.
CoBH^ght:
|2003 Microsoft Corp.
OK
Cancel
SJ ip Workshop Projectiteres
-G3 HelpWoritihop Topic Items
? 1
Iwnpletes:
&
Attrbute
Definition
i*^il
3)
Keyword
Index
Samples
Definition
=r
?1.<
Qpen
. 14-11.
Cancel
Help
. .,
Property Pages. Navigation, ()
(Index), (. 14-12). .
Add New Item .htm-
Intro.htm. .
. 14-13 .htm-,
14
379
Project Explorer. .
InsideYSNET Property Pages
Compile
Geneial
Pasteorapfe
Wavtgflfem
Launch
Aps
! rf Contents!
>Tr-,i-i U^T
op Word Fib:
Cancel
. 14-12.
Help
380
lit ,
. 14-14.
,
Web- .
Web- Icon
22 Web.
(Properties) . 45 , . , Default TOG Icons VSHIK.
. -, , . ,
Web-, Microsoft Internet Explorer ,
. , . .-.
, .
, Keyword . Keyword HomePage*.
.-:
<Keyword Term = "HomePage">
<Jump Url = "HomePage.htnT/>
</Keyword>
,
Keyword XML, . ,
381
. Indexl.HxK ( 14-2):
14-2.
Indexl.HxK
<?xal versian="1.0"?>
<!DOCTYPE Helplndex SYSTEM
"fns-help://hx/resourGes/HelplFidex.DTO">
<HelpIndex BTDVersien*"1,0"
<i - >
<Keywofd Teim = "Macros">
<Juiap Url "Macros. htnt"/>
</Keyword>
<Keyword Term = "Web Site">
<Jump Url = "http://www. microsoft. coffl/iBSpress/books/6425.asp"/>
<Keyword = "Add-Ins">
<Jurn(> Url ~AddIns,htV>
</Keyword>
<Keyword Term * "HotnePage">
ifrl = "HofflePage.litffl"/>
</HelpIndex>
, (. 14-15).
, Command Window
DebugStart F5. ,
.HxS-, Document Explorer (Dexplorer.exe),
, Launch Project Properties.
Dexplorer
. Windows Installer. , (merge module) Windows
SDK. Visual Studio NET Help Integration, Help 2 SDK.
HxReg.exe.
III ,
382
WM<ir-*sM( I - Home
Ffc
S*
w*
Ipclt
#s *4 -0 00 IA*
vordcm
" :*' ^
Hdp
s-help://:nsldeV5NET/IdeV5NET/Ho
f X ! Home I
Inside Visual
Studio .NET 2003
Mat it
I X
. 14-15.
Document Explorer
,
HxReg.exe, (-), (-) (-/). , , Help 2
SDK PATH (C:\Program Files\Microsoft Help 2.0 SDK). , .HxS- Command Window. :
HxReg.exe - MS.InsideVSNET.1033 - InsideVSNET.HxC
-d "Inside Visual Studio .NET Help Sample"
:
HxReg.exe -n MS.InsideVSNET.1033 -i InsideVSNET
-s InsideVSNET.HxS -1 1033
e"
Dynamic Help.
URL Utetn, .
Macro XML - :
14
383
<LItem URL="ms-help://MS.InsideVSNET.1033/InsideVSNET/Macros.htm"
LinkGroup="InsideVSNET">Macro Information</LItem>
Visual Studio .NET.
. , Web Dynamic Help.
Visual Studio .NET
Microsoft Visual SourceSafe.
15
Visual Studio .NET
11 Microsoft Visual
Studio .NET. 2,
IDE IDE .
, Microsoft Visual
SourceSafe (VSS).
,
. -
15
385
, ,
PATH Devenv.exe, , . Devenv.exe, /foutid,
. debu^
release. (. 2), . (debug
build) :
devenv SCTestVCSI.sin /build debug
-|.|
.N11
l:n i [.I
. 15-1.
> , ! . , ! . I . i I- '
I .hi|i
Type
/project.
:
devenv SCTestVCSI.sin /project JSConsoleApp /build debug
386
III ,
, ( Clean ):
- Clean started: Project: CPPConsoleNet,
Configuration: Debug Win32 Deleting intermediate files and output files for project
'CPPConsoleNet', configuration 'Debug|Win32'.
Done
Clean: 1 succeeded, 0 failed, 0 skipped
, ,
/ run. IDE , DebugStart. , , .
,
IDE , .
/.
IDE .
IDE .
/runexit , ,
, .
, IDE, - :
devenv VBWinApp. sin /run
(deployment project),
/deploy.
. -,
. -,
, . , , Build . /deploy, Configuration Manager,
Configuration Manager Build. . 15-2 Release pe , IDE
/deploy-.
devenv VBWinApp. sin /deploy release
.
387
Configuration Manager
Active Solution Configuration:
JRelsase
*j
. 15-2.
/command IDE.
, IDE Code Model Add-in
12, :
Windows :
devenv /command erne
, , .
help command:
devenv /command "help command"
/command ,
.
,
, IDE.
/debugexe Visual Studio .NET
.
DebugStart. i
, .
,
, , Visual Studio .NET
.
Visual Studio .NET :
388
III
, Visual
Studio .NET, , .
, . Visual
# Visual C++, debug release
.
/useenv Visual C++. IDE
, , Devenv.exe.
. ,
Windows SDK
- DirectX. /useenv ,
IDE.
Devenv.exe (. 15-1):
. 15-1. Devenv.exe
/build <>
/clean <>
.
, , .
/command <>
,
Command Window IDE,
/debugexe <->
IDE,
/deploy
, , .
/out <_>
.
/project <>
,
/projectconfig
<_> .
/rebuild <>
, Clean, .
.
/run
IDE.
/runexit
IDE ,
.
/useenv
Visual C++ IDE ,
.
(GUI)
IDE . - -
389
,
GUI.
/mdi /mditabs (MDI) IDE. : IDE, /mdi
Devenv.exe /mditabs, IDE
.
,
IDE, : /fs , lDE,/fn .
, ; , IDE . /Jh
14 (. 15-3):
Clipboard Ring
General
Ma Help
; Solution Explorer
I Managing Solutions. Proii
"" * J Samples
. Visual Studio Samples
! U Getting Started
.*.-'- Creatingjjgw Solutions a : Command Window
/mditabs
/mdi
/fn <_>
IDE .
IDE MDI-.
IDE ,
. . .
390
III ,
. 15-2. ()
/fs
/migratesettings
'1 IDE .
Visual Studio .NET.
IDE .
/LCID <_>
VSIP
Microsoft Visual Studio Integration
Program (VSIP) VSIP. , (. 15-3):
. 15-3. Devenv.exe
/noVSIP
/safemode
/resetskippkgs
Visual SourceSafe
Visual Studio .NET VSS, Visual Studio .NET
Enterprise Developer Enterprise Architect VSS-.
VSS-,
.
VSS
, VSS-
.
.
VSS Visual Studio .NET VSS, Visual Studio .NET. , VSS ,
Visual Studio .NET 2003 Visual Studio .NET ,
Source Control . VSS, Visual Studio .NET,
VSS. : VSS Netsetup.exe .
15
301
VSS VSS.
VSS .
VSS Microsoft Visual SourceSafe . Ctrl+p, !
Open SourceSafe Database (. 15-4). VSS srcsafe.ini.
Open SourceS.ife Database
ame:
btiano
W SpentfedatabaserftEima 1 runVisuatSoureeSele
- Dap
III ,
392
SOUTH
Control...
Chaptes
i ..!
Samples
. 15-7.
VSS-. , ,
(working copy), (checkout) VSS. . 15-8 Solution Explorer . Solution Explorer , , .
.
393
jjal References
Assernblylnfc.vb
Fotml.vb
Setup
..1| Detected Dependencies
Sjj} Primary output From VBWinApp (Active)
. 15-8.
,
Visual Studio .NET. , , VSS
. VSS, .
VSS-, File Source
Control Open From Source Control Command Window
File.OpenFromSourceControl. Visual
SourceSafe Login
VSS, . , Create local project from SourceSafe (. 15-9).
Create local project irom SourceSafe
Create a new project in (he folder
ChapCB
ChapIO
;
Diap12
Chap13
Chapl 4
. 15-9.
111 ,
394
. Browse Folder,
.
Create A New Project In The Folder. OK .
,
Open Solution .sin- . .sin- ,
.
. VSS
.
.
, , .
.
, ,
, , VSS
Visual
Studio .NET. , . Check Out For Edit (. 15-10),
, ,
.
.a-
jie!
. 15-. VSS
: Visual Studio .NET,
.
VSS Visual Studio .NET ,
VSS.
, .
.
, , .
15
395
,
(. 15-).
jMp
. 15-11-
I ,*-
,
,
,
. , , , .
, , ,
,
, , , .
, .
, Solution Explorer
Check In. Check In
(. 15-12). .
.
Name
12/11/2002 11:22:36 PM
Comments:
I've added the second button per the new spec,
Check In
f
. 15-12. VSS
.
, ?
, VSS
.
File.GetLatestVersion.
Solution Explorer.
III ,
396
, , . , , .
VSS, Visual Studio .NET. History (FileHistory).
Source Control File Command Window.
History' , ,
(. 15-13).
History- Details, ,
(. 15-14).
,;
12/12/0212 3\t
12/11/02112*
12/11/
Checked
Chocktd
Cieoted
. 15-13- VSS
HBIOI tails
Rfe
Version:
Dflte
12/12/02 1231 a
User:
Marc
n $/SamplesChap1 5/CSWirApp
Comnmt
I've added the second button per Hie new spec
. 15-14-
Pending Checkins
(. 15-15). ,
. Source Control
File Solution Explorer.
, .
397
Change type
. 15-15.
Pending Checkins
:
, - Web, > , , . ,
- , ,
Source
Control File Visual Studio .NET.
CSWinApp Chapter 15
. ,
, . ,
, .
Ctrl+Alt-f , Command Window, JFHe.ChangeSourceControl Change Source
Control:
, , .
398
III ,
,
Unbind , ' . , , . ,
Web. ,
. , , , .
VSS , ,
, . . ,
, , ,
, , .
, Visual Basic
.NET. , Visual C#, - Visual
C++. ( 2 .)
,
, .
,
.
, VSS
. ,
, , -
.
VSS Microsoft
,
, , Team
Development with Visual Studio .NET and Visual SourceSafe
MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
dnbda/html/ tdlg_rm.asp.
He
, . , . , , ,
.
. , VSS, , , -
399
. , , .
.
,
.
, VSS .
Visual Si.udio
.NET.
IDE. , ,
, .
.
*.
FileCodeModel CodeModel
FileCodeModel CodeModel , ;
, , . FileCodeModel (, -1):
. -1. FileCodeModel
CodeElements
DTE
Language
Parent
CodeElement , .
DTE.
GUID, .
Projectltem .
FileCodeModel
. FileCodeModel FileCodeModel -
401
case CodeModelLanguageConstants.vsCMLanguageCSharp:
language = "Visual Ctf";
break;
case CodeModelLanguageConstants,vsCMLanguageVB:
language = "Visual Basic";
break;
case "{E6FDF8BF-F3D1-11D4-8576-0002A516ECE8}":
language = "Visual Jff";
break;
case CodeModelLanguageConstants.vsCHLanguageVC:
language = "Visual C++";
break;
default:
language = "Other";
break;
I
return language;
! Visual
Studio .NET (, FileCodeModel
Solution Items). ,
.
14-1116
402
. -2 FileCodeModel. Addxxx
Remove ;
CodeElementFromPoint . CodeElement
12.
. -2. FileCodeModel
AddAttribule
AddClass
AddDelegate
AddEnum
.
.
.
.
AddFunction
Addlnterface
AddNamespace
AddStruct
AddVariable
CodeElementFromPoint
.
,
.
,
,
TextPoint.
.
Remove
CodeModel, ProjectCodeModel,
, FileCodeModel CodeModel
, , CodeElements ,
FileCodeModel.CocteElements.
CodeModel , . FileCodeModel, , . CodeModel (. -3).
. -3. CodeModel
CodeElements
DTE
IsCaseSensitive
Language
Parent
CodeElement , .
DTE.
, .
.
GUID, ,
Project,
CodeModel FileCodeModel, .
, , CodeModelLanguage
, (, , FileCodeModel}. IsCaseSensititte
CodeModel , , .
403
CodeModel . -4.
Addxxx Remove *.
. -4. CodeModel
AddAttribute
AddClass
AddDelegate
AddEnum
AddFunction
Addlnterface
AddNamespace
AddStruct
.
.
AddVariable
CodeTypeFromFullName
CreateCodeTypeRef
IsValidlD
Remove
CodeType,
.
CodeTypeRef,
.
,
.
.
CodeTypeFromFullName CodeType .
CreateCodeTypeRef CodeTypeRef vsCMTypeRef
(. -5).
, , IsValidlD , . .
. -5. vsCMTypeRef
VsCMTypeRejOtber
VsCMTypeRefCodeType
VsCMTypeRefArray
CodeType
VsCMTypeRejVoid
VsCMTypefteJPointer
VsCMTypeRejString
VsCMTypeRefObject
VsCMTypeReJByte
VsCMTypeRefChar
VsCMTypeRejShort
VsCMTypeReflnt
VsCMTypeReJLong
VsCMTypeRejFloat
. . .
404
. -5. vsCMTypeRef
VsCMTypeReJDouble
VsCMTypeRefDecimal
VsCMTypeReJBoot
VsCMTypeRejVariant
()
CodeElement
CodeElement
. , . CodeElement (. -6):
. -6. CodeElement
Children
Collection
CodeElement,
.
CodeElements.
DTE
DTE.
TextPoint,
.
Extender'
-.
ExtenderCATID
(ID) .
ExtenderNames -,
FullName
.
InfoLocation
vsCMInfoLocation, , .
IsCodeType
, CodeType.
Kind
vsCMElement.
.
Language
,
.
Name
.
Projectltem
Project/tern, .
StartPoint
TextPoint,
.
EndPoint
# ,
get . get.
CodeElement: Name, FullName Kind. Name,
,
. [ Visual Basic Name () .] , , , , ,
.
405
FullName . Kind
vsCMElement, , . vsCMElement
40 , , ( ,
, , ).
Children CodeElements,
, .
, . , Visual Studio .NET, Visual
C++ Children.
, , Visual
C++ . Visual Studio .NET
, Visual C++ . Visual C++ Visual
Studio .NET (, ), Visual Studio .NET , Visual C++.
, CodeElement.Children, Visual C++ , ,
vsCMElement.
InfoLocation ,
vsCMInfoLocation, , . .
-7 vsCMInfoLocation.
. -7. vsCMInfoLocation
vsCMInfoLocationProject
vsCMInfoLocationExternal
vsCMInfoLocationVirtual
vsCMInfoLocationNone
.
.
Visual Studio .NET 200 :>.
.
InfoLocation vsCMInfoLocationProject,
StartPoint EndPoint TextPoint, .
Extender, ExtenderCATID ExtenderNames
-, (- , , , IDE).
Language Projectltem FileCodeModelLanguage
FileCodeModelParent . Collection CodeElements. IsCodeType true, CodeElement CodeType ( . ).
CodeElement (. -8);
406
. -8. CodeElement
GetEndPoint
GetStartPoint
TextPoint,
.
TextPoint, .
VsCMPortName
VsCMPartAttributes
VsCMPartHeader
VsCMPartWhole
VsCMPartBody
VsCMPartNavigate
vsCMPartAttributesWithDelimiter
vsCMPartBodyWitbDelimtier
vsCMPartHeaderWitbAttributes
vsCMPartWholeWtihAttributes
.
.
,
,
.
, ,
Class View.
.
.
.
.
,
. , CodeElement,
, . CodeEletnent,
, . , . -10: CodeEletnent,
, .
407
. -10. ,
Comment
DocComment
Parent
,
.
.
CodeEletnents.
DocComment XML
, (, # J#). , DocComment, XML-, <doc></doc>.
Comment (# J#, ,
Comment,
XML- <summary>~).
CodeNamespace
CodeNamespace .NET
(package J#, namespace # C++, Namespace Visual Basic).
CodeNamespace (. -11):
. -11. CodeNamespace
CodeElement
Members
. . -.
. . -10,
,
.
CodeElement
. . -7
AddCloss
AddDelegate
AddEnum
Addlntetface
AddNamesp&ce
AddStruct
Remove
.
.
,
.
.
408
CodeType
CodeType , CodeElement.
, .NET Framework.
, (CodeClass, CodeStruct,
CodeDelegate, Codelnterface CodeEnum) CodeType.
CodeType (. -13) :
. -13. CodeType
CodeElement
Access
Attributes
Bases
DerivedTypes
IsDerivedFrom'
Members
Namespace
. . -6.
. . A-10.
.
.
.
.
,
.
,
.
CodeNamespace,
.
# ,
get . get.
Access vsCMAccess,
(public, private . .). ,
CodeType Access Visual C++ Visual
Basic. vsCMAccess (. -14):
. -14. vsCMAccess
vsCMAccessPubtic
vsCMAccessPrivate
vsCMAccessProject
vsCMAccessProtected
vsCMAccessProjectOrProtected
vsCMAccessDefault
vsCMAccessAssemblyOrJFamily
vsCMAccessWtibEvents
(public)
(private)
. - . . . , :
.
(protected)
WithEvents
409
IsDerivedFrom , ,
CodeType. Visual C++
, , # J# , Visual Basic .
DeriveaTypes CodeElement,
,
. .
Members CodeElement, , Codt Type.
, , Namespace .
. -15 CodeType, .
.
. -15. CodeType
CodeElement
AddAttribute
AddBase
RemoveBase
RemoveMember
. . -7,
.
.
,
.
CodeClass CodeStruct
CodeClass CodeStruct
. ,
C++ class,
, private.
CodeClass CodeStruct ;
, .
. -16. CodeClass CodeStruct
CodeElement
CodeType
Implementedlnterfaces
!&\bstract
. . -6.
. . -11.
. . -10.
,
,
.
Implementedlnter/aces CodeElements,
, . #, J# Visual Basic
; Visual C++ Bases, Implementedlnterfaces
.
41 0
IsAbstract , . ,
# J# .
. -17 CodeClass CodeStruct, .
.
. -17. CodeClass CodeStruct
CodvElement
CodeType
AddCloss
AddDelegate
AddEnum
. . -7.
. . -12.
.
,
.
.
.
,
.
.
,
AddFunction
Addlmplementedlnterfctce
AddProperty
AddStmct
AddVariable
Removelnterface
Code Interface
Codelnterface . .
-18 Codelnterface; , .
. -18. Codelnterface
CodeElement
CodeType
. . -6.
. . -11.
. . -10.
CodeElement
CodeType
AddFunction
AddProperty
. . -7.
. . -12,
,
.
411
CodeEnum
CodeEnum . . -20,
CodeEnum .
. -20. CodeEnum
CodeElement
CodeType
. . -6,
. . -11.
. . -10,
CodeEnum . -21, .
*.
. -21. CodeEnum
CodeElement
. . -7.
CodeType
. . -12.
AddMember
CodeDelegate
CodeDelegate .
CodeDelegate (. -22):
. -22. CodeDelegate
Codetilement
CodeType
BaseClass
Parameters
Prototype'
'
. . -6.
. . -11.
. . -10.
CodeClass,
.
CodeElements
.
,
CodeTypeRef,
.
# ,
get . get.
412
VsCMPrototypeFullname
VsCMPrototypeNoName
I'sCMPrototypeClassName
I'SCMPrototypeParamTypes
vsCMPrototypeParamNames
vsCMPrototypeParamDefauUValues
vsCMPrototypeUniqueSignature
VsCMPrototypeType
vsCMPrototypelnitExpression
.
.
.
.
.
.
, .
.
.
, , CodeTypeRef,
. , #, Jit Visual
Basic.
CodeDelegate . -24, .
*.
. -24. CodeDelegate
CodeElement
CodeType
AddParameter
RemovePararneter
. . -7.
. . -12,
.
.
Code Variable
CodeVariable . . -25 CodeVariable.
. -25. CodeVariable
CodeElement
Access
Attributes
InitExpression
IsConstant
. . -.
. . -10.
.
,
.
, .
. -25. CodeVariable
IsSbctred
Prototype'
413
()
,
.
CodeTypeRef,
.
" # ,
get . get.
Access CodeTypeAccess vsCMAccess (. -14). , # J#.
Attributes CodeElements,
CodeAttribute .
InitExpression . . , Visual Basic, . , InitExpression, , . ,
.
IsConstant , . ,
J# False. , Visual Basic, .
IsShared ,
( True)
(False). , # J#.
Prototype , .
, CodeDelegatePrototype-,
vsCMPrototype (. -23),
. InitExpression Prototype ' '('''-' ' 'vsCMProibtypelmtExprestiori).
.
CodeTypeRef,
. , Visual C++.
. -26 CodeVariable. .
.
. -26. CodeVariable
CodeElement
AddAttribute
. . -7.
.
414
CodeProperty
CodeProperty . , -27 CodeProperty. , J J# get__xxx setjxxx
CodeFunction. . -27 J#.
. -27. CodeProperty
CodeElement
Access
Attributes
Getter
Prototype
Setter
. . -.
. . -10,
.
.
CodeFunction, - (getter) .
.
CodeFunction, - (setter) .
CodeTypeRef,
.
Access /
(. -14). ,
, Visual Basic not implemented, a Visual C++
(public) readonly.
Attributes CodeElements,
CodeAttribute , .
Getter Setter /
. Getter Setter
CodeFunction,
. # Visual Basic .
, , CodeFunction, CodeFunction,
Prototype .
Prototype vsCMPrototype (.
-23) . , CodePropertyPrototype . Prototype
,
CodeTypeRef, . , . , Visual
C++ ,
.
415
. -28 CodeProperty, .
*.
. -28. CodeProperty
CodeElement
AddAttribiile
. . -7.
,
CodeAttribute
CodeAttribute , .NET
Framework. . -29
. -29. CodeAttribute
CodeElement
Value
. . -.
. . -10.
,
Value / . :.4
, J# ,
. Visual C++ .
. -30 CodeAllribute .
,
. -30. CodeAttribute
CodeElement
Delete
. . -7.
.
CodeFunction
CodeFunction . . -31
CodeFunction.
. -31. CodeFunction
CodeElement
Access
Attributes
CanOverride
FunctionKind
IsOverloaded
. . -.
. . -10.
.
.
.
vsCMFunction,
, .
, .
. . .
41 6
. -31. CodeFunction
IsShared
Mustlmpletnent
Overloads
Parameters
Prototype'
()
,
.
,
CodeEIements,
.
CodeElements,
.
CodeTypeKef,
.
' # ,
get . get.
Access (. -14). , , Visual
Basic, .
Attributes CodeElements,
CodeAttribute , .
CanOverride ,
. ,
Visual C++ True. J# ; J#
(final) .
FunctionKind vsCMFunction (. -32). .
. -32. vsCMFunction
vsCMPunctionOther
I'sCMFunctionConstructor
vsCMFunctionPropertyGet
vsCMFunctionPropertyLet
vsCMFunctionPropertySet
vsCMFunctionPutRef
vsCMFunctionPropertyAssign
vsCMFunctionSub
vsCMFunctionFunction
vsCMFunctionTopLevel
vsCMFunctionDestmctor
vsCMFunctionOperator
vsCMFunctionVirtual
vsCMFunctionPure
vsCMFunctionConstant
vsCMFunctionSbared
vsCMFunctionlnline
get-
fef-
5?-
pwf-
Sub
417
IsOverloaded , .
True, Overloads , . ,
Overloads J# , Visual C++ Visual Basic
.
IsShared , -
(True) (False). , Visual C++,
# ]#.
Mustlmplement , . . Visual +- , # J# .
Parameters ,
. ,
Prototype ,
vsCMPrototype (. 23) . .
CodeTypeRef, , . , Visual C++ .
. -33 CodeFunction, .
*.
. -33. CodeFunction
CodeElement
AddAttribute
AddParameter
Kemovef'arameter
. . -7,
.
.
.
CodeParameter
CodeParameter ,
. . -34 CodeParameter,
. -34. CodeParameter
CodeElement
Attributes
151116
. . -6.
. . -10.
,
CodeTypeRef,
.
418
Attributes CodeElements,
, .
#, J#, Visual Basic.
CodeTypeRef,
.
, Visual C++.
. -35 CodeParameter, .
*.
. -35. CodeParameter
CodeElement
AddAttribute
. . -7.
.
CodeTypeRef
CodeTypeRef , , , ,
. . -36 CodeTypeRef.
. -36 CodeTypeRef
AsFullName
AsString
CodeType
DTE
ElementType
Parent
Rank
TypeKind
.
.
CodeType, .
DTE.
,
CodeElement
.
.
419
.
, , :
- , .
: , , Addxxx,
, Remouexxx, .
,
.
, .
, , (.); Visual C++
, (::). , ,
, Addxxx, Visual
C++ ,
.
Addxxx . ,
.
, - , .
, . Visual C++
, , .
CodeModellsVa'idlD.
.
CodeTypeRef,
vsCMTypeRef, ,
. , . , /^',
SystemJnt32 SystemBoolean, C# int bool .
Position ,
. 0 , , 1 .
. , CodeElements -
420
yWd-
, : , , . .
Add Names
AddNamespace CodeModel, FtieCodeModel CodeNamespace :
CodeNamespace AddNamespacef
string Name,
object Position
);
,
CodeNamespace. CodeModel FileCodeModel .
. .
AddClass AddStruct
AddClass AddStruct CodeModel, FileCodeModel,
CodeNamespace, CodeClass CodeStruct :
CodeClass AddClass(
string Name,
object Position,
object Bases,
object Implementedlnterfaces,
vsCMAccess Access
421
CodeStruct AdtJStruct(
string Name,
object Position,
object Bases,
object Implementedlnterfaces,
vsCMAccess Access
):
Bases
CodeClass, ( Visual C++ ). , CLR
, , , . Visual
C++ Bases,
Implementedlnterfaces . Codelnterface, . Bases, Visual
C++ . Implementedlnterfaces Visual C++.
Add Interface
Addlnteif CodeModel, FileCodeModel CodeNamespace-.
Codelnterface Addlnterface(
string Name,
object Position,
object Bases,
vsCMAccess Access
);
Bases . Codelnterface
, .
, , Codelnterface'AddBase.
Add Delegate
AddDelegate CodeModel, FileCodeModel, CodeNamespace, CodeClass CodeStruct:
CodeDelegate AddDelegate(
string Name,
object Type,
object Position,
vsCMAccess Access
);
#.
422
Add Function
AddFunction CodeModel, FileCodeModel, CodeClass,
CodeStruct Codelnterface;
CodeFunction AddFunction(
string Name,
vsCMFunction Kind,
object Type,
object Position,
vsCHAccess Access,
);
Name , ( ,- ).
Kind
vsCMFunction (. -32). , ,
, - (getter constructor),
.
Add Property
AddProperty CodeClass, Codelnterface CodeStruct:
CodeProperty AddProperty(
string GetterName,
string PutterName,
object Type,
object Position,
vsCMAccess Access,
object Location
);
#. GetterName
PutterName . # , , , GetterName
PutterName . , PutterName null;
, GetterName null.
Location ,
; , Location CodeModel (. CodeModel). #
.
AddEnum
, AddEnum CodeModel, FileCodeModel, CodeNamespace,
CodeClass \\CodeStruct-.
CodeEnum AddEnum{
string Name,
object Position,
object Bases,
423
vsCHAccess Access
);
Bases CodeType
, . Bases .
AddVariable
AddVariable CodeModel, FileCodeModel, CodeClass
CodeStruct:
CodeVariable AddVariable(
string Name,
object Type,
object Position,
vsCHAccess Access
);
AddVariable , # J# , CodeModelAddVariable
FileCodeModelAddVariable
.
AddAttribute
AddAttribute CodeModel, FileCodeModel, CodeClass,
CodeDelegate, CodeEnum, CodeFunction, Codelnterface, CodeParameter, CodeProperty,
CodeStruct. CodeVariable CodeType ( ?):
CodeAttribute AddAttributef
string Name,
string Value,
object Position
);
# J# AddAttribute. Visual C++
CodeDelegate CodeProperty ,
. Codexxx, Visual C++, , CodeParameter AddAttribute.
//-
Xrfrf- , , ?- .
AddBase
AddBase CodeClass, CodeStruct, CodeDelegate, CodeInterface, CodeEnum CodeType:
CodeElement AddBase(
object Base,
object Position
424
Base ;
#- CodeEnum Base ( CodeEnumAddBase # ).
AddBase -; . -37
, ( )' , CodeDelegate AddBase ).
. -37. AddBase
****1*.
CodeCloss.AddBase
CodeClass
Codelnterface
CodeTypeRef
CodeType
CodeStruct AddBase
CodeClass
Codelnterface
CodeTypeRef
CodeType
Codelnterface. AddBase
CodeClass
Codelnterface
CodeTypeRef
CodeType
Visual C++
Visual C#
Visual J#
'1.1
CodeEnum.AddBase
CodeClass
Codelnterface
CodetypeRef
CodeType
425
Add Member
AddMember CodeEnum-,
CodeVariable AddMember(
string Name,
object Value,
object Position
);
. Name , Value
. Value ,
, ;
,
AddParameter
AddParameter CodeDelegate CodeFunction-.
CodeParameter AddParameter(
string Name,
object Type,
object Position
);
AddParameter
CreateArrayType
CreateArrayType CodeTypeRef.
CodeTypeRef CreateArrayType(
int Rank
);
CodeTypeRef,
. Rank , CodeTypeRef.
(, cdeModel
CodeModel, cdeClass CodeClass):
Dim cdeVariable As CodeVariable
Dim cdeTypeRef As CodeTypeRef
Dim cdeTypeRefArray As CodeTypeRef
1
.
cdeTypeRef = cdeModel.CreateCodeTypeRef(vsCMTypeRef.vsCMTypeRefInt)
1
.
cdeTypeRefArray = cdeTypeRef.CreateArrayTypeO
' : .
cdeVariable = cdeClass.AddVariableC'mylntArray", cdeTypeRefArray)
.
426
, .
Delete
Delete )" CodeAttribute-.
void DeleteO;
.
Remove
Remove CodeModel, FileCodeModel CodeNamespace:
void Remove(
object Element
);
RemoveBase
RemoveBase CodeClass, CodeDeiegate, CodeEnum,
Codelnterface, CodeStruct CodeType:
void RemoveBase(
object Element
);
Element Codelnterface,
Implementedlnterfaces . J# ,
427
RemoveMember
RemoveMember CodeClass, CodeDelegate, CodeEnum,
Cadelnterface, CodeStruct CodeType-.
void RemoveMember(
object Element
Element CodeElement,
, . RemoveMember CodeDelegate, Members,
Remove Para meter
RemovePammeter CodeDelegate CodeFunctii>n\
void RemoveParameter(
object Element
Element CodeParameter. ,
. Cf J#.
.NET Framework 3
3
3, 4
349
.NET Framework SDK 17
Active Template Library CM. ATL
ActiveX 3, 249, 270, 279
Add New Item wizard . ,
add-in .
Add-in Manager 125, 128
Add-in Wizard . ,
API 4, 8, 19
ASP.NET 4, 32
ASP.NET Web Service Wizard . , Web- ASP.NET
ATL (Active Template Library) 3, 7
101
7
build .
2, 4
C# 187, 283
C# Class Library Wizard . ,
#
C++ 2, 4, 7, 10
CLR (common language runtime) 3,
4, 8, 284
CLS (Common Language Specification) 4
CME (Code Model Explorer) 319
COBOL 4
Code Editor . ,
Code Model Explorer CM. CME
code-behind . ,
Command Mode . ,
,
common language runtime . CLR
Common Language Specification
CM. CLS
common type system CM. CTS
Common User Accessibility CM. CUA
CRT 7
CTS (common type system) 4
CUA (Common User Accessibility)
71
CUA (Common User Accessibility) 51
Custom wizard . ,
DirectX 3
DLL 4, 36, 100, 109, 130
142, 145
DTE (Design Time Extensibility) 132
DTE (Development Tools Extensibility) 19
FUID (for-the-most-part unique identifier) 125
GAC (global assembly cache) 190,
250
GUID 125, 148, 191, 216, 240, 268.
388
ID 148, 160
IDE 2, 5, 7, 8, 12, 16, 17, 35, 48, 49,
53, 70, 78, 81, 82, 84, 91, 92, 100,
101, 125, 138, 147, 212, 284, 365
191
M
Macros IDE 10, 12, 78, 79, 82, 84,
91, 101, 109, 125
Margin Indicator . ,
,
MDI . ,
merge module . ,
MFC (Microsoft Foundation Classes)
2, 3,7
Microsoft CLR Debugger 110
Microsoft Foundation Classes
CM. MFC
Microsoft Interface Definition Language CM. MIDL
Microsoft Intermediate Language
CM. MSIL
Microsoft Visual C++ 6.0 78
Microsoft Windows Installer CM. MSI
MIDL (Microsoft Interface Definition
Language) 38
MSDN Library 365
MSI (Microsoft Windows Installer)
328
MSIL (Microsoft Intermediate Language, IL) 4, 8, 32
N
named command .
429
OptionsPageWizard . .
Options
outlining . ,
output type . ,
- (portable executable) 4
project .
Property Page .
references node . ,
Text Editor . ,
Tlblmp (Type Library Importer) 132
U
UI- . ,
V
430
18
9
16
12
18
65, 365
68
11, 369
160
9
4
Visual Studio 6 3
VSIP (Visual Studio Integration Program) 9, 19, 21, 40, 390
VSS (Visual SourceSafe) 390
W
Web 3
Web Forms 12, 13, 14, 23
Web Services Description Language
CM. WSDL
Web- 229
Web- 191
wildcards .
Win32 3, 147, 153, 351
Windows Forms 12, 13, 14, 23, 229
Windows- 4, 23
WSDL (Web Services Description Language) 191
WYSIWYG (What You See Is What
You Get) 12
XML 2, 7, 229
12
XSD (XML Schema Definition) 12
51
53
. GUID
. GAC
72, 73
114
8, 48
264
14
. LIBID
. ID
15, 48. 69,
70, 71
AboutBoxDetails 144
AboutBoxlcon 144
CommandLineSafe 140, 141
CommandPreload \ 38
Description 144
FriendlyName 144
LoadBehavior 140
PreloadAddinState 138
SatelliteDLLName 142
- SatelliteDLLPath
142
. IDE
BuildEvents 114
CodeAttribute 314
-CodeClass 314
CodeDelegate 314
~ CodeEnum 314
CodeFunction 314
~ Codelnterface 314
- CodeModelEvents
119
CodeNamespace 314
CodeParameter 314
CodeProperty 314
-CodeStruct 314
CodeType 316
CodeVariable 314
CSharpBuildManagerEvents 119
CSharpProjectltemsEvents 119
CSharpProjectsEvents 119
CSbarpReferencesEvents 119
-DTEEvents 111
-EnvDTEDTE
131
- EnvDTEEvents
112
- EnvDTEJDTWizard
215
- EnvDTEProject
189
~ ExtensibiUtyJDTExtensibility2
121
IDesignerHost 264
IDispatch 280
- IDTCommandTarget 102, 107,
153, 154, 155
- IDTExtensibility2 20, 102, 121,
122, 126, 127, 130, 153, 183
- IDTToolsOptionsPage
280
-IDTWizard 215, 227, 231, 233
InsideVSNetWizardLibraryJWizardPage 232
lOleCommandTarget 153
-ITDWizard 20
- IWizardPage
236
Projectltems 187
VBBuildManagerEvents 119
VBImportsEvents 119
VBProjectttemsEvents I \ 9
VBProjectsEvents 119
VBReferencesEvents 119
VCProjectEngineEventsObject 119
- VSLangProj.VSProject
189
-VSUserControlHostLibJVSUserControlHostCtl 270
-32>>> 242
51
13, 238
COMException 133
431
SystemRuntimeRemotingRemotingException 264
14
121
Connect 102
CString 7
- EnvDTE.Constants
240
- EnvDTE.TaskListEvents
258
GuidAttribute 125
InsideVSNetWizardLibraryWizardLibrary 231
Installer 166
System.WindowsFormsJFomn
264
- WinWrapper
243
-WizardLibrary 233, 236
51
13
For Each 148
foreacb 148
-& 283
-TypeOfJs
283
66
322
59
310
5, 7, 8
48, 62
5
48, 49
50
50
50
50
48, 64
- 50
8
32
48, 56
147
- GUID
149
- ID 149
161
150
157
151
158
432
151
- 149, 155
169
147
153
153
155
168
156
148
156
154, 155
15
5
34, 35
39
EnvDTE.Constants.vsProjectKindUnmodeled 198
EnvDTE.Constants.usWizardAddltem 216
EnvDTE Constants.vsWizardNewProject 216
ext_cm_AfterStartup 13 2
ext_cm_CommandLine 132
ext_cm_Extemal 132
ext_cm__Solution I32
ext_cm_$tartup 132
ext_cm_UISetup 132
ext_dm_HostShutdown 138
ext_dm_SolutionClosed 138
ext_dm_UISetupComplete 138
ext_dm_UserClosed 138
prjKindCSbarpProject
220
- prjKindVBProject 220
vsInsertFlagsCollapseToEnd 87
vslnsertFlagsCottapseToStart 87
vsInsertFlagsContainNewText 87
vslnsertFlagsInsertAtEnd 87
vsInsertFlagslnsertAtStart 87
~ vsMiscFilesProjectUniqueName
196
vsSolutionltemsProjectUniqueName 197
vsTasklcon.vsTasklconComment 254
vsTasklcon.vsTasklconCompile 254
vsTaskIcon.vsTaskIconShortcut 254
vsTasklconvsTasklconSquiggle 254
vsTasklcon.vsTasklconUser 254
vsWindowKindCommandWindow 241
vsWindowKindMacroExplorer 241
vsWindoivKindOutput 241
vsWindowKindServerExplorer 241
vsWmdowKindSolutionExplorer 241
vsWindowKindTaskList 241
vsWindowKindToolbox 241, 247
vsWindowKindWebBrowser 241
298
125, 140
433
Document 242
Document. lose 292
DocumentJtedo 291
Document.Save 291
Document.Undo 291
DoDefaultAclion
246
DTEExecuteCommand 151, 155,
168
DTELauncbWizard 228
EqualTo 293
Events.GetObject 200
tt?c 107, 153
Execute 215, 218, 228, 233, 236
ExecuteCommand 151, 168, 169
FtieCodeModelAddNamespace 3 2 3
FindProjectltem 186
.Form .ShowDialog 242
GreaterThan 293
HostUserControl 271
HostUserControl2 2 71
IDesignerHost.CreateComponeitl
265
IDTCommandTargeLExec 168 169
. 7'C'o w mandTarget.QueryStati j.s
152
IDTToolsOptionsPage.GetProperties
280
IDTToolsOptionsPage.OnOK 280
IDTWizardExecute 216, 227. 233.
234
Initialize 233
Insert 87
Install 166
112, 118, 148, 205, 240
ItemOperationsNewFile 197, 289
IWizardPagePerformWorki
235
IWizardPagePerformWork'l
2 35
LessThan 293
MakeReplacements 235
%; 88
MsgWin 89
My Macros MecordingModule.TemporaryMacro 79
Navigate 257
NeivFile 289
NewTexlFile 85
O&ye-ct
242
434
- ()nAddlnsUpdate
102, 121
- OiiAfterCi-ealed
280
- OnBeginShutdoum 102, 107, 1 2 1
-Of/Connection 102, 107, 121, 122,
131, 153, 183, 269
- OnDisconnection 102, 107, 121,
122, 183
- OnStartupComplete 102, 107, 1 2 1 .
269
OutputWindotvPane.OutputString 263
Perform Work]
232, 236
PerformWork2
232, 236
Project 242
- Projectltem 242
Properties Jtern 275
PropertyDescriptor.GetValue 26(>
QueryStatus 107, 154, 155
References Add 190
References AddProject 191
Remove \ 1 2
- SatetiiteDtlPatb
143
-Select 246
- Se/ectDoirn
246
Selection 242
- SelectUp
246
SetSelectionContainer 273
-SbowHelp 233
Solulion.Create 224
Solution Jtem 176
Solution.Open 17 5
SolutionProjectltemsTemplatePatb 221
SolutionSaveAs 175
SolutionBuildBuild 201
System.Console,Write 91
System.ConsoleWriteLine 91
SystemReflection Assembly Load 250
- Taskltem Delete 256
- Task-Items Add 255
- TaskJlem&.PorceltemsTo taskList 256
- TextSelection 87
- 'loolBoxltemsAdd 249
- ToolBoxTabAdd
248
- ToolBoxTabsAdd 247
- Type.GelType
265
- UIHierarchy.Getltem
244, 245
UIHierarcby.SelectDown 246
UIHierarcby.SelectUp
246
Uninstall 166
- Window.SetSelectionContainer
273
- Window.SetTabPicture
273
- Windows.CreateToolWindow
267
- WindowsJtem 239, 244, 247
- WizardLibraryAddPage
233
91
357
381
19,78 .
126
121
184
182
128
107
138
151, 155
122
153
109
126
138
102
165
125, 126
- 123
127
121
107
CodeFunction 111
Codelnterface
111
CodeNamespace 111, 323
CodeVariable \ 11
COM 101, 123, 191
Command 111, 158
CommandBarControl 156
CommandWindow 88, 111
CommandWindotvPaneEx 90
ConfigurationManager 200, 207
Debugger 111
-Document 86, 111, 289, 292
Ore 111, 131, 174, 241
DTEAddln 131
DTEAddlns 131
DTE.Commands 152
DTEMvents 112
DTESolutionAddlns 131
DTE.UndoContext 300
EditPoint 111, 295, 297
EnvDTE JBuildDependency
205
EnvDTEProject 189, 205
EnvDTE Properties
209
EnvDTE.Solution 174
EnvDTE Taskltem 251
EnvDTE TaskList 251
EnvDTE.ToolBoxItem 251
EnvDTE.UIHierarchyItems
246
EnvDTE.Window 239
FileCodeModel 111, 321
Glohals 212
HTMLWindow 283, 284
IPicture 255
IpictureDisp 255
IPictureDisp 254, 255, 273
ItemOperations 175, 187, 289
MenuBar 158
Microsoft.Office.Core.CommandBar 156
Microsoft.Office.Core.CommandBars 156
OutputWindow 88, 111, 262
OutpulWindowPane 91, 264
OutputWindowPaneEx 90, 91
OutputWindowPanes 262
-Process 111
Program 111
Project 111, 189
Projectltem 111, 184, 186
Projectltems 184, 186, 289
Properties 274
435
49
51
247
8,290
243
8, 12. 49, 267
238
52, 69
69
436
70
69
51
51
243
51
282
88
/case 76
-/doc 76
- IGL 5
-/GS 6
/hidden 76
/markali 76
-/06
/open 76
/options 76
/proc 76
/regex 76
- /RTCc 6
-/RTCn 6
- /RTCs 6
-/sel 76
- /up 76
jwild 76
/word 76
addlnsCollection 136
addlnsList 136
exclusiveProject 234
NetvItemLocation 235
NewItemName 235
NetvProjectLocation 2 34
NewProjectName 2 34
NewSolutionName 234
objIPictureDisp 255
ProductlnstallDirectory 235
Projectltems 235
ProjectName 235
-RunSilent 234, 235
serviceName 2 30
tasktistEi >ents 258
VisualStudioInstallDirectory 2 34
- WizardType
234, 235
6
- EnvDTE.vsHTML.Tabs
284
EnvDTE.vsTaskPriority 260
ext_ConnectMode 122
ext_DisconnectMode 122, 137
Extensibility.ext_ConnectMode 132
vsCommandBarType 159
vsTextCbanged 304
71
71
72
75
71
76
72, 73
33
Visual
Studio . VSIP
22, 23, 31, 48, 81
Deployment 40
- Visual C# 40
- Visual C++ 40
-Visual J# 40
COM- 130
-Visual Basic .NET 40
- Visual C++ 36
35
197
195
331
45
45, 203
40
200
46, 200, 384
208, 209
102
189
32, 207
176. 184
33
46
34
33
174
198
212
45
- 190
202
- 40, 101
130
189
- 31
43
222
187
187
- DTE 86
-DTE.Windows 88
-EnvDTE J06, 130
-Extensibility 106, 122, 130
Microsoft,Office.Core
107
SystemRuntimeJnteropServices 162
-SystemXML 194
-Utilities 130
70, 85
- HKEY_CLASSES_ROOT
334
- HKEY_CLASSES_ROOT\<ProglD>
123
- HKEY_CLASSES_ROOT\<ProglD>\CLS1D 123
- HKEY_CLASSES_ROOT\CLSID\<CLSID> 123
- HKEY_CLASSES_ROOT\CLSlD\InprocServer32 123
- HKEY_CURRENT_USF,R
334
- HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1 \AddIns\<ProgID> 125
- HKEY_CURRENT_USER\Software\Microsoft\VSA\7.1\AddIns\<ProgiD> 125
- HKEY_LOCAL_MACHINE
334
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\AddIns\<ProgID> 125
437
438
AdminUser 336
AncborPoint 294, 296
AppDataFolder 336
ARPCONTACT 336
Author 336
AutoHides 242
Bindings 171
BottomPoint 294, 296
DuildEvents 113
ButtonProperty 343
Caption 242
Category 256
- CbechBoxOption 280
CbeckBoxXProperty 343
Checked 256
CodeBase 250
CodeElement 321
Collection 112
Command.Bindings 169
CommandJsAvailable 155
Command J\!ame 1 51
CommandEvenls 113, 118
CommentTokens 259, 260
CommonAppDataFolder 336
CommonFilesFolder 336
ComputerName 336
ConfigurationProperties 209
ConfigurationName 201
Connected 128. 136
- CurrentTab 284
CurrentTabObjecl 284
-Date 336
DebuggerEvents 113
Description 256
DescriptionLabel 233
- DeskiopPolder 336
Document Parent 290
Document.Saved 292
Document.TextSelection 291
DocumentEvents , 8
-D77F 1 1 1 , 198, 284
DTEActiveDocument 86
DTEActiveSolutionProjects 177
- DTE Active-Window 283
-DTEAddlns 183
DTE.CommandBars 156, 157
-DTEvents 112
- DTE Properties 274, 277
DTE.Windows 2?8
-DTEErtmts 113
-EndPoint 86, 292
Events.SolutionEvents 17 7
Events.TaskListEvents 258
FavoritesFolder 336
Filename 2 56
FindEvents 113
FontsFolder 3 3 7
- FullName
112
-Globals 212
-GUID 149
HeadingLabel 233
/cow 233
-
149
IDesignerHostMootComponent
264, 266
-7te/ 337
IsF loafing 242
-IsSettable 256
ItemOperations Prompt ToSave 175
-/ft>K/ 398
Line 256
Linkable 242
LocalAppDataFolder 337
LogonUser 337
MainWindow 241
Manufacturer 337
MiscFilesEvents 113
- AfebVV TroductType
337
MyPicturesFolder 337
-Name 198
NetHoodFolder 3 37
-Object 189,241,283
- ObjectKind 240
Optimize 209
OutputWindowEvents 113, 118
-Panes 284
-Parent 112, 265, 284
PersonalFolder 337
PbysicalMemory 337
PrintHoodFolder 3 37
Priority 256
Privileged 337
-ProductID 337
ProductName 337
ProductVersion 337
ProgramFilesFolder 3 37
ProgramMenuFolder 338
Project.ConfigurationManager
200
Project.Projectltems 184
Project.UniqueName 176
Projects 176
PromptToSave 175
Readonly 291
RecentFolder 338
RemoteAdminTS 338
ROOTDRIVE
338
ScreenX 338
ScreenY 338
Selection 86, 284, 297
SelectionEvents \ 13
SendToFolder 338
ServicePackLevel 3 3
ServicePackLevelMinor 338
SbouldBuild 202
Solution 174
Solution Addlns 183
Solution.SolutionBuild 200
SoluUonBuild. ButidDepen dencies 205
Solution Co nfiguration.Solu tionContexts 201
SolutionContexts 2 01
SolutionEvents 113
SolutionltemsEvents 113
SourceDir 338
StartMenuFolder 338
StartPoint 86, 292
StarlupFolder 3 38
SubCategory 256
SystemFolder 3 38
SystemLanguagelD 338
TARGETD1R
338
Taskltems 251
TaskListEvents 113, 118
TempFolder 338
'lemplatePolder 338
TemplatePath 219, 230
TextDocument. Selection 292
TextEditorEvents 113, 118
TextSelectionJsEmpty
297
339
233
ToolBoxTab.ToolBoxItems
248
- TopPoint 294, 296
UIHierarcby.Selectedltems 245
I'll IierarcbyItem.Object 246
UIHierarchyltem.UlHierarchyIterns 244
- UndoContextJsOpen 300
- UserLangimgelD 339
-USERNAME
339
-VersionNT
339
439
- VirtualCharOffset
294
- VirtualMemory
339
- Vte 1 1 2
VSProject References 1 90
- Window.Objecl 247, 264
-WindowEvents 113, 118
- WindowsBuild 339
WindowsFolder 339
- WindowsVolume 339
ToolBox.ToolBoxTabs 247
AfterClosing 1 1 3
AfterExecute \ 1 3
BeforeClosing 1 1 3
BeforeExecute 1 1 3
DocumentClosing J 1 3
DocumentOpened 1 1 3
DocumentOpening 1 1 3
DocumentSaved 113
FindDone 1 1 3
- IDTExlensibuityl
1 28
-ItemAdded 113, 199
ItemRemoi>ed 113, 199
ItemRenamed 113, 1 99
-LineChanged 113, 304, 306
ModeCbanged 1 1 3
NavigateHandled 257
- OnAddlnsUpdate 128, 133,
137
- OnBeginShutdown 113. 128, 137
- OnBuildBegin 113, 21 0
- OnBuildDone 1 1 3, 2 1 0, 2 1 2
OnBuildProjConfigBegin 113,
OnBuildProjConfigDone 113,
OnChange 1 1 3
OnConnection 111, 128
QnDisconnection 128, 137
OnEnterBreakMode 1 1 3
OnEnterDesignMode 113
- OnEnterRunMode 1 1 3
OnExceptionNotHandled 113
OnExceptionTbrown 1 1 3
~ OnMacrosRuntimeReset 113,
OnStartupComplete 113, 117,
133
- Opened 1 1 3
PaneAdded 113
PaneClearing 113
PaneUpdated 1 1 3
ProjectAdded 1 1 3
440
ProjectRemoved 113
ProjectRenamed
QueryCloseSolution 113. 178
Renamed 113, 182
SolutionEvents 199
-TaskAdded 113
- TaskModified
113
TaskNavigate 255
- TaskNavigated 113, 257, 259
- TaskRemoved 113
WindowActivated 113, 267
- WindowClosing 113
WindowCreated 113
- WindowMoved 113
112
119
114, 210
127
116
119
198
177
117
270
7
14
265
266
- CMCallbackFunction 321
GetMembers 316
Main 215, 342
-MsgWin 92
5
114
, FUID
. IDL
: ,
Microsoft Press,
, . , : , . Microsoft Office
and VBA Developer MSDN Microsoft Visual J++ informant.
. .
, , . , Microsoft Visual Studio. Visual Studio, Visual
Studio. .
Microsoft Press. , Microsoft: VGA MS-DOS .NET.
, -.
, ,
Microsoft Visual Studio .NET 2003
. .
. . , . .
. .
. .
. .
-
Adobe PageMaker 6.0
;.
IN
I E G A L
USE
. ,
*
e-mail: info@rusedit.ru, http:// www.rusedic.ru
Bl.
OS.08.03 . 3 000 .
70x100/16. . . . 29
,
105005, . , . . , 46
MSDN Magazine/ -1
:
Web: -* otseru,
Web-.
XML 1_
(XML Schema, VS-Seeunty. Wefa . .). .
ASP --
ASP ASP.NET.
,
,
'- ADO.NET,
(SOAP. Weo- , .NET Framework
.).
.NET
.NET .
/
,
.
: &
Microsoft,
.
KanotOM
,
- .
.
., 1
.
.
,
Microsoft.
C++: ,
C++.
,
Microsoft
(MSDN Magazine/ ,
1, 2002 .)
www.micro5oft.cQm/rus/ni5dn/magazinit
rnyiSoKQ
,
-
www.ITbook.ru
( , - )
,
,
, ,
. .
ADO.NET
SQL Server
MSDN Magazine
Microsoft MSDN Library
, 1;
Microsoft ADO.NET, Microsoft SQL
Server,
.
4GO ., 2003 -
.
.NET Framework { ,
, ,
. .),
,
.NET, /
.
MSDN Magazine MSDN Library,
www.rusedit.ru almanah@rusedit.ru.
.
, 2:
Microsoft ASRNEF, Web-,
Web-.
400 .. 2003 .
19
: e-mail: sale@rusedit.ru;
-: http:// ww lTbook.ru
e d u c a t i o n
Microsoft
Microsoft
:
Windows 2000/
Sun Solaris S
Visual Studio .NET
Soft tine
119991 . , . , .
.: (095) 232 00 23
e-maif: educ@softline.ru
http://education.softline.ru
*
40 .
.
.
.
:
3.
: (095) 778-7269
*- . , 6,
.: (095)928-3567
- . 3.
.. (095] 290-4507
" - 40.
.: (095) 137-6019
. . 28,
.. (095) 238-5001
-, 78.
. .(095)152-4511
- . 13, . 1.
.: (095) 150-6917
.' . 2- -. 5^
.: (095)978-5047
. , 8.
.: (095) 229-6483
-:
, -., 28
.: (812)318-6402
. -., 20
.: (812) 312-0563, 314-7134
" .
-., 57. .: (812) 273-5053
Microsoft Press
.
, . , 2,
.: (812) 164-6565,164-1413
, -., 13.
: (812) 312-6734
^ : (312) 247-1433
- ,
. (8121567-7025
:
,
. , 12.
: (3432) 59-4200
:
' .
-, 44,
, 2-
:
000 Ton-, : (3832) 36-1026
- ():
,
. .: 8-327-908-2-57, (3272) 76-1404
():
000 -
.: (+1038044) 269-0423
" ,
141038044)268-5346
. .
.
, ,
,
. , ,
.