You are on page 1of 737

-

681.3.06
- 32 Windows.
. , . , ,
. (DLL). Visual C++.

:

.

. .
Visual C++ .NET. .: -, 2002. 736 : .
ISBN 5-94157-032-5
. . , 2002
, "-", 2002

02429 24.07.00. 28.02.02.


70x100Vi6. . . . . 59,34.
4000 . 629
"-", 198005, -, ., 29.
, 77.99.1.953..950.3.99
01.03.1999 . .

" "
,
.
198005, -, ., 29.

?

,

1
2
3
7
9

I.

11

1.

13


Windows
MFC

2. ,







3.







II.

4.

13
17
19
20
25
25
29
35
39
40
41
43
55
55
55
69
82
82
87
93
99

101
101

IV

5.


Windows 3.x
Win32
,
Windows







Properties


6.
(GDI)










-
-
7.


CFile CArchive
CFile

110
119
125
136
136
138
141
141
142
143
145
146
148
153
154
154
159
159
162
162
163
165
166
173
173
175
176
179
181
185
189
195
195
202
208
208
218
218
222
232

8.



,

9.




10.





MFC
III.
VISUAL C++

236
236
238
244
250
254
255
256
258
272
285
286
293
294
294
299
309

315

11. , Visual C++

317



Visual C++




C++
C++






,
,

.

....

317
318
320
322
324
326
328
329
333
335
336
338
341
344
344
347
352
353
355
357

VI

12. Windows









13.












..:




HTML


14.
,




ASSERT TRACE





new delete

360
361
361
363
365
366
367
367
369
377
387
387
388
389
403
403
404
407
412
437
441
446
446
473
477
480
481
481
485
486
511
513
513
515
519
524
526
526
528
529
530
531
531
535

VII

15.







MFC
MFC
DHMain


DEF


MFC


16. Internet

538
539
539
540
542
542
543
544
545
547
548
549
550
555
555
562
579
583
587

Winlnet
Web-

587
588

IV.

599

1. -
-



,



2. Visual C + +


Standard

File
.".
File / New
File / Open

601
601
602
603
604
605
605
605
612
612
614
615
617
618
620
...623
625
625
625
628

VIII

File / Close
File / Add New Item File / Add Existing Item
File / Add Project
File / Open Solution
File / Close Solution
File j Save
File / Save As
File / Advanced Save Options
File / Save All
File j Source Control
File / Page Setup
File / Print
:
File / Recent Files
File / Recent Projects
,
File / Exit
Edit...
Edit / Undo
Edit j Redo
Edit j Cut
Edit I Copy
Edit / Paste
Edit / Delete
Edit / Select All
Edit / Find and Replace
Edit / Go To
Edit/ Insert File As Text...
Edit / Advanced
Edit / Bookmarks
Edit / Outlining
Edit j IntelliSense
View
View / Open
View j Open With
View / Solution Explorer
View / Class View
View / Server Explorer
View / Resource View
View / Properties Window
View / Toolbox
View / Web Browser
View / Other Windows
View / Show Tasks
View / Toolbars
View / Full Screen
View / Navigate Backward
View / Navigate Forward
View / Property Pages

630
630
630
631
631
632
632
632
633
633
634
634
635
635
635
636
636
637
637
638
638
638
638
638
647
647
648
650
651
655
657
657
657
657
659
659
659
:...659
661
661
661
662
662
662
664
664
664


Project
Project / Add Class
Project / Add Function
Project / Add Variable
?
Project / Add Resource
Project / Add New Item
Project / Add Existing Item
Project / New Folder
Project / Unload Project
Project / Add Web Reference
Project / Set as StartUp Project
Project / Properties
Build
Build / Build
Build / Rebuild All....
Build / Clean
Build / Batch Build
Build / Configuration Manager
Build / Compile
Build / Deploy
Debug

Debug / Windows
Debug / Start
Debug / Break All
Debug / Stop Debugging
Debug / Detach All
Debug / RestaiX
Debug / Apply Code Changes
Debug / Processes
Debug / Exceptions
Debug / Step Into
Debug / Step Over
Debug / Step Out
Debug / QuickWatch
Debug / New Breakpoint
Debug / Clear All Breakpoints
Debug / Disable Breakpoint
Debug / Save Dump As
Tools
Tools / Debug Processes
Tools / Connect to Database
Tools / Connect to Server
Tools / Customize Toolbox
Tools / Add-in Manager
Tools / Build Comment Web Pages...:
Tools / Macros

IX

664
666
666
666
668
668
669
669
669
670
670
671
671
671
671
672
672
673
673
673
673
673
...675
675
675
675
675
675
675
676
676
676
677
677
677
679
679
679
679
680
680
680
680
681
683
684


Tools / ActiveX Control Test Container
Tools / Create GUID
Tools / Error Lookup
Tools / MFC/ATL Trace Tool
Tools / OLE/COM Object Viewer
Tools / Spy++
Tools / External Tools
Tools / Customize
Tools / Options
Window...;
Window / New Window
Window / Split
Window / Dockable
Window / Hide
Window / Floating
Window / Auto Hide
,
Window / Auto Hide All
Window / New Horizontal Tab Group
Window / New Vertical Tab Group
Window / Move to Next Tab Group
Window / Move to Previous Tab Group
Window / Close All Documents

Window / Windows
Help
i Help / Dynamic Help
Help / Contents
Help / Index
Help / Search
Help / Index results
Help / Search results

Visual Studio.NET
Solution Explorer
Class View
Properties
Watch
Breakpoints

684
684
686
686
687
687
:.687
689
689
691
691
691
692
692
692
692
692
694
694
695
695
:....695
696
696
696
697
698
698
699
699
700
700
701
701
701
704
704
705

3.

707

709


Windows "",
"",
. ,

, ,
. , , . , ,
,

.
.
Windows - , , .
Visual Studio.NET, Microsoft.
,
, ,
.
,

,
, . , Visual Studio 6.0,
Windows 95, Windows 98 . ,
, ( ) , . : -,
, -, Microsoft,

.
Visual Studio.NET,
32- Windows 95,

Windows 98 Windows NT.


Internet- ,
.
,
, 16- Windows DOS.
,
. ,
, , ,

, . , ,
. ,
Microsoft .
, , , Visual
Studio.NET. - #,
, .
, C++. Visual C + + ,
Visual Studio.NET,
6.0, Microsoft Foundation Classes MFC ,

.


Visual C + + , C++.
, MFC,
,
.
, DOS.

.
Microsoft. ,
DOS, Windows . Visual Studio.NET , ,
, .

, Microsoft Visual Studio.NET C++ Builder Inprise, , ,


, Windows. ,
. , Windows .:
Visual C++,
.
,
AppWizard, , MFC.
Visual C + + , , ,
. ,
, ,
: DOS ,
Windows,
, , Windows 3.x , 32-
, , , , ,
, .
,
C++ Windows. ,
, , . , , , DOS , , Turbo Vision Borland, . , . , ,
, .


,
Windows, , . , .
I. .
, Windows. -

/,
MFC.

1. .
,
,
.
, MS DOS.

2. , .
/.
, .

3. .


.

II. .
, .

4. .
,
.

5. .
, Windows
.

6. .

Windows (GDI).

7. .

Windows.

8. .
Windows
, . , , , .

9. .
Windows.

10. .
Visual C + + , , .
.

III. Visual C++.


, , . Visual
C++ ,
, .
.

11. , Visual C++.


,
Visual C++.
, .
.
.

,
.

, .

12. Windows.
Windows , Windows
.
.
.

13. .
, ,
, , , . , ,


,
. ,
.
.

14. .
. . , Visual C++
.

15. .
, , .
, , .

, .

16. Internet.
Microsoft Visual Studio.NET, ,
Internet. Winlnet Web.

, ,
Visual C + + .

1. - .
, , ,
, . MFC

, .

2. Visual C++.
Visual C++ . " ",
. ,
,
. -

,
.

3. .
SAMPLES.EXE, Visual C++.
,
MSDN. .
,
, , , .
,
, .
, . ,
.

,
.
.
,
, ,
:
void CMainFrame::Dump(CDumpContexts dc) const
{
CMDIFrameWnd::Dump(dc);
}
, , .
! 1.
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if ( !m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD I WS__VISIBLE I
CBRS_TOP t CBRS GRIPPER | CBRS_TOOLTIPS I CBRS_FLYBY I
CBRS SIZE DYNAMIC) || !m wndToolBar.LoadToolBar(IDR MAINFRAME))


TRACEO("Failed to create toolbar\n");
return -1; // fail to create

if (!m_wndStatusBar.Create(this) II
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
f
TRACEO("Failed to create status bar\n");
return - 1 ;

// fail to create

// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking (CBRS__ALIGN_ANY) ;
DockControlBar(&m_wndToolBar);
return 0;

, ,
, . : i n t , CMainFrame, DockControlBar . .
, , . , , , . , . : c o b j e c t : : S e r i a l i z e .
, , ,
, , .
, .
,
. : Open, File | New . .
( ) . : <Ctrl>, <F5> . .
,
(+). : <Ctrl>+<A!t>+<Del>.
. :
.
. : . 5.



Visual Studio.NET
:
IBM PC Intel Pentium II 450 ; 256 ;
3 ;
SVGA , 800x600 ; CD-ROM;
Microsoft ; Windows 98, Windows
ME, Windows NT Windows 2000.
, .

1.
2. ,
3.



Visual Studio.NET , , .
,
Windows, , , , .
, ,
,
.
, Visual Studio.NET, ,
, ,
. , MFC
(Microsoft Foundation Classes) Application Wizard. Visual C++
.
MFC Visual C++.
Windows
.
Visual C++.
MFC :
;
;
;
.
, Visual C++,


Microsoft , , , .
,
. , -

I.

14

, , , Visual C + + ,
, . , .
, .
Windows, ActiveX,
.
, , ,
.
.
Dialog
.
MFC:
1. File | New |
Project ( | | ) New Project (
) Standard (). New Project ( ), . 1.1.
iNew Project

i*
Templates:

| Visual C# Projects
i i_J Visual C++ Projects
1 Visual FoxPro Projects
1
I Setup and Deployment Projects
: _] Other Projects
) Visual Studio Solutions

3
Windows
Application

Web
Application

3 ~
W
do
CalssLb
iraryCo
nn
trio
lw
Lb
israry
SI
W
e
b
irarC
yontrol
WebServcie Lb

A project for creating an application with a Wn


i dows user interface
Name:

I WindowsApplicationl

Location:

E:\Documents and Settings\Nick\fvly Documents\Visual- jl

Browse...

Project wil be created at E:\,. ,\Nick\My Documents\Visual Studio Projects\WindowsApplicationl,


More

. 1.1. New Project

1.

15

2. Project Types ( ) Visual C + + Projects ( Visual C++). New Project


( ) , . 1.2.

Xemplates:

Project Types:
I Visual Basic Projects
| Visual C# Projects

] ATL Project ATL Server ATL Server


i
Project
Web Service

j Setup and Deployment Project5


[J Otfw Projects
) Visual Studio Solutions

Custom
Wizard

Extended
Stored Pro...

Makefile
Project

A project that uses the Active Template Library.


Name:

; <Enter >

Location:

; E ^.Documents and Settirig5\Administrator\My Documen j ^ j

^ Add to Solution

Browse...

(' Close Solution

Project wil be created at E;\...\Administrator\My Documents\Visual Studio Projects\<Enter name>.


*More

OK

"

Cancel

. 1.2. Visual C++ Projects


3.

Templates () MFC Application ( MFC), Name ()


"Dialog" . MFC Application
Wizard - Dialog ( MFC), . 1.3.

4. Application Type ( ). MFC


Application Wizard ( MFC) , . 1.4.
5. Application type ( ) Dialog based () Finish ().
MFC Application Wiza^i ,
. 1.5.
Visual Studio.NET Toolbox
(), .
Toolbox () 3,
.

I.

16

Welcome to the MFC Application Wizard


This wizard generates an MFC application project with the properties you specify.

These are the current project settings:


Multiple document interface
No database support
rjo compound document support

Application Type

Compound Document Support Click Finish from any window to accept the current settings.
Document Template Strings After you create the project, see the project's readme.txt file for information
about the project features and files that are generated.
Database Support
User Interface Features
Advanced Features
Generated Classes

"finish" j] Cancel

J1?!E

. 1.. MFC Application Wizard - Dialog


IMFC Application Wteard aloe
i Application Type
J Specify Document/View architecture support, language, and interface style options for your
application,
Application type:
lication Type
Compound Document Support
Document Template Strings
Database Support
User Interface Features
'... Advanced Features
:

Project style:

" Single document

Windows Explorer

*'* Multiple documents

(i MFC standard

Dialog based

P Multiple top-level documents

Use of MFC:
(V Use MFC in a shared DLL
Use MFC in a static library

W Document/View architecture support


Resource language:
I English (United States)

Generated Classes

. 1.4. Application Type

1.
'.. Dialog -Microsoft W5Ualt++[desion1
file Edit

View

Project

guild

Debug

^ ^ ' ^ ^ ^ '*'*
Tools

Wndow

"T5"t

** ^

_|gj X |

Help
> Debug

<

17

rf*

Te

*t

-*

" < dfe * **"

' JtF-

15 --I1 *?

"

Resource VKW Dialog


? x
- ^ 1 Dialog
- _| Dialog re
- _J Dialog
"3| IDD_ABOUTBOX [Englis
3 IDD_DIALOG_DIALOC |
+ _ J Icon
+ _ J RT_MANIFEST
+ _J Strma table
+ _ J Version

T
1

<l

'

giReso

1
t X

Properties

Find Re Jt 1
J

J
<i
3 ... hsReady

i f f Properties [ !-,. '. |r

u-rJ 5 1 Find Results 1


Ln 1

Col 1

Ch 1

. 1.5.

Windows
Windows ,
MDI (Multiple Document Interface,
).
Windows, .
MDI
.
Windows
MFC Application Wizard:
1. File | New |
Project ( | | ) New Project (
) Standard (). New Project ( ).
2.

Project Types ( ) Visual C++ Projects ( Visual C++).

I.

18

3. Templates () MFC Application


( MFC), Name ()
"MD1" . MFC Application
Wizard ( MFC).
4. Application Type ( ).
5.
), Finish
Wizard

Multiple documents (
(). MFC Application
,
.

6. . Debug | Start ( | ) <F5>.


Microsoft Development Environment (. 1.6), ', .
Rfflffifffi i'f **
These project conhguration(s) are out of date:
MDI - Debug Win32
Would you like to build them?
Cancel

Help

. 1.6.
M i c r o s o f t D e v e l o p m e n t Environment

. 1.7.

1.

19

7. Yes (). Visual C++


. , . 1.7.
, . , .
.

MFC
Application Type ( ) MFC Application Wizard ( MFC)
: Single document ( )
Multiple top-level documents ( ).
Windows.
.
, ,
.
,
(. 1.8).

IdiftSDI - Unlitled
File Edit Ve
i w Help

Ready
. 1.8.
, ,

20

I.

. , , .

, ,
. Visual Studio.NET : . , , .

.
. , , , . .
,
File () Exit (). Close ().


MFC,
.
DOS, .
,
Visual C++, .
.. Visual Studio.NET, Visual
Studio 7.0, .
, , 6.0.
, , , ,
.
.
.
,
, .
, DOS, , ,
, . , " MS DOS",

1.

21

Windows 95 , | |
MS-DOS.
, DOS, , , MS-DOS 16-
, a Windows 95, Windows 98 Windows NT 32- . , MS-DOS Windows 3.x 16- , Win32 32-.
- , 16-
, 32- i n t
.
i n t 4 , 2 ,
, DOS. , ,
, ,
.
Console
.
:
1. File | New |
Project ( | | ) New Project (
) Standard (). New Project ( ).
2. Project Types ( ) Visual C++ Projects ( Visual C++).
3.

Templates () Win32 Project (


Win32), Name () "Console"
. Win32 Application Wizard Console ( Win32), . 1.9.

4.

Application Settings ( ).
Win32 Application Wizard ( Win32)
, . 1.10.

5. Application type ( )
Console application ( ) Finish
(). Win32 Application Wizard
.
6. Solution Explorer ( )
Console.. , , Win32 Application
Wizard.
7. Console. 1.1.

I.

22
Win32 Application Wteard

Welcome to the Win32 Application Wizard


This wizard generates a Win3Z application project. The project can be a console application, a
Windows application, a DLL, or a static library:
These are the current project settings:
Windows application
Click Finish from any window to accept the current settings,
After you create the project, see the project's readme.txt file for information
about the project features and file? that are generated.

Finish

Cancel

Help

. 1.9. Win32 Application Wizard - Console

Win32 WuatH

Application Settings
Specify the type of application you will build with this project and the options or libraries you
want supported.
Application type:

Add support for:

Console application

;.

i*" Windows|.application:

?* DLL
("' Static library
Additional options:
F~ Empty project

Finish

Cancel

. 1.10. Application Settings

Help

1.

23

I 1.1. Console.cpp
// Console.cpp
II/11/I I/1111/1 III 111111/11111 III I/II IIIII/III/II/I///111//III III III
#include "stdafx.h"
#include <iostream.h>
int _tmain(int argc, _TCHAR* argv[])
{
cout << "Are you ready to terminate?" << endl;
char

szText[256];

cin >> szText;


return 0;

<F5> .
, . 1.11.

| e:\documents and semas\

***> ".'- .

1- jpou ready to terminate?

. 1 . 1 1 .

9.

"Yes" <Enter>.
.
2 . 629

24

I.

: .
, . , , .
, , .
MFC, MFC
Add support for ( ). ,
, .


Windows MFC /. ,
.
, , ,
CDocument, , , .
, cview,
. ,
,

Windows.
, MFC, , cwinApp. , .


, 1.
MDI
. ,

.
, MFC Class Wizard . 2.1 MDIDoc.h, .
.

26

I.

\ 2.1. MDIDoc.h

// MDIDoc.h CMDIDoc

#pragma once
class CMDIDoc : public CDocument
(
protected: //
CMDIDoc() ;
DECLARE_DYNCREATE (CMDIDoc)
//
public:
//
public:
//
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchives ar);
//
public:
virtual ~CMDIDoc();
#ifdef _DEBUG
virtual void AssertValidf) const;
virtual void Dump(CDumpContextS dc) const;
#endif
protected:
//
protected:
DECLARE_MESSAGE MAP()

CDocument, .

2. ,

27

. ,
.
MFC . ,
. ,
/
, . 5.
,
MDIDoc.cpp, 2.2.
j 2.2. MDIDoc.cpp
// MDIDoc.cpp CMDIDoc

#include "stdafx.h"
#include "MDI.h"
#include "MDIDoc.h"
tifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMDIDoc
IMPLEMENTJ3YNCREATE(CMDIDoc, CDocument)
BEGIN_MESSAGE_MAP(CMDIDoc, CDocument)
END__MESSAGE__MAP ()
// CMDIDoc
CMDIDoc::CMDIDoc()
// :
}
CMDIDoc::-CMDIDoc()

28

I.

BOOL CMDIDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// :
// (
// )
return TRUE;

// CMDIDoc
void CMDIDoc: :Serialize (CArchives. ar)
if (ar .IsStoring () )
// :
else
// :
}
}
// CMDIDoc
#ifdef _DEBUG
void CMDIDoc::AssertValid() const
CDocument::AssertValid() ;

void CMDIDoc::Dump(CDumpContextS dc) const


CDocument::Dump(dc);
#endif //J3EBUG
// CMDIDoc

2.2, . , -

2. ,

29

, ,
, .
,
, , , - .
C D o c u m e n t : : OnNewDocument , -

, , File |
New ( | , ).

. ,
.
New ()
.
, New ()
. .
cobject: ^Serialize
.
CArchive, , ,

.
CArchive ,
, , , , , CArchive: :IsStoring, BO3 TRUE, , FALSE,
. , , .
c o b j e c t : : A s s e r t v a l i d .
c o b j e c t : :Dump CDumpContext.
Assertvalid Dump ,
jfifdef _DEBUG #endif. , , , , .
14.


. 2.3 MDIView.h,
.

30

I.

I 2.3. MDIView.h
// MDIView.h CMDIView
//
#pragma once
class CMDIView : public CView
{

protected: //
CMDIView();
DECLARE_DYNCREATE(CMDIView)
//
public:
CMDIDoc* GetDocument () const;
//
public:
//
public:
virtual void OnDraw(CDC* pDC);

//
//
virtual BOOL PreCreateWindow(CREATESTRUCTs cs) ;
protected:
virtual BOOL OnPreparePrinting(CPrintlnfo* plnfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintlnfo* plnfo);
virtual void OnEndPrinting(CDC* pDC, CPrintlnfo* plnfo);
//
public:
virtual -CMDIView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContexts dc) const;
#endif
protected:
//
protected:

2. ,

31

DECLARE MESSAGE MAP()

# i f n d e f _DEBUG

// MDlView.cpp

i n l i n e CMDIDoc* CMDIView::GetDocument()

const

{ r e t u r n reinterpret_cast<CMDIDoc*>(m_pDocument);

#endif

CMDIView cview, . ,
CMDIDOC, , ,
. , , . .
, MDlView.cpp, 2.4.
2.4. MDlView.cpp
// MDlView.cpp CMDIView

#include "stdafx.h"
tinclude "MDI.h"
#include "MDIDoc.h"
tinclude "MDIView.h"
#ifdef _DEBUG
tdefine new DEBUG_NEW
#endif
// CMDIView
IMPLEMENT_DYNCREATE(CMDIView, CView)
BEGIN_MESSAGE_MAP(CMDIView, CView)
//
ON_COMMAND(ID_FILE_PRINT, CView: -.OnFilePrint)
ON COMMAND(ID FILE PRINT DIRECT, CView::OnFilePrint)

32

I.

ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
// CMDIView
CMDIView::CMDIView()
// :
}
CMDIView::-CMDIView()

BOOL CMDIView::PreCreateWindow(CREATESTRUCT& cs)


{
// :
// CREATESTRUCT cs
return CView::PreCreateWindow(cs);

// CMDIView
void CMDIView: :OnDraw(CDC* /*pDCV)
{
CMDIDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// :

// CMDIView
BOOL CMDIView::OnPreparePrinting(CPrintlnfo* plnfo)
{
//
return DoPreparePrinting(plnfo);

void CMDIView::OnBeginPrinting(CDC* /*pDC*/, CPrintlnfo* /*plnfo*/)

2. ,

33

II :
}
void CMDIView::OnEndPrinting(CDC* /*pDC*/, CPrintlnfo* /*plnfo*/)
{
// :

// CMDIView
#ifdef _DEBUG
void CMDIView::AssertValid() const
{
CView::AssertValid();

void CMDIView::Dump(CDumpContextS dc) const


{
CView::Dump(dc);

CMDIDoc* CMDIView::GetDocument() const //


//
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMDIDoc)));
return (CMDIDoc*)m_pDocument;
)
#endif //_DEBUG
// CMDIView
2.4, ' . , , ,
, .
CMDiview ID_FILE_PRINT, ID_FILE_PRINT_DIRECT
ID_FILE_PRINT_PREVIEW. CView: :OnFilePrint CView: :OnFilePrintPreview.
,
.

34

I.

cwnd: : PreCreatewindow
, cwnd.
PreCreatewindow
.
cview: :OnDraw

. (GDI)
onDraw .
6,
10.
OnDraw, 2.4, . CMDIDOC,
cview: :GetDocument.
/,
.
CDocument, .
, .
.
onDraw ASSERT_VALID,
. , MFC, . A s s e r t v a l i d
. ,
, , ASSERT A s s e r t v a l i d .
14.

CView::OnPreparePrinting,

CView::OnBeginPrinting

cview: :onEndPrinting
.
10.
CMDiview, , CMDIDOC
CObject::Assertvalid CObject::Dump,
. , GetDocument. , '
: , ,
,
(inline).
GetDocument ,
, , , .

2. ,

35


.
, ,
,
. , .



.
? , .
, , ,
,
. ,
, .
* .
MDI.cpp, CMDIAPP,
2.5.
! 2.5. MDI.cpp
// MDI.cpp .

tinclude"stdafx.h"
#include"MDI.h"
#include"MainFrm.h"
#include"ChildFrm.h"
tinclude"MDIDoc.h"
tinclude"MDIView.h"
#ifdef_DEBUG
#definenewDEBUG_NEW
#endif
// CMDIApp

36

I.

BEGIN_MESSAGE_MAP(CMDIApp, CWinApp)
ON__COMMAND(ID_APP_ABOUT, OnAppAbout)
//
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
//
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
// CMDIApp
CMDIApp::CMDIApp()
// : .
//
// InitInstance

// CMDIApp
CMDIApp theApp;
// CMDIApp
BOOL CMDIApp::Initlnstance()
{
CWinApp::Initlnstance();
// OLE
if {!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
)
AfxEnableControlContamer () ;
// /
//
// ,
// .
// ,
// .
// : -
// , ,

2. ,
SetRegistryKey (JT ("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(4); // INI
// ( )
// .
// ,
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_MDITYPE,
RUNTIME_CLASS(CMDIDoc),
RUNTIME_CLASS(CChildFrame),

//
//

RUNTIME_CLASS(CMDIView));
AddDocTemplate(pDocTemplate);
//
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame (IDR_MAINFRAME) )
return FALSE;
m_pMainWnd = pMainFrame;
// , ,
// MDI m_pMainWnd
// DragAcceptFiles.
// ,
//
CCommandLinelnfo cmdlnfo;
ParseCommandLine(cmdlnfo);
//
//
//
if

.
/RegServer, /Register, /Unregserver
/Unregister, FALSE,
(!ProcessShellCommand(cmdlnfo))

return FALSE;
//
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow() ;
return TRUE;

// CAboutDlg
class CAboutDlg : public CDialog
i

37

38

I.

public:
CAboutDlg();
//
enum { IDD = IDD_ABOUTBOX } ;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV
//
protected:
DECLARE_MESSAGE_MAP ()

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)

void CAboutDlg::DoDataExchange(CDataExchange* pDX)


{
CDialog::DoDataExchange(pDX) ;
}
BEGIN_MESSAGE_MAP (CAboutDlg, CDialog)
END_MESSAGE_MAP()
//
void CMDIApp::OnAppAbout()
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
// CMDIApp
CMDIApp cwinApp, , ,
cwinThread. ,
.
32- Windows 16 , ""

2. ,

39

. , . 16- Windows ,

. .
"" , 32- Windows, , ,
. , ,
, . . 12.
, MFC,
, cwinApp. winMain, MFC.
i n i t i n s t a n c e , ,
.



i n i t i n s t a n c e
. Afxoielnit, OLE .
AfxEnableControiContainer,
OLE.
SetRegistryKey ,
ini, Windows. ,
. File (),
, . 2.1.
L o a d s t d P r o f i i e S e t t i n g s
. 7.
, i n i t i n s t a n c e
.

I.

40
I&RichApp - RichAppl ;; ? 8 1 ^
File Edit Ve
i w Format Wn
i dow Help
New
Ctrl+N
Open...
Ctrl+O
Close
Save
Ctrl+S
Save As...

4 .
J- .- -1
>

Print Preview
Print Setup..,
1 E:\Mon flOKyrieHTbi\FIRST\Fourth
2 E:\Mrai AOKyMeHTb\lFIR5T\Thrid

3 :\ AOKyMeHTbi\FIRST\Second
4 :\ AOKyMeHTbi\FIRST\Rrst
Exit

'

'

- ' ,

'

'>:.*,.

'

.,-;

,
,

'

; ' : V.-.-,
*

'-.--*

-.--;.--"

. 2.1.


,
. . :
IDR_MDITYPE;
CMDIDOC;
cchildFrame, CMainFraim;
CMDiview.

CMuitiDocTempiate (
csingieDocTempiate). , , . ,
RUNTIME_CLASS , .
.

2. ,

41


.

.
,
. , ,
, .
.
,
.
Visual C++ 6.0,
(CMultiDocTemplate CSingleDocTemplate) -

(cchiidFrame CMainFrame). ,
Microsoft : 7.0 ( ).
CMuitiDocTemplate

cchiidFrame ,
CMainFraim .
RUNTIME CLASS ,
.
( )
DECLARE__DYNACREATE,
IMPLEMENT_DYNACREATE .

cwinApp::AddDocTempiate, .
. , , ,
, . ,
.


,
CMainFrame. , CFrameWnd, . ,
CFrameWnd, CFrameWnd: :LoadFrame,

42

I.

,
, CMainFrame.
, ,
, , .
LoadFrame CFrameWnd: : C r e a t e .

LoadFrame .

mpMainwnd, .
.

ccommandLineinfo, .
ParseCommandLme.
ParseCommandLine CcommandLineinfo: : ParseParam,
ccommandLineinfo. ProcessShelicommand, ,

ProcessShelicommand ,
, .
. Microsoft
, Visual C++ -
, , . ,
,
. , . , ,
,
, .
?
?
.
- .
MFC ,
. ? , ProcessShelicommand,
,
. ,
, return, , ProcessShelicommand.

2. ,

43

, Windows .
cwnd: :Showwindow , ,
, ,
.
i n i t i n s t a n c e cwinApp: :m_nCmdshow.

,
.
i n i t i n s t a n c e cwnd: :updatewindow,
WM__PAINT , .
WM_PAINT, .
,
, TRUE.

.
13,
.



MFC Application Wizard , . .
MDI.
MDI :
1. File | Open Solution ( | ). Open Solution ( ),
. 2.2.
2. MDI
MDI. .
3. View | Class View ( | ) <Ctrl>+<Shift>+<C>. Class View MDI ( ), . 2.3.
4. Class View ( )
MDI Add | Add
Class ( | ). Add Class MDI ( ), . 2.4.

I.

44
I Open Solution
Look in: | ' [ Visual Studio Project;
_ l Brush
I Console
History

_JDateTime
ZjDDB
I Dialog
ZJDIB

My Projects

Desktop

f-J

L - Tools -

I RichApp
_1SDI
:ZJ Sheet
_ l Text
_J Tool
ZjVSMacros

_ J Edit App
_JHelp
J_jLine
JjUst
LlMDI
Multi
_ J Print
I Progress

Favorite;

_ll Reflect

t
File name:

Fe
li s of type: [sou
l to
i n Fe
li s

zl

. 2.2. Open Solution

. 2.3. Class View - MDI

Cancel

2. ,

45

I Add Class-MDI
Templates:
~5napTn " TransicEC
ATL OLEDB
Consumer

ATL OLEDB
ATL
Provider Performanc...

ATL Property
Page

ATL Simple Generic Class


Object

MFC Class

MFC Class

MFC ODBC

Add an MFC class,


Open

Cancel

Help

. 2 . 4 . Add Class - M D I

I MFC Class Wizard - MDI

Welcome to the MFC Class Wizard


This wizard adds a class that inherits from MFC to your project. Options may change
depending on the base class selected.
DHTMl resource ID:

Automation
Creatable by type ID

"

Finish I Cancel
. 2 . 5 . MFC Class Wizard - M D I

Help

I.

46

5. Templates () MFC Class ( MFC)


Open (). MFC Class Wizard - MDI ( MFC), . 2.5.
6. Class name ( ) CMyDoc, Base class ( )
CDocument Finish ().
.
7. .. 46 CMyView,
CView.

8. Class View ( ) MDI, CMDiApp, . 2.6,


i n i t i n s t a n c e . MDI.cpp,
.

!MDI
Global Functions and Variables
Eg Macros and Constants
<>% CAboutDIg
* CChildFrarne
' CMainFrame
Bases and Interfaces
* Maps
CMDIApp(void)
$ Initlnstance(void)
OnAppAbout(void)
*>* CMDIDoc
* CMDIView
* J CMyDoc
* f CMyView
+

. 2.6. MDI
9. i n i t i n s t a n c e 2.6.
I 2.6. I n i t i n s t a n c e
// CMDIApp
BOOL CMDIApp::Initinstance()
CWinApp::Initinstance();

2. ,
II OLE
if ( .'AfxOlelnit )
{

AfxMessageBox (IDP__OLE_INIT_FAILED) ;
return FALSE;
}
AfxEnableControlContainer();

//
//
// ,
// .
// ,
// .
// : -
// , ,
//
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(4);

// INI

// ( )
// .
// ,
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(IDR_MDITYPE,
RUNTIME_CLASS(CMDIDoc),
RUNTIME_CLASS(CChildFrame),

//
//

RUNTIME_CLASS(CMDIView));
AddDocTemplate(pDocTemplate);

CMultiDocTemplate* pMyDocTemplate;
pMyDocTemplate = new CMultiDocTemplate(IDR_MYTYPE,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CChildFrame),

//
//

RUNTIME_CLASS(CMyView));
AddDocTemplate(pMyDocTemplate);
//
CMainFrame* pMainFrame = new CMainFrame;

47

48

I.

if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m pMainWnd = pMainFrame;
// , ,
// MDI m_pMainWnd
// DragAcceptFiles.
// ,
//
CCommandLinelnfo cmdlnfo;
ParseCommandLine(cmdlnfo);
// .
// /RegServer, /Register, /Unregserver
// /Unregister, FALSE,
if ( ! ProcessShellCommand(cmdlnfo))
return E'ALSE;
//
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow() ;
return TRUE;

10. MDI.cpp #inciude "MDiview.h" :


#include "MyDoc.h"
#include "MyView.h"
11. Class View ( ) cMyview. MyView.h.
12. 2.7.
I 2.7 MyView.h
ttpragma once
#include "MyDoc.h"
// CMyView
class CMyView : public CView
{
DECLARE DYNCREATE(CMyView)

2. ,

49

protected:
CMyView();

// ,
//
virtual -CMyView();

//
public:
CMyDoc* GetDocument() const;
public:
virtual void OnDraw(CDC* pDC); //
#ifdef J3EBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContextS dc) const;
#endif
protected:
DECLARE MESSAGE MAP()

ttifndef DEBUG
// MyView.cpp
inline CMyDoc* CMyView::GetDocument() const
{ return (CMyDoc*)m_pDocuraent; }
#endif
13. Class View ( ) CMyView
OnDraw.
MyView.cpp,
.
14.

OnDraw 2.8.

I 2.8 OnDraw

// CMyView
void CMyView::OnDraw(CDC* pDC)
CMyDoc* pDoc = GetDocument()
' ASSERT_VALID(pDoc) ;

I.

50

15. Dump , 2.9.


! 2.9 GetDocument
CMyDoc* CMyView::GetDocument() const

//
//

{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc))) ;
r e t u r n (CMyDoc*)m_pDocument;

16. View | Resource View ( | )


<Ctrl>+<Shift>+<E>. Resource View ( ).
17. MDI, ,
MDI.rc
Add Resource ( ). Add
Resource ( ), . 2.7.

I Add Resource
Resource type;
jg| Btimap
ji Cursor
^ | Dialog
JO HTML
_]) Icon
Sj Menu
be string Table
44 Toolbar

Import,..
Custom..
Cancel
Help

[ Version

. 2.7. Add Resource


18. Resource type ( ) Icon ()
Import (). Import.
19. /res
Files of type ( ) Icon Files ( ).
Import () , . 2.8
20. MDIDoc. .

2. ,

Lookjn:

_J.

zi -

51

X . - o|s-

\ti MDI

:
History

My Projects
:

'. -M

Desktop

Favorites
: r--"'. My Network

Filename:

zJ

. 2 . 8 . I m p o r t

Open j
Cancel
____^ tf*

21. Resource View ( )


IDI_ICONI Properties (). Properties
(), . 2.9.

j Icon Node IconRe>

Condition

ID
Language

| res'iiconl ,ILU

IDI ICON1
Russian

I Filename
| Specifies the name of the file that contains the data for this
resource.

'
,
:

. 2 . 9 . P r o p e r t i e s

22. ID ( ) IDR_MYTYPE.

52

I.

23. Resource View ( ) String Table


( )
String Table ( ). .
24. IDR_MDITYPE Caption ()

"\nMDI\nMDI\nMDI
Documents
*.mdi\n.mdi\nMDI.Document\
nMDI.Document". ,
. 2.10.
'.. MDI - Microsoft Visual C+ + fdesjgnj - 158.,13|||^1^^^|
Fiie

Edit

Jb

J -

-4J

4*^

prOjerr

guild

Cebug

Inois

Window
P -

S Vf

D^tug

'

ID
_ _ _ L lakl128
IDR MAINFRAME

^'

AFXJDS^APPJTITLE

j l i ^c^t

MDI.rt (String )*

i .

AFX_IDS_IDLEMESSAG
ID_IND1CATOR_EXT
. , IDJtJOICATOR_CAPS
ft IDJNOICATORJJUM
IDJMDICATOR..SCRL
ID JWDICATORJJVR
ID INDICATOR..PEC
ID.JILE JJEW
ID_FILE_OPEM
ID^FILEjILOSF.
ID_FILE_5AVE
ID_FILE_SAVE_AS
ID_FTLEJ>AGF_5ETUP
ID_FLE_PRIMT_5ETUP
ID_FILE_PRINT
ID FILE_PRIMT_PREV..,
i: _APP_AEOUT
1

7 - - 1 " -"*

Resource View - MDI


* MDI
_ J MDI re*

Cactltn
MDI
J"

57344
57345
59136
59137
59138
59139
59140
59141
57600
57601
57602
57603
57604
57605
57606
57607
57609
5""664

-JffJ

help

Ready
EXT
CAP
NUM
SCRL
OVR
REC
Create a new document\nNew
Open an existing dcicument\nOpen
Close the active document\nOose
Save the active document\nSave
Save the active document with a new name\ri5ave As
Change the printing optionst.riPage Setup
Change the printer and printing options\nPrint Setup
Print the active document\nprmt
Display full pages\nprmt Preview
DKplav proqram inforrnath , vf-t>.iun njmber and cop^ nght\iAbout

4-

i (!&^"1"

j Dialog

J Icon
__]
_J
_ J

"
9 ?

IOPJ-1AINFRAME [English (U.5


ICR^MDITYPE [English (U.S.)]
IDP_MfTVPE

Menu

_ J

PT_MANIFE5T

_ J

String Table

Sttmq Table [English (U.S.)]


+ _ J Toolbar
+

f 'et^ian

| I ~ J J

Output
"

|Dehug

1 Prop^rtie^
_ J i String Editor

*
BlrEd

*
_]

1 (Name)
1
5

output

:'l

^ Properties | 0 : -.;.:. i...: H^:;

Beady

. 2 . 1 0 .

25.
ID ( ) , . . IDR__MYTYPE.
26. Caption () "\nMy\nMy\nMy
Dopuments *.my\n.my\nMy.Document\nMy.Document".
27. Resource View ( ) Menu (),
IDR MDITYPE
().

2. ,

53

28. Menu () Paste (). IDR_MDITYPEI.


29. IDR_MDITYPEI ID ( ) Properties () IDR_MYTYPE.
30. <F5> .
New (), . 2.11.

. 2.11. New
31. .
New () .
32. File | Open ( | )
Open () . Open
().
33. Files of type ( ) , . 2.12.
34. Open () .

, ,
. ,
, ,
GetDocument
,
.
,
. Visual C++
,
, , , , , MFC Class Wizard, CDocument
GetDocument.

54

I.

. 2 . 1 2 . Open

, , , CDocument, . ,
, ,
MFC Application Wizard.
Get Document OnDraw. , .
, CMDIAPP: : i n i t i n s t a n c e , .
.
, , ,
, . ,
.
,
, New (), , Open () Save As
( ), , .
13 .




,
MFC, /,
.
, Windows.
, -
, , . , ,
. , , - , . ,
, , ,
,
.


Windows
, . , : ,
, , , , , . .


Visual C++ ,
, .
, , , , ,
3 . 629

I.

56

, ,
. Resource.h,
.
, , ,
.
#include, , afxres.rc afxprint.rc. , ,
,
Resource View ( ).
, .
,
, .
Visual C++ 6.0 . Visual Studio.NET Visual FoxPro, C + + .
.. Dialog - Microsoft Visual C++ [designj - Dialogic HOD

gle

Edit

Jflew

Project

Build

Eebug

Format

lools

Window

"
g

&
Dialogic (IDD_...IALOG - Dialog) |

,1

i
|

i
|
Cancel

- 3 1 Dialog
- _J Dialog re
j Dialog
IDDJBOUTBOX [Englis
^ J Icon
_J P-T_MANIFEST
+
J 5trmg Table
_ J Version

i
I
;
!

TCOO: Pa
lce da
io
l g contros
l

|
j
I Dialog Node IDIgRes

(Name)
Ready

. .1.

3.

57


Dialog, 1. ,
1 .
MFC Application Wizard . 3.1.
Dialog , .
, ,
:
1. , , - Resource View
( ), View | Resource View ( | ) <Ctrl>+<Shift>+<E>.

Resource View. - , Microsoft , Resource View (
) .
2. TODO: Place dialog
controls here, , <Delete>. .
3. Dialog.rc , ,
Dialog. IDD DIALOGDIALOG. Resource View ( )
Properties () .
Properties () ,
:

I D D D I A L O G D I A L O G Properties ().
;

View | Properties Window ( | );

<F4>;
, , , ,
. .

4. Properties () Language (). .


5. "Russian" ().
6. .
Properties () .

I.

58

7. Caption () Appearance (
) "
".
8. Output ( ).
, ,
, , . . 200x320 .
9. Toolbox (). , . 3.2.
. Dialoa- Microsoft V ^ t H [ d . M ^ U i H B H H i File Edit View Project guild Eebug Fu/niat TnnK yndow tHp
.|-^-.=*
$ Toolbox
,ja Dialog Editor
., General
f

R, '"

> Debug

i3

ext

"

-o *

Resource View - Dialog

1 ' X

u
xj

PC nte

' '
|

OK

X.

rc*

^ IDD.ABOUTBOX [English (U.S.))


5 IDD_DIALOG_DIALOG [English (U.S.)]

Caned

i& sv

?T_MANIFEST
5trmg Table
Version

\\

Properties

| IDD_DIALOG_DIALOG (Dialog)

j j

X
^J

|::|S* [oi|-/ 1

1
J

Ready

(Name)
0

[S1 Properties \0 ,r KIi


j!"" 200 x 320

. .2. Toolbox
10. Dialog Editor ( ), . 3.3.
11. Static Text ( ), , ,

3.

59

. , . 3.4.

Ere
i Edti ^e
i w Project guild ebug Fgtruat lools Wnidow Hep
l
P .
*

Ctalgg Editor

1^ Pointer

Buttun

'

|
i

fx Check Box

1
1

1
1

0>

Caned

Combo Bo>
List Box

ig re
jolog
^ IDD_ABOUTBO)i [English (U.5.)]
3| IDD_DIAH:'G_WALOG [English (U.S.)]

ill

ab| Edit Control

Resource View - Dialog

con
JT_MAflIFEST

1
l

Ihrg Table
Version

l"*] Group Box


(* Radio Button
Static Text
( $ | Picture Control

EB Horizontal Scroll Bar


Vertical Scroll Bar
0- Slider Control
_iJ

# Spin Control

3--".

EE3 Progress Control


Hot Key

1 *
^ C .

aReso...|

Properties

?2J List Control

flDD_DIALOG_DIALOG (Dialog)

ffc Tree Control

Q Animation Control

General

X
J^J

jTT) $i [] -/ "

C 3 Tab Control
Ao Rich Edit 2.0 Control

'
z\

(name)

6*Properties | ~ " '..I- I'

Ready

. 3 . 3 . Dialog Editor

12. Caption () Properties ()


" ".
13. Edit Control ( )
Toolbox (),
. .
, ,
.
(
).
,
, , , .

I.

60


.
. Dialog - Microsoft Visual C++ [design] - DMlog.rc (J5>
Ble

Ed*

Bew

Eroject

j p ' - e 4

guild

P_ebug

Forniat

I IT1! I?', - -

Sb, Dialogic (IDD...ALOG - Dialog)* |

Iools

Window

Help

Debug
^ t Resource View - Dialog
igrc*
Dialog
3| IDD_ABOUTBOX [English (U.S.)]
3 IDD_OIALOG_DIALOG [English (U.S.)]
^con
f!T_MANIFEST
String Table
/ersion

Ready

. .4.
,
,
.
.
, .
, , .
, . 3.5.
14. ID ( )
Misc ( ) Properties () I D C E D I T I IDC_EDIT_BOX.

3.

61

Dialog - Microsoft Visual ++ [design] - ^ <tmi

File dif tfiew Project guild Qebug FQrmat lools Wnidow Help

* i ! "i * ' " "


I Debug
t=p I " L. '' !JB1 @ ^ C

% Dialog.rc (IDD..ALDG - Dialog)*


', i

none

J Sample edit

.-I.JlXl

* \_M Text

1 ! X Resource View - Dialog

Jjj

qrc*
Dialog
IDD_A8OUTBOX [English (U.S.)]
3 IDO_DIAIOG_DIAIOS [English (U.S.)]
.con
?T_MANIFEST
5trng Table
Version

~Sl "'Mi
X

: Properties

IDC_EDIT1 (Ed* Control) IEdBo>_

Group
ID
Tabstop

False
IDC_EDIT1
True

(Name)

Ready

. .5.
15. .. 11 14,
IDCBUDDY " ", .
16. Toolbox () Spin Control ( )
.
, . 3.6.
17. Appearance ( ) Properties
() Alignment ()
Right Align ( ). . Wrap (),
, ,
. ArrowKeys

I.

62

( )
,
. NoThousands (
) .
.. Dialog - Microsoft Visual C++ [1] -.(
File

Edit

View

Project

J - J - t f B f l

ij

fjgM

Cebug

J ' b f i

'

Format

look

JWndow

Debug

Dialogic (IDD...ALOG - Dialog)* [

none
I Sample i ~


I Sample edit box

Resource;Wer-Dialog .

_ J_x

grc
Dialog
3] IDD_ABOUTBOX [English (U.S.)]
5 IDD_DIALOG_DIALOS [English (U.S.)]
con
4T_MANIFEST
String Table
Version

Properties

in Control) ISpn
i S_J

,
Group
ID
Tabstop

False
IDC_SPIN1
False

(Name)

Ready

. .6.
18. Behavior () AutoBuddy ( )
SetBuddylnteger ( ), AutoBuddy
.
19. ID ( ),
Misc ( ),
I D C S P I N .
20. Cancel
" ".

()

21. Toolbox () Combo Box


( )

3.

63

.
,

, . 3.7.

Fjle Edti Ve
jw Eroe
i ct guild bebug Fo/mat look Wn
idow dep
l
J - J - ^ B S * '-, C- ^
! Debug

Text

2) Dialog.rc (IDD..ALOG - Dialog) I

Resource View - Dialog

igrc*
dialog
3 IDD_AEOUTBOX [English (U.S.)]
1
none
j Sample edit


j Sample edit box

3 | IDD_DIALO5_DIALOG [English (U.S.)]

OK

Caned

"4

'T_MANIFE5T
String Table
Vision

33 :ia

Prupeities
a

|~IDcIcOMB01~(Conibo-boi( Cont

a-Group
I

Fas
le

ID

IDC_COMBO1

Tabstop

True

(Mame)

Ready

. .7.
22. Behavior () Properties
() Data
() "4;16;256". , . Sort (),
, False ().
23. ID ( ),
Misc ( ),
_.
24. Toolbox () Check Box
() .

I.

64

25. Properties () IDCSAVE


Caption () "?".
, . 3.8.

. Dialog - Microsoft Visual C++ [design! - Dlalog.rt (IDD JMAO


I K JH

fjle

Edit

View

Project

J ia - r# H 9

guild

Qebug

* * d>

Fjj-mat

"

jpols

gmdow

.i
t x

Dialog.rc (IDO..ALOG - Dialog)*

.grc*
Jiaioa
3 IDD_ABOUTBO>! [English (U.S,)]
3] IDD_DIftLOS_DIALOS [English (U.S.)]
tcon
(T_MANIFE5T
jtrmg Table
Version

*i

Resource View - Dialog

| Sampel edti box


Bitmap
Caption
Chert Edge
Flat

False
?
False
False

Caption
Specifies the text displayed by the
control.
_>J
Ready

Properties | &

" 23,165

i >

;!"* 10x56

. .8. .
26. Toolbox () Group Box
( ), .
27. Captions () Properties ()
" ".
28. Toolbox () Radio Button ()
.
29. Properties ()
IDC_EDIT_SWITCH, Caption () " " True Group (), Misc ( ).

3.

65

30. .. 28 29 , .
IDC_SPIN_SWITCH " ". Group (). , . 3.9.
Dialog - Microsoft Visual C + + [design] - - (>_01

i Edti Se
tfw Eroe
i ct gud
li Qebug Format look Wnidow Hep
l
3'

&J

<

l &

" '

> Debug

Text

1 t X

Dialog.rc (IDD...ALOG - Dialog)* |


i

..,,,,.,

i*.

~.,

|
none
j Sample edit

f*"

^"

Cancel 1

~4

| Samite edit box

:.

Resource View - Dialog

cue*
Jialog
S | !DD_ftBOUTBOX [English (U.S.)]
3 IDD_DIALOG_DIALOG [English (U.5,)]
xon
ST_MANIFE5T
String Table
Version

( , , , , ! , , ,

i
Pmperties

| IDC_SPIN_SWITCH (Radio-butt J-J

Group

False

ID

IDC_SPIN_5WIT(_J

Tabstop

False

ID
Specifies the identifier of the control.

J
Ready

jj*~
+

Eg Properties l O ' ^ t i . '

32, 105

i * 10 X 105

. .9.
31. Cancel () Caption () Properties ()
"". , . 3.10.
. ,
Visual C++ Dialog.rc Resource.h. Dialog.rc , , , 3.1.

66

I.

.... Dialog -Microsoft * 1 + [

ile Edit Bew Eroject Build Eebug Format Iools Wnidow rjelp
J] - 3 - r^ P f ' ." l F'- k
Debug
~l
Ed J3
P.
g Dialog.r (IOD..ALDG - Dialog)*
*
i1

Resource View - Dialog


g.rc*
dialog
^ ( IDO_ABOUTBOX [English (U.S.)]
^ IDD_DIALOG_DIALOG [English (U.S.)]
.con
!T_MANIFE5T
string Table

|1

| Sample edit bo.i

fsampieedit

1 ; x


'
.

<""

birmap
V

Caphon
.

Client Edge

False

Flat

False

Caption
' Specifies the text displayed by the
control

Ready

. 3.10.

: 3.1.

// Dialog

IDD_DIALOGJ3IALOG DIALOGEX 0, 0, 320, 200


STYLE DS_MODALFRAME | WS_POPUP I WS_VISIBLE I WS__CAPTION
WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION " "
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,263,7, 50, 14
PUSHBUTTON
"",IDCANCEL,263,23,50,14

3.
LTEXT
EDITTEXT
LTEXT
EDITTEXT
CONTROL

67

" ",IDC_STATIC,19,20,55,8
IDC_EDIT_BOX,27,32,40,14,ES_AUTOHSCROLL
" ",IDC_STATIC,93,20,88,8
IDC_BUDDY,94,32,75,14,ES_AUTOHSCROLL
"Spinl",IDC^SPIN,"msctls_updown32",UDS_SETBUDDYINT
UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
UDS_ARROWKEYS,170,32,10,14

LTEXT

" " , I D C _ S T A T I C , 2 0 7 , 5 4 , 8 8 , 8

COMBOBOX

IDCJXMBO, 2 0 6 , 6 7 , 9 0 , 4 6 , CBS_DROPDOWN
WS_VSCROLL

CONTROL
GROUPBOX
CONTROL

CONTROL

CBS_SORT

WSJTABSTOP

" ?",IDC_SAVE,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,40,152, 55,10
" ",IDC_STATIC,27,68,154,67
" ", IDC__EDIT_SWITCH, "Button" ,
BS_AUTORADIOBUTTON | BS_NOTIFY |
WS_GROUP,37,87,70,10
" ",IDC_SPIN_SWITCH,"Button",
BS_AUTORADIOBUTTON,37,107,103, 10

END
,
, 0. , . , BEGIN END,
. , , ,
, .
.

, .
(. . ), .
, ,
. , ,
, ,
. ,
.

68

I.


, ,
.
. ,
.
Dialog Editor (
), .
Dialog Editor . 3.11 ( ).

. 3 . 1 1 . Dialog Editor

(Test Dialog ( ), <Ctrl+T>) Dialog Editor ( ),


, , ,
. .
, , , , <Esc>.


. : Align Lefts
( ), Align Rights ( ), Align
Tops ( ) Align Bottoms (
). , ,
.
, <Shift> <Ctrl>, . .

.
: Vertical Horizontal ( ). ,
&.


. Across Down (

3.

69

). , ,
.
i
i .
Make Same Width, Make Same Height Make Same Size
( ,
). ,
, ,
, .

, Toggle Grid ( )
,
.
Toggle Guides ( ) ,

.



, . , ,

,
Visual C++.
CDiaiogDlg.
.
. ,
, ,
( , . .).

:
1.


ControlEvents ( )
Properties (). ,
.

I.

70

2. CBNCLOSEUP .
OnCbnCloseupCombo, . 3.12. .
.

IDC_COMBO (Combo-box Tontrol) :Combcc-lio>

CBN_D6LJi.K

<Add> OnCbnCo
l seupCombo

CBNJ3ROPDOWN '
CB('J_EDITCHANGE
: CBN_EDITUPDATE
: CBN.ERRSPACE
]
CBN.KILLFOCUS
'. XBN SELCHANGE
:CBN_CLOSEUP

i Indicates list box of combo box has closed


. 3 . 1 2 . P r o p e r t i e s

3. . 2 CBN_EDITCHANGE.
OnCbnEditchangeCombo.
4.
ControlEvents ( ) Properties
(). , .
5. . 2 UDNDELTAPOS. OnDeltaposSpin.
, :
1. View | Class View ( | ) <Ctrl>+<Shift>+<C>. Class View ( ). - ,
Resource View ( ),
.
2. Dialog ( ), , CDialogDlg.
3. Add | Add Variable
( | ). Add Member
Variable Wizard - Dialog ( ), . 3.I3.

3.

71

JAdd Member Variable Wizard^iialeg^;"f " '^^^^


Welcome to the Add Member Variable Wizard
This wizard adds a member variable to your class, struct, or union.
Access:
Variable type:
J
Variable name:
I

I-

I
Comment (// notation not required):
I

I
J

Finish

Cancel

H
pel|

. 3.13. Add Member Variable Wizard - Dialog


4. Control variable ( ,
). Control ID
( ) Control type (
).
5. Control ID ( ) IDC_EDIT_BOX.
6. Category () Value
(), Variable type ( ) UINT, Variable name
( ) m_Edit Finish (). Add Member Variable Wizard ( ) .
7. .. 5 6 IDCBUDDY,
m_Buddy.
8. .. 5 6 IDCCOMBO,
m_Combo.
c s t r i n g ,
Variable type ( ) .

72

I.

9. .. 5 6 IDCSAVE,
' mSave.
BOOL, Variable type ( ) .
10. .. 5 6 ID_EDIT_SWITCH,
mSwitch. Variable type ( ) BOOL, int.
. .
11. CDiaiogDig. Class View - Dialog ( )
, . 3.14.

Dialog
Global Functions and Variables
s Macros and Constants
* CAboutDIg
* CDa
io
l gApp
*J Bases and Interfaces
Maps
i
tf> _unnamed_8c976fbf_l
!
CDa
io
l gDg
l (CWnd *pParent = 0)
;
<^> DoDataExchange(CDataExchange *pDX)
i
OnCbnCloseupCorribo(void)
OnCbnEditchangeCombo(void)
OnDetlaposSpn
i (NMHDR *pNMHDR, LRESULT *pRe
<J> OnlnitDialog(void)
OnPaint(void)
<Jt OnQueryDraglcon(void)
<j* OnSysCommand(UINT nID, LPARAM IParam)
11 m_Buddy
t> m_Combo
i m_Edit
y^ 1 m_hlcon
?" m_5ave
p m_Switch

. 3.14. Class View - Dialog


. 3.14, CDiaiogDig .
, , .
.
3.2.

3.
I 3.2.
// DialogDlg.h
//
#pragma once
// CDialogDlg
class CDialogDlg : public CDialog
\
II
public:
CDialogDlg(CWnd* pParent = NULL); //
//
enum ( IDD = IDD_DIALOG_DIALOG } ;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV
//
protected:
HICON mjhlcon;
//
virtual BOOL OnlnitDialog0 ;
afxjnsg void OnSysCommand(UINT nID, LPARAM lParam);
afxjnsg void OnPaint();
afx_msg HCURSOR OnQueryDraglconf) ;
DECLARE_MESSAGE_ MAP ()
public:
afxjnsg void OnCbnCloseupCombo() ;
afxjnsg void OnCbnEditchangeCombo();
afxjnsg void OnDeltaposSpin(NMHDR *pNMHDR, LRESULT *pResult);
UINT m_Edit;
UINT m_Buddy;
CString m_Comt)o;
BOOL mjSave;
int mjSwitch;
\

73_
:

I.
3.2, , , Properties (), .
, .

. , , , .
.
DialogDlg.cpp , About,
. 3.3 ,
. , MFC Class Wizard, .
| 3.3.
II " CDialogDlg
CDialogDlg::CDialogDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDialogDlg::IDD, pParent)
, m_Edit(0)
, m_Buddy(0)
, m_Combo(_T("") )
, m_Save(FALSE)
, m_Switch(0)
{
m_hlcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME) ;

void CDialogDlg::DoDataExchange(CDataExchange* pDX)


{
CDialog::DoDataExchange(pDX);
DDXJText(pDX, IDC_EDIT_BOX, m_Edit);
DDX__Text (pDX, IDC_BUDDY, m_Buddy) ;
DDX_CBString(pDX, IDC_COMBO, m_Combo);
DDX__Check (pDX, IDC_SAVE, m_Save) ;
DDX_Radio(pDX, IDC_EDIT_SWITCH, m_Switch);

3.
BEGIN_MESSAGE_MAP(CDialogDlg, C D i a l o g )
ON_WM_SYSCOMMAND ()
ON_WM__PAINT ()
ON_WM_QUERYDRAGICON()
//)}AFX_MSG_MAP
ON_CBN_CLOSEUP(IDC_COMBO, OnCbnCloseupCombo)
ON_CBN_EDITCHANGE(IDCJ3OMBO, OnCbnEditchangeCombo)
ON_NOTIFY(UDN_DELTAPOS,

IDC_SPIN, OnDeltaposSpin)

END_MESSAGE_MAP()

// CDialogDlg
BOOL CDialogDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// "About..." .
// IDM_ABOUTBOX '
// .
ASSERT((IDM_ABOUTBOX & OxFFFO) = IDM_ABOUTBOX) ;
ASSERT(IDM^ABOUTBOX < OxFOOO);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString StrAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!StrAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF STRING, IDM_ABOUTBOX, strAboutMenu);

// .
// ,
//
Setlcon(m_hlcon, TRUE);
Setlcon(m hlcon, FALSE);

//
//

75

76

I.

II
return TRUE;

// TRUE,
//

}
void CDialogDlg::OnSysCommand(UINT nID, LPARAM lParam)
if ((nID & OxFFFO) == IDM_ABOUTBOX)
CAboutDlg dlgAbout;
dlgAbout.DoModal();
else
CDialog::OnSysCommand(nID, lParam);
}

//
//
//
//

,
.
, /,
.

void CDialogDlg::OnPaint()
if (IsIconicO)
CPaintDC dc(this);

//

SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()) , 0) ;
//
int cxlcon = GetSystemMetrics(SM_CXICON);
int cylcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(srect) ;
int x = (rect.Width() - cxlcon + 1 ) / 2;
int = (rect.Height() - cylcon + 1 ) / 2 ;

3.

77

//
dc.DrawIcon(, , m hlcon);
else

CDialog::OnPaint

();

// ,
// .
HCURSOR CDialogDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hlcon);

void CDialogDlg::OnCbnCloseupCombo(void)
//
}
void CDialogDlg::OnCbnEditchangeCombo(void)
//

void CDialogDlg::OnDeltaposSpin(NMHDR *pNMHDR, LRESULT *pResult)


NM_UPDOWN* pNMUpDown = (NMJJPDOWN*)pNMHDR;
//
*pResult = 0;

.
3.3, .
.

3.4.

78

I.

\ 3.4.

CDialogDlg::CDialogDlg(CWnd* pParent /*=NULL*/)


: CDialog(CDialogDlg::IDD, pParent)
, m_Edit(64)
, m_Buddy(32)

;
J

, m_Combo(_T("1024"))
, m_Save(TRUE)
, m_Switch(0)
{
m_hlcon = AfxGetAppO ->LoadIcon(IDR_MAINFRAME) ;
}
.
3.5.

; 3.5.
//
void CDialogDlg::OnCbnCloseupCombo(void)
{
UpdateData();

//

if( m_Save )
//
if( m_Switch ) //
SetDlgltemText( IDC_BUDDY, m_Combo );
else //
SetDlgltemText( IDC_EDIT_BOX, m_Combo );
UpdateData;

//

}
//
//
void CDialogDlg::OnCbnEditchangeCombo(void)
{
UpdateData();
//

3.

79

if ( m_Save )
//
if( m_Switch ) //
SetDlgltemText { IDC_BUDDY, m_Comk>o );
else //
SetDlgltemText ( IDC_EDIT_BOX, m__Combo ) ;
UpdateData();

//

//
void CDialogDlg::OnDeltaposSpin(NMHDR *pNMHDR, LRESULT *pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
pNMUpDown-> iDelta = -pNMUpDown-> iDelta;
*pResult = 0;

'

, Debug |
Start ( | ) <F5>. -
Microsoft Development Environment, . 3.15.
, , .

I Microsoft Developments
These project configuration(s) are out of date;
Dialog - Debug Win32
Would you like to build them?
Yes

No

Cancel

Help

. 3.15.
Microsoft Development Environment
Yes (). , . 3.16.
. 3.16, ,
, .
TRUE m s a v e ?.
mSwitch
( ). ,
mcombo, -

I.

80

. mBuddy , , m E d i t
.



ff
^~

W ?

. 3.16.
.
.
, , . .
, . 256.
. , 16.
16, 256, . . .
,
,
. . , Windows :
. , , ,

3.

81

. ,
. , , , .
.
.
oncbncioseupcombb,
, OnCbnEditchangeCombo,
, . cwnd: :UpdateData, , ,
CWnd: : DoDataExchange, -

. , ?
.
cwnd: :SetDigitemText.
,
updateData.


OnCbnCloseupCombo OnCbnEditchangeCombo . , , .
OnCbnEditchangeCombo ,
OnCbnCloseupCombo .

?. , , .

. 256 100.
, , , 0 100. c s p i n B u t t o n c t r l SetRange.

OnDeitaposSpin.
. , MFC ,
,
, Microsoft,
Word, . .

82

I.


Microsoft , , , Next ()
Back (). , ,
Visual C++.


,
, Sheet ,
.
,
:
1. Sheet,
, 1.
2. View | Class View ( | ) <Ctrl>+<Shift>+<C>. Class View ( ). .
3. Sheet Add | Add Class ( | ).
Add Class - Sheet ( ),
. 3.17.
4. Templates () MFC Class ( MFC)
Open (). MFC Class Wizard - Sheet ( MFC), . 3.18.
5. Base class: ( ) cpropertyPage, Class name ( )
cpagei Finish ().
6. .. 35 2 .
7. .. 34, Base class (
) cpropertysheet, Class
name ( ) csheet Finish ().
, . 3.19, ,
Sheet.h , .
8. Yes (), .
, , Sheet.cpp
, .

3.

83

Add Class-Sheet
Categories:

Templates:
Add ATL ATL Active ATL Control
Support... Server Pa...

ATLDaiolgAS
TLnap
M
C
AT
nlM
Tran
sLac.tiMS
A
T
Lnsum
O
L
E
BPro
A
T
L
E
D
C
o
e
rD
vd
iLerO
P
eB
ro
frmA
aT
nLc.
i Add an MFC class.

Cancel

Open

He
pl

. 3.17. Add Class - Sheet

MFC Class Wizard - Sheet


Welcome to the MFC Class Wizard
This wizard adds a class that inherits from MFC to your project. Options may change
depending on the base class selected.
Class name:

.DHTML resource ID:

Base class:
|cWnd

.HTM file:
___^
~3

.H file:

Automation:
<*" None
<~ Automation
f~ Creatable by type ID

.CPP file:
f~ Active accessibility.
F_inish

Cancel

. 3.18. MFC Class Wizard - Sheet

belp

84

I.

Sheet.h already exists. Do you want to merge this class into the same file?

. 3.19.
Microsoft Development Environment
9. Yes (), .
10. Resource View ( ) I D D P A G E I .
.
11. ,
, .
12. Properties () Caption ()
Appearance ( )
" 1".
13. Border ()
"Thin" (), Style () "Child"
( ), System menu ( ) "False".
14. Toolbox () Check Box
() .
15. IDCCHECK " ?". , . 3.20.

. 3.20.
16. .. 1015 IDD_PAGE2,
" 2".
17. .. 1015 IDD__PAGE3,
" 3".

3.

85

. SheetApplication:
1. View | Solution Explorer ( | )
<Ctrl>+<Alt>+<L>. Solution Explorer
( ).
.
2. Sheet, Header Files ( ), . 3.21.
.- Microsoft Development Enviroinw!n$ tdesf^l*
FJe
Proe
j ct gulid Qebug Fgrmat jpols Wnidow Hep
l
in

I Debug
g ] .

_'

.I.-1'

'i v. ijp Sheet.rt (IDD_PAGE3 - Dialog) I

V~ ?

31 5obtion 'Sheet' (1 proiect)


- J l Sheet
+
I .Source Files
- _i Headet Files
_ ) Pagel.h
j j Page2 h
_ ] Page3.h
^ Resource.h
J Sheet.h
_ ] SheetDIg h

Properties

Output
Debug

Ready

. 3 . 2 1 . Solution Explorer
3. Sheet.h.
.
4. csheet #pragma once
:
#include "Pagel.h"
#include "Page2.h"
tinclude "Page3.h"

I.

86

5. p u b l i c : csheet
, :

CPagel m_pagel;
CPage2 m_page2;
m_page3;
6. Solution Explorer ( ) Source Files
( )
Sheet.cpp.
7. csheet
:
//
AddPage(&m_pagel);
AddPage(&m_page2);
AddPage(&m_page3);
8. csheetApp: : i n i t i n s t a n c e
CSheetDlg dig; CSheet dig(" ");.
9. <F5> .
Microsoft Development Environment, .
10. Yes ().
, . 3.22.


1 | 2 | 31

"

Cancel

Help

. 3.22.
, ,
.

3.

87


, ,
,
, ,"
,
Next () Back ().

. ,
Sheet.
Sheet , :
1. Sheet.cpp csheetApp: : i n i t i n s t a n c e CSheet dig (" ");
dlg.SetWizardModeO;

2.

Class View ( ),
Sheet.

3.

CPagel Properties ().


Properties ().

4.

Overrides ( )
Properties (). .

5.

OnSetActive.
.

6.

, , OnSetActive, . 3.23.

7.

. .

8.

.. 57 onWizardNext.

9.

.. 38 2,
onwizardBack.

10. .. 38 ,
OnS.etActive OnWizardBack.

11. Pagel.cpp
, 3.6.
4 . 629

I.

88

CPagel VCCodeClass
:: t i ES ^ !*
OnFinalPelease
OnlnitDialog
, OnKilActive
! OnNotify
1 OnOK
I OnQueryCancel
1 OnReset
1

zl

UnSetActlve
, OnWizardBack

i
]
f

^^^^^^^^^^
<Add> OnSetActive

OnSetActive
I Called when the page is made the active page

j
i

. 3.23. Properties

\ 3.6.
//
BOOL CPagel::OnSetActive(void)
{
//
CPropertySheet* parent = (CPropertySheet*) GetParent(),
//
parent-> SetWizardButtons(PSWIZB_NEXT);
return CPropertyPage::OnSetActive();

// Next>
LRESULT CPagel::OnWizardNext(void)
{
//
CButton* checkBox = (CButton*) GetDlgltemf IDC_CHECK );
iff !checkBox->GetCheck() ) //
{
MessageBox(" ");

3.

89

return -1;
}

return CPropertyPage::OnWizardNext() ;
}

12. Page2.cpp , 3.7.


| 3.7.
//
BOOL CPage2::OnSetActive(void)
{
//
CPropertySheet* parent = (CPropertySheet*) GetParent();
//
parent-> SetWizardButtons{ PSWIZB_NEXT |

PSWIZB_BACK);

return CPropertyPage::OnSetActive();

// <Back
LRESULT CPage2::OnWizardBack(void)
{
//
CButton* checkBox = (CButton*) GetDlgItem( IDC_CHECK
iff !checkBox->GetCheck() )
{
MessageBox(" ");
return -1;
}
return CPropertyPage::OnWizardBackf);

// Next>
LRESULT CPage2::OnWizardNext(void)
{
//
CButton* checkBox = (CButton*) GetDlgltemf IDC_CHECK )

00

I.

if( !checkBox->GetCheck() ) //
{
MessageBox(" ");
return -1;

return CPropertyPage::OnWizardNext();

13. Page3.cpp , 3.8.


\ 3.8.

//
BOOL ::OnSetActive(void)
{
//
CPropertySheet* parent = (CPropertySheet*) Get Parent ;
//
parent-> SetWizardButtons(PSWIZB_BACK);
return CPropertyPage::OnSetActive();

// <Back
LRESULT ::OnWizardBack(void)
{
//
CButton* checkBox = (CButton*) GetDlgltemt IDC_CHECK );
if( !checkBox->GetCheck() ) //
{
MessageBox(" ");
return -1;
}
return CPropertyPage::OnWizardBack();

14. . ,
. 3.24.

3.

91

. 3.24. . 1
15. Next (). ,
. 3.25.

. 3.25.
16. , ? Next (). , . 3.26.
( 2

" ?

< flack I

Next > ~ j

Cancel

Help

. 3.26. . 2

I.

92

17. ? Next ().


, . 3.27.

. 3.27. . 3
18. ? Back ().
, . 3.25, .

DoModal S e t W i z a r d M o d e .

, 1
Back (), Next
(), 2 .
CPropertySheet: :SetWizardButtons,
C P r o p e r t y P a g e : :OnSetActive, , . . DoModal. setwizardButtons
. , ,
:
PSWIZB_BACK Back ();
PSWIZB_NEXT Next ();
PSWIZB_FINISH Finish ();
PSWIZB_DISABLEFINISH Finish ().
, PSWIZB_NEXT PSWIZB_FINISH , .
Next () Finish (),
. PSWIZBDISABLEFINISH
PSWIZB FINISH.

3.

93


,
, ,
. , , , ,
Next () ,
.
,
, . , ,
, ,
.
:
1. Resourse View ( ), Sheet.rc.
2. Dialog ( ) IDD_PAGE3. .

3. ?
Properties ().
4.

Caption () " ?".

5. Auto Behavior ()
False (). , .
6.

ControlEvents ( ).
, .

7. BNCLICKED .
onciickedcheck.
8. .
.
9. Class View ( ), Sheet.
10. Properties ().
Properties ().
11. Overrides ( )
Properties (). .
12. OnWizardNext. .

94

I.

13. , , OnWizardNext.
14. . .
15. Pagel.cpp.
.

16. cpagei: :OnwizardNext 3.9.


\ 3.9. Page 1: : OnWizardNext
// Next>
LRESULT CPagel::OnWizardNext(void)
{
//
CSheet*
parent = (CSheet*) GetParent();
//
CButton* checkBox = (CButton*) GetDlgItem( IDC_CHECK );
if( !checkBox->GetCheck() ) //
{
MessageBox(" ");
return -1;

// ,
p a r e n t - > SetActivePage( p a r e n t - > GetPageIndex{ &parent-> m_page3)
r e t u r n CPropertyPage::OnWizardNext();

17.

Page3.cpp.

18.

, 3.10.

I 3.10.
//
BOOL ::OnSetActive(void)
{

CPropertySheet* p a r e n t = (CPropertySheet*) G e t P a r e n t ( ) ;
p a r e n t - > SetWizardButtons(PSWIZB NEXT [ PSWIZB BACK);

3.
return CPropertyPage::OnSetActive();

// ' <
LRESULT ::OnWizardBack(void)
{
//
CSheet*
parent = (CSheet*) GetParent ;
// ,
parent-> SetActivePage( parent-> GetPagelndex ( &parent-> mjpagel) + 1
return CPropertyPage::OnWizardBack() ;

// Finish
void ::OnClickedCheck(void)
{
//
CSheet*
parent = (CSheet*) GetParent ;
//
CButton* checkBox = (CButton*) GetDlgItem( IDC_CHECK
if( !checkBox->GetCheck() ) //
checkBox->SetCheck( 0 );
else
checkBox->SetCheck( 1 ) ;
parent->SetFinishText("Finish") ;

// Next>
LRESULT ::OnWizardNext(void)
{
//
CSheet*
parent = (CSheet*) GetParent ;
// ,
parent-> SetActivePage( parent-> GetPagelndex( &parent-> m_page2) 1 )
return CPropertyPage::OnWizardNext();

95

I.
19. . ,
. 3.24.
, Next ()
3, 2, .
, Next (),
2. 2
. 3 ?, , . 3.28.

. 3.28. ?

CPropertysheet:: setActivePage. ,
, .
. , 0,
, . AddPage. , SetActivePage
onWizardNext onwizardBack,
,
, .

CPropertysheet: :setFinishText.
, Finish ().
,
Back () Next () Finish
() ( , ), , . -

3.

97


?
Back () Next ().
, . , Finish (),
OnWizardFinish, .
OnWizardFinish .
, .
OnSetActive , setwizardButtons. ,
,
Finish () Cancel () ( Help () ).
, .
, Back ()
.
Finish () ,
, , , . Finish ()

, ,
.

, . ,
OnWizardFinish .
.
OnWizardFinish, ,
. . CButton: :Getcheck ( ) CButton: :Setcheck ( ).

II

4.
5.
6.
7.
8.
9.
10.

3 . , ,
. , , .
.

, ,
.
, . . ,
.


List
List, List , .
:
1. , I,
List.
2. Dialog () Resource View ( ).

IDD_LIST_DIALOG
Properties (). Properties ().
3. Language (). .
4. Russian ().
5. Output () .
6. Caption () Properties () " ".

102

II.

7. Caption () Properties
() "".
8.
.
9. Toolbox () List Box
() , ,
.
, . 4.1.
oft Visual C++ [design J - U4
Edti Im Eroe
l ct ft* E>ebug Format Iools fn
i dow Hep
l
iiil - & Q & t, KA ' ' - ' Debug

mm

So, Li.t.rc (IDD JJ..IALOG - Da


io
l g) |
I"

\.

i t x i! Resource Veiw - Ls
it ?
- 33 List
- _J ust.rc*
- _J Da
io
lg
3D
IDA
.BOUTBOX [Engsil
3|D
ID_LS
IT_DA
ILOG
+ ]c
Ion
_ J RT_M^FEST
* _ ] Strug Table
+
J Version

Proportles

JIDCJ.IST (Listbox Control)LIBE J


[77] h [a] -/

i
Group

False

ID
Tabstop

IDC.LIST
True

(Name)

Ready

. 4 . 1 .

10. Toolbox () Static Text


( )
.
11. Caption () Properties () " ".

4.

103

12. Toolbox () Edit Box


( )
.
13. Properties () I D C E D I T .
,
. 4.2.

List - Microsoft Visual C+ + [design} - List.rc (IDO LIST 0


Edit #ew Proe
j ct Bud
li Qebug Farmat lools Wn
idow yelp
jp - _J \F~ H * "
Debug

H -U
[5J.
% Ust.rc (IDD_LI..JALOG - Dialog)* |
i],,,i, ,,,
*J


I I > Resource Ve
iw List

- List
- _|List.rc*
- _J Dialog
3 ] IDD_ABOUTBOX [Engli!
^ IDD_LI5T_DIALOG
+ : ( Icon
+ _J RT .MANIFEST
_J String Table
+ _ J Version

__
Sample edit box

flDC_EDIT (edit Control) IEdBoxEjJ


QT] Si [ a ] -/

Group
ID
Tabstop

Fasl e
IDC_EDIT
True

(Name)

Ready

. 4.2.
14. Toolbox () Button
() .
15. ID ( ) Properties
() IDCADD, Caption
() "&".
16. , .. 14 15,
IDCDELETE "&". , . 4.3.

104

II.

, list - Microsoft Visual C++ [design] - (IDOJLISI'JWWOtf?

Be
l Edti ye
jw Eroe
j ct gud
li P_ebug Format Iools SSn
Idow tjelp
*! J ' t S H S * Ri *" ' ' - < * W." Debug
% Ust.rc (IDD_U..IALOG - Dialog)* |
i I. .
2=1

1 I X ' Resource^ Ve
iw - list _ __ ?.
- _J List.re*
- _] Da
io
lg
J3|D
IDA
.BOUTBOX [Engsil
I
3D
I D_L5
IT_WALOG
j * LJIcon
! A _J RT_MANF
IE5T
;! _| Strug Tabe
l
+ | Versran


j Sample edit box

Properties

iD
I C_DELETE (Button Control)
Group
Fasle
D
I
D
I C_DELETE
Tabstop True
(

E^1 Properties | nJ in help


Ready

," 166, 97*

j l * 14 X50

. 4..

17. Cancel ()
Caption () Properties ()
"".
18. I D C L I S T ControlEvents ( ) Properties (). , .
19.
LBNDBLCLK. .
20. , , OnLbnDbiclkList,
-. 4.4.
21. . , CListDig, -

4.

105

JIDC_LIST (Listbox Control) ILBEditor


QT] a, m [ 7 } LBN_ERRSPACE
LBN_KL
ILFOCUS
LBN_SELCANCEL
LBN_SELCHANGE
LBN_SETFOCUS
NM THEMECHANGED

<Add> OnLbnDblclHist

.LBN_DBLCLK
' Indicates that the user has double-clicked the left mouse
button in the control
. 4.4. Properties
22. ,
ControlEvents ( ) Properties (). , .
23.
BNCLICKED. .
24. , , OnBnciickedAdd.
25. . .
26. .. 2225 .
27. Class View ( ), List.
28. CListDig Add | Add Variable ( |
). Add Member Variable Wizard - List
( ), . 4.5.
29. Control variable ( ). Control ID ( )
Control type ( ) .
30. Control ID ( ) IDC_EDIT.

II.

106

xj

Add Member Variable Wizard - List


Welcome to the Add Member Variable Wizard
This wizard adds a member variable to your class, struct, or union.

Access:

~ Control variable

Variable type:
jbool

Variable name:

C o m m e n t

(//

n o t a t i o n

n o t

r e q u i r e d ) :

"J

"
Fn
isih

Cancel

Hep
l

. 4.5.
31. Category () Value
(), Variable name ( )
m_Edit Finish ().
32. .. 28 29 Control ID
( ) IDC__LIST.
33. Control (), Variable name ( )
m_List Finish ().
34. ListDlg.cpp 4.1.
: 4.1. CListDlg
//
void CListDlg::OnLbnDblclkList()
{

CString Temp;
i f ( m_List.GetCurSel() != LB_ERR )

//

4.

107

II
m_List.GetText (m__List .GetCurSel () , Temp) ;
//
SetDlglteraText(IDC_EDIT, Temp);

// Add
void CListDlg::OnBnClickedAdd()
{

UpdateData();

//
//
m_List.AddString(m Edit); //

// Delete
void CListDlg::OnBnClickedDelete()
{
if( m_List.GetCurSel() != LB_ERR ) //
m_List.DeleteString(m_List.GetCurSel); //
UpdateData();
.
//

35. <F5> . ,
. , . 4.6.
36.

""
. .

37.

""
. .

38. ""
. .
, List Box () Behavior () Properties () Sort
() True (),
.
39. .
"", . 4.7.

II.

108

-XJ

. 4.6.
I-

. 4.7.

40. , .
, ,
. 4.8.

.

4.

109

, , . Visual C++.
.
1

DTOpOH

. 4.8.

OnLbnDbicikList cstring Temp ,


cListBox: :GetText,
. ,
cwnd: :SetDigitemText, Temp
.
, .
onBnciickedAdd :
UpdateData
, CListBox: :Addstring . onBnclickedDelete , cUstBox: :GetCurSel, , ,
. ,

CListBox: :Deietestring, ,
.
,
, CListBox: :Setsel, , -

110

II.

, TRUE, , FALSE, .




Progress, , . :
1.

, 1.
Progress.

2.

Dialog () Resource View ( ).


IDD__PROGRESS_DIALOG
<F4>. Properties ().

3.

Language (). .

4.

Russian ().

5.

Output ( ) .

6.

Caption () Properties () " ".

7.

8.

Cancel ()
Caption () Properties ()
.

9.

10. Toolbox () Progress


( ) . ,
.
. ID ( ) Properties () IDCPROGRESS. , . 4.9.
12. Toolbox () Slider Control ( )
.
13. ID ( ) Properties () I D C S L I D E R .

4.

111

.- Progress - Microsoft Visual C+*ld^dn}~P

file dt Veiw Profcct gud


li Qebug Format Toosl yjyntort telp

^sp - U - ur^ LJ ^ ^'


'"
Debug
^ Progress.rc (I..ALOG - Dialog)* j
*
.1...,
,;,,,,.'

'

'7.7,

' i+ U^T f*

- L

X Resource Veiw - Progress fl1 X


PrP
reiassbg
-ro_g
jD
^D
ID_ABOUTBOX [Engsilh (U.
^|D
ID_PROGRES5_D
A
ILOG
+ |c
Ion
* J RT_MANFIEST
+ j Strn
ig Tabe
l
+ __J Verso
in

Propere
tis

| IDC PROGRESS (Progress Bar

Disabted

False

Help ID

False

Visible

True

()

Ready

El* Propere
tis | Q Dvnak
ri hep
l
;H"J 16,

j j Hx?i2

. 4.9.
14. AutoTicks ( ), entEdge () TickMarks ( )
True ().
15. ,
,
.
, . 4.10.
16. Toolbox () Picture
Control ()
.
17. ID ( ) Properties () IDCPICTURE.
18. Sunken ()
True ().
19. . 4.11.

II.

112

Eile E* tfew Eroiect Build Cebug Farmat Iods fflndow Uep


l
J - J J - i. Ql \

0 3 ' " 4.


- ;.!
Jj Progress.: (I..ALOG - Dialog)" |
i

> Debug

1 t X , Resrarjce Ve
tw - Progress- ^ Jt X
P Progress
- Q Progress.re*
-i _J Daio
lg
^D
IO_ABOUTBOX [Engsilh (U
IDD_PROGRESS_DIALOG
+
]Icon
I _| RT_MANIFE5T
* _ J String Table
+
] Version

3 -

lJU

Properties _
j IDC.SLIDER (Slider Control)

Disabled

False"

Help ID

False

Visible

True

I (Name)

Ready

& Properties | D (i- i "ip

''"I 16,66

j " 29x212

. 4 . 1 0 .

20. Toolbox () Button


()
.
21. ID ( ) Properties () IDC_RESET.
22. Caption ()
"&". ,
. 4.12.
23. , ControlEvents ( ) Properties (). , .
24. BN_CLICKED.
.
25. , , OnBnClickedReset.

4.

113

. Progress - Microsoft Visual C++{design]

Ee
li Edti ye
jw Eroe
i ct Bud
l Psjbug Format Iools Mndow Hep
l
J - ' d ' ^ i i & 95 F ' 1 -'", v ' i Debug
P__l- ' -.. SEE
],
!
|) Progrescrc (I..ALOG - Dialog)* |
*i ; J
T

d*

] t X ;! R
esource Vem - Progress __? ><
" ~ ~(p Progress
'-' _J Progress.re*
J -, _1 Da
io
lg
.
IDD_ABOUTBOX [English (U
iP
3 roD_PRCX3RES5_DIALOG
* _ J Icon
i i *' 1 RT_MANIFEST
]'. _J String
+ ^ j Version

1
I Properties _
jIDC_PICTOREt (Picture Control _,
Disabled
Help ID
Visible

False
False
True

(Name)

! * Properties | 0 : i M p ,

Ready

"I 177lO8

jf* 20x212

. 4 . 1 1 .
26. . .
27. Class View ( )
CProgressDig.
28. Properties () Messages (). , .
29. WM_HSCROLL.
.
30. , , cmHScroii, . 4.13.
31. .
, CProgressDig
.
32. CProgressDig Add | Add Variable ( | -

II.

114

). Add Member Variable Wizard


( ).
**.. Progress - Microsoft Visual C+
File Edti Ve
iw Proe
j ct Bud
li ebug Format Toos
l W
n
idow Hep
l

la]
Sj Progressjc (I..ALOG - Dialog)* |
, r:. ,.7:7,7:7,, ,,.

, .? is

- . Text

[].
;

[ x Resource Ve
i w - Progress
^ X
P Progress
_j
P
r
o
g
r
e
s
s
,
re*
f
" I Dialog
3D
I D_ABOUTBOX [English (U,
3] toD_PROGRE55_DlALOG
+ ] Icon
+ _J RT_MANF
IEST
+ j String Tabe
l
+ j Version

;,..:;

jj

Properties
] 1DC_RESET (Button Control)
QT] 4* -/ '
. Hep
l ID Fas
le
Owner Draw Fas
l*
Vs
ib
ie
l
True

1.4

(Name)

Eg Properties | Q .
T ; 97, 167

Ready

. 4.12.

| CProgressDIg

W M I G E T D L G C O O E

WM_GETMINMA!<INFO

WMJHELPINFO

WM.HSCROLLCLIPBOARD
i

WMJCONIERASEEKGND

';

WMJNITMENU

VCCodeClass

[ < A d d > OnHScroll

WMJNITMEMUPOPUP
WMJCEYDOWN
WM_HSCROLL

i Indicates

a click

in a h o r i z o n t a l

scroll

bar

. 4.13. Properties

i n 14x50

4.

115

33. Control variable ( ). Control ID ( )


Control type ( ) .
34. Control ID ( ) IDC__PROGRESS.
35. Variable name ( )
m_Progress Finish ().
36. .. 3336 I D C S L I D E R ,
m_siider.
37. ProgressDlg.cpp
cprogressDig 4.2.
; 4.2. cprogressDig

// CProgressDlg
BOOL C P r o g r e s s D l g : : O n I n i t D i a l o g ( )
{
CDialog::OnInitDialog();
// " A b o u t . . . " .
// IDM_ABOUTBOX
// .
ASSERT ( (IDM__ABOUTBOX & OxFFFO) == IDM_ABOUTBOX) ;
ASSERT(IDM_ABOUTBOX < OxFOOO);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if

(pSysMenu

!= NULL)

{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!StrAboutMenu.IsEmptyf))
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM__ABOUTBOX, strAboutMenu);

// .
// ,
/ /

.-

116

II.

Setlcon(m_hlcon, TRUE);

//

Setlcon(m_hlcon, FALSE);

//

//
m_Slider.SetRange(O, 1024, TRUE);
m_Slider.SetTicFreq( 128 ) ;
m _ S l i d e r . S e t L i n e S i z e ( 32 ) ;
m_Slider.SetPageSize( 256 );
m_Progress.SetRange(0,
r e t u r n TRUE;

1024);

// TRUE,
/ /

//
void CProgressDlg::OnBnClickedReset()
(
m P r o g r e s s . S e t P o s ( 0 );

//

//
void CProgressDlg:-.OnHScroll (UINT nSBCode, UINT nPos, CScrollBar* p S c r o l l Bar)
{

//
CSliderCtrl* slider = (CSliderCtrl*) pScrollBar;
//
iff m_Progress.GetPos() < slider-> GetPosf) )
m_Progress.SetPos( slider-> GetPosf) ); //
//
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);

38. <F5> .
, . 4.14.
39. , , , . .

4.

117

. 4.14.

. 4.15.

40. . , . 4.15.
41. . .
42. . ,
. 4.16.

118

II.

. 4.16.

43. . .
44. . ,
, , .
,
. <> ,
<End> . <PgUp>
, <PgDn>
, , .
,
oninitDialog,
. c s i i d e r c t r i : :SetRange ,
, , .
c s i i d e r c t r i : :setTicFreq , , ,
. c s i i d e r c t r i : :SetLineSize
. c s i i d e r c t r i : : SetPageSize
<PgUp> <PgDn>. CProgressCtrl: :SetRange c s i i d e r c t r i .

4.

119

. WM_HSCROLL, onHScroii.
, .
10. ,
. ,
:
. . c s c r o i i B a r .
. ,
c s c r o i i B a r c s l i d e r c t r i , , , , c s l i d e r c t r i cwnd,
cscroiiBar, Windows .
c s l i d e r c t r i : :GetPos
.
CProgressctrl. .
( ), C P r o g r e s s c t r l : :SetPos,
, _
(. 10).
onBnciickedReset .
C P r o g r e s s c t r l : :SetPos .



, , ,
, .
Picture Control (). , .
, - "", .

, ,
, . , ,
, . , ,
5 . 629

120

II.

, . ,
, .
, , .
c p r o g r e s s c t r i : : c r e a t e ,
,
. , .
Picture Control ().

.
,
:
1. ProgressDlg.cpp.
2.

CAboutDig

END_MESSAGE_MAP()
CRect

P__Rect;

3.
ProgressDlg.cpp 4.3.

: 4.3. ,
// ,
// .
// , /
// .
void CProgressDlg::OnPaint()

if (Islconic())
{
CPaintDC dc(this); //
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
//
int cxlcon = GetSysterriMetri.es (SM_CXICON) ;
int cylcon = GetSystemMetrics(SM CYICON);

4.

121

CRect r e c t ;
GetClientRect(Srect);
int x = (rect.Width() - cxlcon + 1 ) / 2;

int = (rect.Height() cylcon + 1) / 2;


//
dc.DrawIcon(x, y, m_hlcon);
}
else
{
CDialog::OnPaint();

CClientDC clientDC(this); //
CBrush
brBackf RGB(255, 255, 255) ); //
//
: :GetWindowRect ( : :GetDlgItem( m_hWnd, IDC_PICTURE) , &P_Rect ) ;
ScreenToClient( &P_Rect ) ;
//
P_Rect.left += 2;
P_Rect.right -= 2;
P_Rect.top +-2;
P_Rect.bottom -= 2;
//
clientDC.FillRect( P Rect, SbrBack ) ;

// ,
// .
HCURSOR CProgressDlg::OnQueryDragIcon()
{
return static cast<HCURSOR>( hlcon);

//
void CProgressDlg::OnBnClickedReset(void)
{
m Progress.SetPos( 0 );
//

II.
CClientDC clientDC(this); //
CRgn
pRgn;
//
CBrush
brBack( RGB(255, 255, 255) ); //
//
pRgn.CreateRectRgnlndirect( P_Rect ) ;
clientDC.SelectClipRgnf &pRgn ) ;
clientDC.FillRect( P Rect, sbrBack ) ;

//
void CProgressDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar*
pScrollBar)
{
//
CSliderCtrl* slider = (CSliderCtrl*) pScrollBar;
if( m_Progress.GetPos() < slider-> GetPosO ) //
//
{
CClientDC clientDC(this); //
CRgn
pRgn;
//
CBrush
brDone( RGB(255, 0, 0) ); //
CRect
D__Rect = P_Rect;
//
pRgn.CreateRectRgnlndirect( P_Rect );
clientDC.SelectClipRgn( SpRgn );
//
D__Rect. right = P_Rect.left + (int) (P_Rect.Width!) *slider->
GetPos())/slider->GetRangeMax();
clientDC.FillRect( D_Rect, sbrDone );
//
m_Progress.SetPos( slider-> GetPos ) ;

CDialog::OnHScroll(nSBCode, nPos, pScrollBar);

4.

123

4. <F5> .
, . 4.17.

. 4.17.

5. .
, . 4.18.
Windows. 6.
Picture Control () .
,
.
,
.
,

, .
onPaint.
, Windows . WMPAINT. -

//.

124

,
CDialog: :OnPaint, . GetwindowRect,
.
GetDigitem,
,
cwnd, .

HillI l l l l l l l l

1
1
i

S i S S i !

OK ~ ]

. 4.18.

GetwindowRect ,
cwnd: :ScreenToClient,
. POINT RECT.
.
, Properties ()
Sunken (). , , .
.
, .

onPaint

CDC: : F i i i R e c t , , -

4.

125

, RECT, , , CBrush.
.

( ).
onBnciickedReset, , .
,
OnPaint, .
, CRgn.
. CRgn: : CreateRectRgnlndirect CRgn.

CDC: :SelectciipRgn,
, ,
, .
, .
onHScroii CRect , .
.
, , ,
,
. , ,
,
, .
onDraw ,
OnHScroii.

OnPaint . ,
OnPaint.


Windows . DateTime,

126

II.

, . :
1. , 1, DateTime.
2. Dialog () Resource View ( ) IDD_DATETIME_DIALOG <F4>. Properties ().
3. Language (). .
4. Russian ().
5. Output ( ) 200x300.
6. ,
Caption () Properties () "".
7. Caption () Properties
() "", ID
( )
IDC_CAPTION.
8.
, .
9. Cancel () .
10. Cancel () Caption
() Properties () "".
11. Toolbox () Date Time
Picker ( ) .
, . 4.19.
12. ID ( )

Properties
()

IDC_DATETIMEPICKER.

13. Toolbox () Static Text


( )
.
14. Caption () Properties () "".
15. Toolbox () Month Calendar Control ( )
.

4.

127

" . . DateTime - Microsoft Visual C++[design] -


Fjle

Edit

Slew

Eroject

guild

ebuo

. j p - J - E ^ H I l f i i U G ^

E3iS
uj DateTime.rc (I...ALOG - Dialog)* |

Format

Iools

J f f j x .
Window

Help

Miug

Text

|5].
R e s o u r c e View - DateTime

|p DateTime

i |

i , , ,

, , , i

_ J DateTime r e *
-

_ | Dialo
3

I D D . A B O U T B O X [English (U

^ |
+

IDD_DATETIME_DIALOG

| Icon

^ J RT_MANIFEST

_ J S t r i n g Table

j Version

Properties
I IDC_CAPTION1 ( T e x t Control)

Align T e x t

Left

Border

False

Caption

Center Image

False

Appearance

Ready

. 4.19.
16. Properties ()
IDC_MONTHCALENDAR ClientEdge
() True ().
, . 4.20.
17. Toolbox () Button
()
.
18. ID ( ) Properties () IDCDATETIME,
Caption () "".
19. .. 17 18,
IDCSELECT "".
, . 4.21.
20. Date Time
Picker ( ) Control Events (
) Properties (). , .

128

II.

.. OateTkne - Microsoft visual C + + * ; (

Be Edti Ve
iw Erolect Bud
li B<*ug Format lools Vn
ildow Hep
l
szj DateTime.rc (I...ALOG - Dialog)" I
i
ill

2
9
16
23

3
10
17
24

30 SfflS

1 5
11
12
18
19
25
26

6
13
20
27

7
14
21
28

15
22
29

> Resource Ve
iw - DateTm
ie
^
i p DateTime
,- | DateTm
i e.re*
- _J Da
io
lg
jj|D
I DA
.BOUTBOX [Engsilh (U,
3] D
I D_DATETM
I E_DA
ILOG
f j Icon
+ j RT_MANF
IEST
_] String Tabe
l
+ ] Vesi o
in

|IDC_MONTHCALEr4DAR(Calend __

** -t '

Vsib
ie
l True
Group

False
I OMTHCALENDAR -rl"

ID
Specifies the identifier of the control.
- I -

J L L

_J Jjj~~ 1^* Properte


i s | Oi i it t -h

Ready

. 4 . 2 0 .

21. DTN_DATETIMECHANGE.
.
22. . .
23. .. 2022 Month Calendar Control
( ),
MCN_SELECT.

24. .. 2022 , BNCLICKED.


25. .. 2022 , BN_CLICKED.
26. Class View ( ),
DateTime.
27. CDateTimeDig Add | Add Variable ( | ). Add Member Variable Wizard
( ).

4.

129

. DateTime - Microsoft Visual C++ [design! - Date

Bte Edti ^e
i w Project, guild Qebug Far mat lools i^indcn > Hep
l
4p

[ ' Ds' !P

^ --"*)

i
C4i sTi
' i j ' DateTime.rc (I...ALOG - Dialog)* j
^

' *

'

*- &ebug
[a].
. x

} IT .1 I ! . . I . . . . I . ! . . ) . . . . I ., I . I , .

Resource View - DateTime


4 ^
p DateTime
) DateTime re*
- _ ] Dialog
3 IDD_ABOU1EOX [English (U
*3| IDD_DATETIME_DIALOG
-i _ J Iran
1- _ J RT_MANIFE5T

I 5tnng Table
+ ] Version


9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 26 29

I IDC_5ELECT (Button Control)

Visible

I!

True

Group
False
ID"_5FLECT

2}"1

ID
- 5penh*s the identifier of the contiol.

___)

jj"
"'

Ready

" Frupeitie^ 1 Q ' i


13, 130

ii

j " 14x50

. 4 . 2 1 .
28. Variable type ( )
booi, Variable name ( ) mbTime Finish (). .
29. .. 27 28 m b s e i e c t .
30. .. 27 28 m_Time, CTime.
31. CDateTimeDig Add | Add Variable ( | ). Add Member Variable Wizard
( ).
32. Control variable ( ),
Control ID (
) IDC_DATETIMEPICKER.
33. , Variable name ( ) -

130

II.
m_DateTime Finish (). .

34. .. 3133
IDC_MONTHCALENDAR m_Month.
35.

DateTimeDlg.cpp
4.4.

i 4.4.
// Date Time Picker
void CDateTimeDlg::OnDtnDatetimechangeDatetimepicker(NMHDR *pNMHDR, LRESULT
*pResult)
{
LPNMDATETIMECHANGE pDTChange = reinterpret_cast<LPNMDATETIMECHANGE>(pNMHDR);
m_DateTime.GetTime( m_Time ); //
//
if ( !m_bTime ) //
m_Month.SetCurSel( m_Time );
' *pResult = 0;

//
void CDateTimeDlg::OnMcnSelectMonthcalendar(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMSELCHANGE pSelChange = reinterpret_cast<LPNMSELCHANGE>(pNMHDR);
m_Month.GetCurSel( m_Time );

//
//

if(

!m_bTime )

//

m_DateTime.SetTime( &m_Time );

//

*pResult = 0;

//
void CDateTimeDlg::OnBnClickedDatetime()
{
if( m_bTime )

//

4.

737

//
SetDlgltemText( IDC_DATETIME, "" );
SetDlgltemText( IDC_CAPTION, "" );
m_DateTime.SetFormat( _T("dd-MM-yyyy") );
m_bTime = false;
else
//
SetDlgltemText( IDC_DATETIME, "" );
SetDlgltemText( IDC_CAPTION, "" ) ;
m_DateTime.SetFormat( _T("H-mm-ss") );
m_bTime = true;
}
//
void CDateTimeDlg::OnBnClickedSelect()
if( m_bSelect )

//

//
SetDlgltemText( IDC_SELECT, "" );
m_Month.ModifyStyle(MCS_NOTODAYCIRCLE,MCS_NOTODAY);
m_bSelect = false;
else
//
SetDlgltemText( IDC_SELECT, "" );
m_Month.ModifyStyle(MCS_NOTODAY,MCS_NOTODAYCIRCLE);
m bSelect = true;

36. <F5> .
, . 4.22.

II.

132

37. . ,
. 4.23.

|>

31.03.2001

5
12
19
26

6
13
20
27

7
14
21
28

2001 .

1
8
15
22
29

2
9
16
23
30


4
3
10 11
17 18
24 25 '
':

. 4.22.

>-

ill

j 31.03.2001
I I

:s
5
12
19
26

6
13
20
27

7
14
21
28

1
8
15
22
29

2
9
16
23
30


3
4
10 11
17 18
24 25

6
13
20
27

7
14
21
28

"
5
12
19
26

J>I

2001 .

1 <

2001 .

1
8
15
22
29

2
9
16
23
30


3
4
10 11
17 18
24 25

"

2D 31. 03.2001

. 4.23.

4.

133

38. . .
39. .
, . , , . 4.24.
MV

14.03.2001

1<

t 1

2001 .

5
12
19
26

6
7
13
20 21
27 28

1
8
15
22
29

2
9
16
23
30

Be
4
3
10 11
17 18
24 25
31

: 31. 03.2001

[ j|

. 4 . 2 4 .
IA-

17-38-59

2 .

5
12
19
26


1
2
8

6
7
13 4 15 16
20 21 22 23
27 28 29 30

3
10
17
24
31

8
4
11
18
25

: 31.03.2001

:|

. 4 . 2 5 .

134

II.

40. .
.
41. . ,
,
. 4.25.
42. . , , . 40.
43. . .
,
, .
CDateTimeDlg::OnDatetimechangeDatetimepicker

Date Time Picker ( ).
(,
) . CDateTimeCtrl: :GetTime.
CTime.
CDateTimeDlg, . , CMonthCaictr: :SetCurSei
.
CDateTimeDlg: :OnSelectMonthcalendar
.

CMonthCaictr: :GetCurSel. , .
CDateTimeCtrl : : SetTime.

CDateTimeDlg: : OnClickedSelect -

. , , .
cwnd: :SetDlgitemText,
, , , .
cwnd: :ModifyStyle. ,
, ,

4.

135

, ,
SetwindowPos. ,
SetwindowPos.

m b s e l e c t , .

CDateTimeDlg: : OnClickedDatetime,
. .
, , cwnd: :SetDlgitemText . CDateTimeCtrl::SetFormat.


"
". . Windows DOS.
- , , DOS
. Windows . , . , ,
.

Windows
MFC. , ,
, .


. .
.

#define. , , Resource.h,
.
. Windows WM_,
Windows (Windows Message).
, . , , ( ).

5.

137

, . ,

, . .
MFC
, WM_KEYDOWN, WM_MOUSEMOVE , ,
.
, .
Windows (Message
Loop), winMain.
MFC ,
.

while, GetMessage, . , , ,
PostThreadMessage.
. , . , WMQUIT,
. .
1,

, .
, ,
TransiateMessage.
. GetMessage PeekMessage.
,
.
, ,
DispatchMessage, ,
, .
( switch), . , ,
MFC .

138

II.


(Message Map)
MFC .
,
MFC,
. ,
Visual C++ : .
, ccmdTarget,
. ,
, . ,

DECLARE_MESSAGE_MAP, . ,

BEGIN_MESSAGE_MAP, , ,
.
END_MESSAGE_MAP, .

Visual C++ 5.0 6.0. 7.0
. Visual C++ 7.0
, MFC Application Wizard. , Properties (), (public).
5.1 , ,
4.
; 5.1.
// DialogDlg.h

#pragma once
// CDialogDlg
class CDialogDlg : public CDi.alog
{
//

5.

139

public:

CDialogDlg(CWnd* pParent = NULL); //


//
enum ( IDD = IDD_DIALOGJDIALOG } ;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV
//
protected:
HICON m_hlcon;
//
virtual BOOL OnlnitDialog () ;
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDraglcon() ;
DECLARE_MESSAGE_MAP ()
public:
afx_msg void OnCbnCloseupCombo();
afx_msg void OnCbnEditchangeCombo();
afx_msg void OnDeltaposSpin(NMHDR *pNMHDR, LRESULT *pResult);
UINT m_Edit;
UINT m_Buddy;
CString m_Combo;
BOOL m_Save;
int m_Switch;

(public) .
. 5.2 , 5.1.
5.2. ,
BEGIN_MESSAGEJ4AP (CDialogDlg, CDialog)
ON_WM_SYSCOMMAND ()
ON WM PAINT()

140

II.

ON_WM_QUERYDRAGICON()
//} }AFX__MSG_MAP
ON_CBN__CLOSEUP (IDC_COMBO, OnCbnCloseupCombo)
ON_CBN_EDITCHANGE(IDC_COMBO, OnCbnEditchangeCombo)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN, OnDeltaposSpin)
END_MESSAGE_MAP ()
,
.
, :
ONCOMMAND ,
WM_COMMAND, . ,
, , ;
ON_COMMAND_RANGE ON_COMMAND, , . , , ,
,
. , ,
,
;
ON_UPDATE_COMMAND_UI ,
. , . ,
, , ;
ON_UPDATE_COMMAND_UI_RANGE
ON_UPDATE_COMMAND_UI, , . , ON_COMMAND_RANGE,
;
ONCONTROL .
. ON_CONTROL.
,
, , ;
ON CONTROL RANGE
, , PAINT.

5.

141

,
ONCONTROL, , ;
ONMESSAGE .
WM_USER
0x7 FFF , Windows WMMESSAGE.
ONMESSAGE. , ,
, .

Windows 3.x
Windows 3.x , ,
. .
WM_COMMAND,
(, B N P A I N T ) , ,
wParam ,
, lParam .
,
.
. ,
BN_CLICKED .

Windows 3.x ,

WM_CTLCOLOR,

WM_VSCROLL,

WM_HSCROLL,

WM_DRAWITEM,

WM_MEASUREITEM, WM_COMPAREITEM, WM_DELETEITEM, WM_CHARTOITEM, WM_VKEYTOITEM


. , .

Win32
, Windows 3.1, Win32 API . Win32 ,
Windows 3.x.
.
, ,
WM_*, Win32 API , WMNOTIFY, .

142

II.

NOTIFY , , wparam lParam. NMHDR, ,


NMHDR. NMHDR
, ,
iparam , NMHDR.
NMHDR , . ( )
TTN SHOW TTN POP.
NMHDR.
NMHDR ,
, (, SHOW).
:
typedef s t r u c t

tagNMHDR

HWND hwndFrom;
UINT i d F r o m ;
UINT code;
} NMHDR;

TTN SHOW code


TTN__SHOW.

,
NMHDR, , LVNKEYDOWN
. , LV_KEYDOWN, :
typedef struct tagLV_KEYDOWN
{
NMHDR hdr;
WORD wVKey;
UINT flags;
} LV_KEYDOWN;

,
Windows
,
Windows. , -

5.

143

NMHDR.
:
NM_CLICK ,
;
NM__DBLCLK ,
;
NM RCLICK ,
;
NM_ RDBLCLK ,
;
NM_RETURN , <Return>,
;
NMSETFOCUS ,
;
NM_KILLFOCUS ,
;
NM_ OUTOFMEMORY , .


cwnd: :OnNotify.
. . .
Visual C++ ON NOTIFY , . ON_NOTIFY
, ,
, LVN_KEYDOWN, , ,
.
:
afx_msg void memberFxn(NMHDR ^pNMHDR, LRESULT,*pResult)
:
memberFxn ;
PNMHDR , ;
pResult , .

144

II.

, , onDeitaposSpin UDN_DELTAPOS, cspinButtonctri I D C S P I N , :


ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN, OnDeitaposSpin)
:
void CDialogDlg::OnDeitaposSpin(NMHDR *pNMHDR, LRESULT *pResult)
{
NM_UPDOWN* pNMUpDown = (NMJJPDOWN*) pNMHDR;
// TODO: Add your control notification handler code here
*pResult = 0;
}
, . NM_UPDOWN
pNMUpDown, P'NMHDR .
:
void memberFxn(UINT id, NMHDR * pNMHDR, LRESULT *pResult)
, ,
, ON_NOTIFY
( ON_NOTIFY_RANGE) ON_NOTIFY_EX ( ON_NOTIFY_EX_RANGE). -

,
BOOL, , .
FALSE, TO
.
ON_NOTIFY_EX ON_NOTIFY_EX_RANGE -

,
.
, , :
ON_NOTIFY_EX(nCode, id, memberFxn)
ON_NOTIFY_EX_RANGE(wNotifyCode, id, idLast, memberFxn)

. :
BOOL memberFxn(UINT id, NMHDR * pNotifyStruct, LRESULT * result);
id ,
.

5.

145

TRUE, , FALSE,
.


MFC 4.O. , . , WMCTLCOLOR ,
.
Windows MFC , 4.0,
, , . , , . ,
, , .
, .
MFC 4.0
, . , , ,
(message reflection), ,
.
WM_CTLCOLOR , - .
, , , , MFC, Windows, ,
, cwnd.
MFC ,
(WM_DRAWITEM
). . , ,
,
MFC.

146

II.


,
, .
WM_NOTIFY
. , , ,

ON__NOTIFY_REFLECT.
ON_NOTIFY_REFLECT_EX, ,
. ,
, TRUE, TO
,
FALSE, TO

.
WMNOTIFY,
. ,
.
, ,
.
, ,
: REFLECT.
, WMNOTIFY
ON NOTIFY,
ON_NOTIFY_REFLECT.
.
Visual C + + , .



, , . ,

5.

147

MFC, .

, , :

, ON_ _REFLECT. , WM__CTLCOLOR ON_WM_CTLCOLOR_REFLECT.
, , .
:
WM_COMMAND ON_CONTROL REFLECT;

NOTIFY ON_NOTIFY_REFLECT;


ONJJPDATECOMMANDJJI
ON_UPDATE COMMAND UI_REFLECT.


, on .
, c t i c o i o r
Oncticolor. ,
.
, .
. 5.1 .
5.1.

ON_CONTROL REFLECT(wNotifyCode,
memberFxn)


afx_msg v o i d memberFxn

();

ON_NOTIFY_REFLECT(wNotifyCode,
memberFxn)

afx rasg v o i d memberFxn (NMHDR *


p N o t i f y S t r u c t , LRESOLT* r e s u l t ) ;

ON_UPDATE_COMMAND_UI_REFLECT
(memberFxn)

afx msg v o i d memberFxn


pCmdUI);

ON_WM_CTLCOLOR REFLECT()

afx msg HBRUSH C t l C o l o r


UINT n C t l C o l o r ) ;

ON_WM_DRAWITEM_REFLECT()

afx_msg v o i d Drawltem
(LPDRAWITEMSTRUCT l p D r a w I t e m S t r u c t ) ;

ON_WM_MEASUREITEM REFLECT()

afx_msg v o i d M e a s u r e l t e m
(LPMEASUREITEMSTRUCT
lpMeasureltemStruct);

(CCmdUI*
(CDC* pDC,

II.

148

5. 1

()

ON_WM_DELETEITEM_REFLECT{)

afx_msg void Deleteltem


(LPDELETEITEMSTRUCT
lpDeleteltemStruct);

ON_WM_COMPAREITEM_REFLECT()

afx_msg int Compareltem


(LPCOMPAREITEMSTRUCT
lpCompareltemStruct);

ON_WM_CHARTOITEM_REFLECT()

afx__rasg int CharToItem (UINT nKey,


UINT nlndex);

ON_WM_VKEYTOITEM_REFLECT()

afx__msg int VKeyToItem (UINT nKey,


UINT nlndex);

ON_WM_HSCROLL_REFLECT()

afx_msg void HScroll (UINT nSBCode,


UINT nPos);

ON_WM_VSCROLL_REFLECT()

afx_msg void VScroll (UINT nSBCode,


UINT nPos);

ON WM PARENTNOTIFY REFLECT))

afx_msg void ParentNotify (UINT


message, LPARAM lParam);

ON_NOTIFY_REFLECT ON_CONTROL_REFLECT

( ). . 5.2.
.
5.2.

ON_NOTIFY_RE FLECT_EX
(wNotifyCode, memberFxn)

afx_jnsg BOOL memberFxn (NMHDR *


p N o t i f y S t r u c t , LRESULT* r e s u l t )

ON_CONTROL_RE FLECT_EX
(wNotifyCode, memberFxn)

afx_msg BOOL memberFxn () ;


,
, Microsoft . ,
.
, , , ,

. , -

5.

149

.
, ,
.
, Microsoft
, ,
Visual C++ , . 3

. ,
.
Dialog (. 3):
1. File | Open Solution ( | ).
Open Solution ( ), . 5.1.

______
' 1 Vsiual Srudra Proe
j cts
JJJ
jBrushi
1 RcihApp
_ll Consoel
ISDI
History
_LD
l ateTm
ie
1 Sheet
_!JDDB
_]lTe>ct
111 Daio
lg
ZlTool
' ZjDIB
HV
iSMacros
My Proe
j cts ZjEditApp
H
i ep
l
ZiLine
-U
IList
Desktop ZJMDI
_1 Mutli
2J Prn
it
_.
" 1 Progress
Favorties _ll Refe
l ct

lopen Solution
Lookjn:

File name: j
Fe
li s of type: |Solution Fe
li s

tii fU

- o[s-

d
zl

!
Cancel

. 5 . 1 . Open Solution

2. Dialog
Dialog. Visual C++ Dialog.
3. Class View ( ),
Dialog () Add | Add Class ( | ). Add Class - Dialog ( ), . 5.2.

II.

150

2<J

Add Class - Dialog;


Templates;

Categories;

Add ATL
Support .,.

ATL Dialog

ATL Active ATL Control


Server Pa.,,

ATL MMC
Snapln

ATL M5
Transact!,..

ATL OLEDB ATL OLEDB


ATL
Consumer
Provider Performanc,,
; Add ATI support to an MFC project.
Help

Cancel

Open

. 5 . 2 . Add Class - Dialog

4. Templates () MFC Class ( MFC)


Open (). MFC Class Wizard - Dialog
( MFC), . 5.3.
I MFC Class Wizard - Dialog
Welcome to the MFC Class Wizard
This wizard adds a class that inherits from MFC to your project. Options may change
dependn
i g on the base class selected,
Ca
l ss name:

.DHTML resource ID:

Base class:

H
.TM file:

Automato
in:
_J f None
.H file:

Automation
' ,,,\

(~ Creatable by type ID

,CPP file:

I
* Active accessibility.

Finish

Cancel

. 5 . . MFC Class Wizard - Dialog

Hep
l

5.

151

5. Class name ( )
Myspinctrl, c s p i n B u t t o n c t r i Finish ().
.
6. Class View ( ) Dialog ()
Myspinctrl.
7.
(). Properties ().

Properties

8. Properties () Messages (). , .


(=)
, . 5.4.

[MySpinCtrl VCCodeClass

=NM_OUTOFMEMORY
=NM_RELEASEDCAPTURE
: =NM_THEMECHAMGED
; =UDN_DELTAPO5
;
=WM..CTLCOLOR
. =WH_PARENTNOTIFY
' WM_ACTIVATE
;
WM.ACTCVATEAP.P
MySpinCtrl

jd

. 5 . 4 .

9. =UDN_DELTAPOS.
.
10. . , MySpinCtrl. .
11. onDeitapos 5.3.
| 5.3. O n D e i t a p o s

/7
void MySpinCtrl::OnDeitapos(NMHDR *pNMHDR,

LRESULT *pResult)

LPNMUPDOWN pNMUpDown = r e i n t e r p r e t cast<LPNMUPDOWN>(pNMHDR);


6 . 629

152

II.

pNMUpDown-> i D e l t a = -pNMUpDown-> i D e l t a ;
*pResult = 0;

12. Class View ( ) CDiaiogDig


Events () Properties (). , .
13. I D C S P I N UDN_DELTAPOS.
.
14. <Delete> OnDeltaposSpin.
. (
.)
15. Class View ( )
CDiaiogDig
Add | Add Variable ( | ).
Add Member Variable Wizard - Dialog (
), . 5.5.

Add Member Variable Wizard - Dialog


Welcome to the Add Member Variable Wizard
This wizard adds a member variable to your class, structj or union.

Access:
Variable type:

Variable name:

,.

.1

Comment (// notation not required):

Finish

. 5.5.

Cancel

Help

5.

153

16. Control variable ( )



IDC_SPIN.

17. Variable type ( ) MySpinctri, Variable


name ( ) m s p i n Finish
(). .
18. <F5> . .
, UDNDELTAPOS. ,
coiaiogDig. , .
: , , .
, , ,
, .


, cwinApp,
Run.
cwinThread: : Run, ,
GetMessage, TranslateMessage DispatchMessage.
cwnd AfxWndProc,
wndProc, .
WndProc , , MFC
(handle map), . cwnd, .
windowProc. ,
cwnd, , .
windowProc, , C++ onWndMessage,
, , . -

154

II.

: ,
. ,
.
, , . C++, ,
, .
MFC ,
. , File | Open ( | )
MFC S e r i a l i z e . .



. , , . , .

Properties
, , Properties (). Properties (
, ), View | Properties Window ( | ), <F4> , .
, . 5.6,
Properties ().
Properties (), . 5.7, ,
.
, . 5.7, Categorized (
), , Properties
(), . Alphabetic (), ,

5.

155

Categorized ( ), , .

Fle
i Edti Veiw Proe
j ct u
fid
li ueoug lools Wnidow Hep
l
%J Da
io
l gDIg h |

ii

i i

- .31 Dialog
blobal Functions end Variables
Macros and Constants
"f CAboutDIg
* J CDiaiogApp

I m r i 1 h"

* Go To Definition
* browse Definition
^ O_uc
i kFn
i d Symbol
t

Propei tie J
j MySpir

TDialogDlg(CWnd* p P a r e n t = NULL;

u< f I I I

1 I IL

(1 L

Sort By lype
Sort By Access

I a
(Namt)

Output

<

Debug

' d l l
1 rl

dll

Ho

syiibols

loaded

f ni

Group By Type
Properties

*-j

->j.e~

C++

H Outputl ^ ' ' 1 ^

' \ - \,

. 5 . 6 . Properties

[MySpinCti-l VCCodeClas^

QT] % -/ ^
MySpinCtrl

C++

. 5 . 7 . Properties

II.

156

Event ()
(ControlEvents) ( ) Messages ().
ControlEvents ( ) , . ,
(. 5.8).

IDC_EDIT_BOX (Edit Control) IEdBoxEditor

*1
zl

ENZ
jHAMGE
EN_ERRSPACE
EN_HSCROLL
EN_KL
ILFOCUS
EN_MAXTEXT
EN_SETFOCUS
ENJJPDATE
EN_VSCROLL
. NM JHEMECHANGED.
CDialogDIg

. 5.8. ControlEvents
,
, . . . Properties () , . 5.9.

IDC_EDIT_BOX (Edit Control) IEdBoxEdtior


,' EN_CHANGE
I EN ERRSPACE
EN_KILLFOCU5
<Add> OnEnHscroE
l dtiBox
EN_MAXTEXT
EN_SETFOCUS
ENJJPDATE
EN_VSCROLL
..NM JHEMECHAbG
l ED
EN_HSCROLL
Indicates the user clicked the scroll bar

...A

. 5.9.

5.

157

.
.
, .
Properties
() , ,
, . 5.10.

| IDC_EDIT_BOX (Edit Control) IEdBoxEditor

.-
' EfJ ALIGN LTR EC
! EN_ALIGN_RTL_EC
1 EN_CHANGE
! EN_ERRSPACE
1 iMil l i i . l i ! ' ! OnEnHscrollEditBox
1 EN KILLFOCUS
<Delete> OnEnHscrollEditBox
! EN.MAXTEXT
<EditCode>
L EbLSEieQOJS.
!EN HSCROLL
Indicates the user clicked the scroll bar

-r _ J

. 5.10.
, <Delete>.
.
,
.
Events () (. 5.11) Properties ()
, Class View (
)
.
Properties ()
, . , ,
ControlEvents ( ), .
.

II.

158

.
, .
Messages ()
Properties ().
. 5.12.

[cDialogDIg VCCodeCa
l ss

~ ~ -

ill

:: ti 1 V

IC>C_bUDDl

(Object)

; IDCjIOMEO

(Object)

[ IOC_EDIT_BOX

(Object)

\ IOC_SPIN

(Object)

| IDCANCEL

(Object)

IDOK

(Object)

1 (Name)
i Sets/returns the name of the object.

. 5 . 1 1 . Events

[CDialogDIg wrcodeClass

QU Si -/ *

: WM ACTIVATE
: WM ACTV
I ATEAPP
; WM_ASKCBFORMATNA
WM CANCELMODE
i WM_CAPTURECHANGEI
WM CHANGECECHAN
I
WM CHAMGEUS
I TATE
WM CHAP
CDialogDIg

. 5 . 1 2 . M e s s a g e s

Messages () ControlEvents ( ).

5.

159


Windows 1000 . ,

.
, , ,
CListBox LB_SETSEL,
.
, , , . . 5.3 ,
.
5.3.

CBN

CDM

CDN

CPL

DM

, Visual C + + , , .


, , . WM_COMMAND,
, , . Windows 3.x WM_COMMAND
, . Win32
WM_COMMAND ,

160

II.

WM NOTIFY
.
. ,
. ,
.
, , . .

,
. .
, ,
, ,
.
(, ),
.
MFC
.
, .

. , .
, ON_UPDATE_COMMAND_UI,
. , ,
, .

, .
,
, , ,
.
ON_UPDATE_COMMAND_UI,
,
ON_COMMAND
. , .
, ,
.

5.

161

afx_msg void OnUpdateMyControl (CCmdUl* pCmdUI);


ccmdui. . 5.4.
5.4. ccmdui

Enable

SetCheck

SetRadio

SetText

ContinueRouting



,
MFC,
. ,
.
:
;
;
;
.
,
,
Windows (GDI),
.

(GDI)
, MS DOS,
, .
, , MS DOS,
,
, .
Windows . ,
Windows (Graphic Device Interface GDI) Windows, a
.
Windows, ,
, , ,
, ,
. -

6.

163

, Windows
. , ,
.
, , ,
: .
,
, , 24- , ,
2400x1200 .
, ,
, .

, Windows ,
, ,
. , , , ,

,
.


,
Windows , . ,
,
, , ,
, .
Windows , Windows API, , .

Windows.
, .

164

II.

CPaintoc
Windows.

CWnd: :BeginPaint, CWnd: :EndPaint.


cview: :OnDraw
cview: :OnPrepareDC CDC.
.
c c i i e n t o c , . cwnd: :Getoc,
cwnd: :ReleaseDC.
OnDraw, .
, . cciientDC.
cwindowDC , ,
. CMetaFiieoc , . cpaintDC, OnDraw,
onPrepareDC .
, OnDraw,
. OnDraw
:
;

,
.
- , ,
.
. ,
, , CDocument: :UpdateAliviews, , cview,
, . , . updateAilviews
LPARAM .
cobject, .
, , CDocument: : SetModif iedFlag. UpdateAllViews -

6.

165

,
, . cview: :OnUpdate, , .
,
Windows WMPAINT. cwnd: :OnPaint,
cpaintoc onDraw
. OnPaint.
OnDraw .
void CMyView::OnDraw(CDC* pDC)
{
CMyDoc* pDoc = GetDocument();
CString s = pDoc-> szDemoString;
CRect rect;
GetClientRect(&rect);
pDC->SetTextAlign(TA_BASELINE I TA_CENTER);.
pDC->TextOut(rect.right / 2, rect.bottom / 2, s, s.GetLength());
}
, . , ,
szDemoString.
.
, CDC
cPaintDC,
BeginPaint.
.


, ,
Windows, Win32 .
,
Win32
.

166

II.

, . , ,
, .

, ,
, .
. , , "Sanserif.
. Win32
(
):
thin ( );
extralight ( );
light ();
normal ();
medium ();
semibold ();
bold ();
extrabold ( );
heavy ( ).
: roman (
), oblique () italic (). roman . oblique .
roman. italic .
.
g
. . 0,013837 . ,
, 1/72 .
(font family) , .
. .
.
Decorative . , Old English.
Dontcare . , -

6.

167

. .
Modern ,
. , , , ,
Pica, Elite Courier New.
Roman . Times New Roman.
Script , .
Script Cursive.
Swiss .
Arial.
WinGdi.h
FF_DECORATIVE, FF_DONTCARE, FF_MODERN, FF_ROMAN, FF_SCRIPT
F F S W I S S . , .
Win32
: , , TrueType, .

. , , . , . TrueType
, .
TrueType . , .
. TrueType , Postscript .
,
, , . , ,
,
.
, TrueType . TrueType
. ,

168

II.

,
.

TrueType

,
. , ,
.
: , , , .
fon. TrueType
: , . fot, ttf.
.
, , .
.
ASCII, , % ,
32 127. :

Windows;

Unicode;

OEM;

Symbol;

.
Win32 Windows.
ANSI.
Windows .
0x20 ( 32). Windows OxFF ( 255).
. , ,
, . , Windows,
(.). TrueType .

. , Windows, .
Microsoft Windows 3.1 Windows 24 , , , , .

6.

169

Windows
8 , , ,
, 256.
, , , ,
. , .
,
8-, 16-, 24- 32- . ,
,
.
Unicode, 16- . 65 536 , , , ,
, ,
. Unicode
,
.
OEM , MS-DOS. 32 127 , ASCII, Windows. OEM ( 0 31 128 255)
,
MS-DOS. Windows.
Symbol ,
.
, , Windows
OEM.
- (EBCDIC).
,
Windows .
.
. , ,
Win32.
,
, EnumFontFamilies ChooseFont.

EnumFontFamilies,
,

170

II.

, ,
, ,
EnumFontFamiiies.
, .
chooseFont Font (),
. 6.1.
. , (,
), (,
). CHOOSEFONT.

-ont style:
Regular

Font:
Arial Black
'1 Arial Cyr
Atial Narrow
1? Bookman Old Style
0 Comic Sans MS
Courier
Effects

sSBHHH
talic
Bold
Bold Italic

20

zl

Sample

" Strikeout

Cancel

Underline

Color:

I Black

Script:
| Cyrillic

This is an OpenType font. This same font will be used on both your
prinlei and your screen.
. 6 . 1 . Font

,
AddFontResource, , . fon,
fnt, ttf fot.
TrueType , .

( ttf). , (
fot). , createScaiabieFontResource
. , -

6.

171

.
,
. , ,
AddFontResource .
, , RemoveFontResource. ,
AddFontResource.

, , , sendMessage WM_FONTCHANGE .
,
, .
Font ()
, chooseFont LOGFONT .
,
, .
. CreateFont CreateFontlndirect.
C r e a t e F o n t l n d i r e c t ,
CreateFont , C r e a t e F o n t l n d i r e c t LOGFONT.

, ,
, ,
. ,
, . , , .
s e i e c t o b j e c t .
,
.
SetMapperFiags
,
.
.

. , ,
, , . -

/ 72

II.

,
. TrueType .
. ,
. ,
,
.

. ,
.
. ( ) . , ,
. ,
,
.

GetOutlineTextM<=trics otmfsType,
OUTLINETEXTMETRIC,
. 1 otmfsType ,
. . 2, .
GetFontData,
.
,
dwTable dwOffset 0L, cbData 1L.
,
,
.
,
. otmpStyleName otmFamilyName,
OUTLINETEXTMETRIC.

,
. . , , " "
, .

6.

173



Win32. ,
, ,
.
Win32 API ,

. :
( )
. , , . .


:
;
;
.

:
SetBkColor,
SetBkMode,
SetTextAlign,
SetTextCharacterExtra,.SetTextColor SetTextJustification.

, , , . ,
,
: GetBkColor, GetBkMode, GetTextAlign,
GetTextCharacterExtra, GetTextColor GetTextExtentPoint32.

SetTextAlign ,
. ,
, . . ,
, .
, , .
.


GetTextAlign.

SetTextCharacterExtra
-

174

II.

. .


GetTextCharacterExtra.
GetTextExtentPoint32 S e t T e x t J u s t i f i c a t i o n
.
. GetTextExtentPomt32
.
s e t T e x t J u s t i f i c a t i o n ,
.
,
, setTextcoior.
, ,
setBkCoior,
SetBkMode.

, . .
GetTextCoior.

GetBkColor GetBkMode.
. . ,
.
GetCharWidth32 GetCharWidthFloat
. ,
. Getcharwidth32
.
, GetCharWidthFloat, .
GetcharABCWidths GetCha'rABCWidthsFloat . GetcharABCWidthsFioat ,
GetcharABCWidths TrueType .
,
.

6.

175

,
.
: GetTextExtentPoint32
GetTabbedTextExtent. ,
GetTextExtentPoint32.
GetTabbedTextExtent.
, Win32 API GetTextExtentExPoint,
, .
, .
.
GetTextMetrics, tmAscent
t m D e s c e n t , TEXTMETRIC.


. TrueType

" "g" .
TrueType
GetOutlineTextMetrics otmMacAscent
o t m M a c D e s c e n t , OUTLINETEXTMETRIC.

TrueType GetOutlineTextMetrics.
GetTextMetrics.
GetDeviceCaps, , .
,
,
3040% , . ,
. ,

.

176

II.

, .
. DrawText TabbedTextout Windows Manager USER.DLL,
GDI GDI.DLL.

, , , .

ExtTextout TextOut.
ExtTextout, ExtTextout
.
. ,
DrawText. , , TabbedTextOut.


Text, , .
:
1. Windows , 1, Text.
2. Class View ( ), Text.
3. CTextview Properties ().
Properties ().
4. Properties () Messages (). , .
5. WM_LBUTTONDOWN OnLButtonDown.
6. CTextview
OnLButtonDown.
TextView.cpp,
.
7. OnLButtonDown 6.1.

6.
\ 6.1. CTextView: : OnLButtonDown
//
void CTextView::OnLButtonDown(UINT nFlags, CPoint point)
{
CClientDC clientDC(this);
LOGFONT logFont;
CFont
font;
CString Out;
// LOGFONT
logFont.IfHeight
= 12;
logFont.lfWidth
= 0;
logFont.IfEscapement
= 0;
logFont.IfOrientation = 0;
logFont.lfWeight
= FW_NORMAL;
logFont.IfItalic
= 0;
logFont.lfUnderline
= 0;
logFont.IfStrikeout
= 0;
logFont.IfCharSet
= ANSI_CHARSET;
logFont.IfOutPrecision = OUT_DEFAULT_PRECIS;
logFont.IfClipPrecision = CLIP_DEFAULT_PRECIS;
logFont.IfQuality
= PROOF_QUALITY;
logFont.IfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;
strcpy(logFont.IfFaceName, "MS Sans Serif");
//
sprintf(Out.GetBuffer(16),"[%d,%d]", point.x, point.y);
//
Out.ReleaseBuffer();
//
font.CreateFontlndirect(slogFont);
//
CFont* oldFont = clientDC.SelectObject(Sfont);
//
clientDC.TextOut(point.x, point., Out);

177
I

II.

178

II
clientDC.SelectObject(oldFont);
CView::OnLButtonDown(nFlags, p o i n t ) ;

8. <F5> .
.
9. .
, . 6.2.
UrText-Textl
File Edit Ve
i w Wn
i dow Help

[15.10]

[134.18]

[274.26]
[291,73]

[156,73]

[26,78]

[386,40]

[410,121]
[47,138]
[65,194]

[188,142]

[312.147]
[419,1821

[208,208]

[329,207]

Ready
. 6 . 2 . Text

onLButtonDown.
, , .


. ,
, CDC: :Selectobject, -

6.

179

oldFont. ,
CDC: :TextOut, , , .

.


. . , , ,
OnDraw,
.
, , , .
Text:
1. Class View ( )
CTextDoc Go
Definition ( ).
TextAppDoc.h.
2. CTextDoc // A t t r i b u t e s p u b l i c : :
CUIntArray ;
CUIntArray aY;
3. TextView.cpp onLButtonDown c s t r i n g :
CTextDoc* lpDoc = GetDocument();
//
lpDoc-> aX.Add(point.x);
lpDoc-> aY.Add(point.);
4. OnDraw 6.2.
| 6.2. C T e x t V i e w : : OnDraw

// CTextView
void CTextView::OnDraw(CDC* pDC)
{

//
/ /

180

II.

CTextDoc* pDoc = GetDocument();


ASSERT_VALID(pDoc);
LOGFONT logFont;
CFont
font;
CString Out;
// LOGFONT
logFont.IfHeight
= 12;
logFont.IfWidth
= 0;
logFont.IfEscapement
= 0;
logFont.ifOrientation = 0;
logFont.ifWeight
= FW_N0RMAL;
logFont.IfItalic
= 0;
logFont.IfUnderline
= 0;
logFont.IfStrikeout
= 0;
logFont.ifCharSet
= ANSI_CHARSET;
logFont.lfOutPrecision - OUT_DEFAULT_PRECIS;
logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
logFont.IfQuality
= PROOF_QUALITY;
logFont.IfPitchAndFamily - VARIABLE_PITCH I EF_ROMAN;
strcpy(logFont.IfFaceName, "MS Sans Serif"!;
//
font.CreateFontlndirect(slogFont) ;
//
CFont* oldFont = pDC-> SelectObject(bfont);
//
for(int i=0; i < pDoc-> aX.GetSize(); i++){
sprintf (Out.GetBuffer (16) , " [%d, 'id] ", pDoc-> aX[i], pDoc-> aY[i]);
Out.ReleaseBuffer();
pDC-> TextOut(pDoc-> aX[i], pDoc-> aY[i], Out);

//
pDC-> SelectObject(SoldFont) ;
}
5. <F5> .

6.

181

, . OnLButtOnDown OnDraw
, ,
OnDraw .


,
,
LOGFONT. : ,
. Line, ,
. :
1. Windows , 1, Line.
2. Class View ( ), Line.
3. CLineView Properties ().
Properties ().
4. Properties () Messages (). , .
5. WM_LBUTTONDOWN OnLButtonDown.
6.

WM_LBUTTONUP,

WM_RBUTTONDOWN,

WM_RBUTTONDBLCLK WM_MOUSEMOVE.
7. Class View ( )
CLineView Go
Definition ( ).
LineView.h.
8. CLineView DECLARE_MESSAGE_MAPO
:
CClientDC* lpDC;
CPen*
lpPen;
CPen*
oldPen;
int
nWidth;
bool

isDown;

182

II.

9. Class View ( ) CLineView


. LineView.cpp,
CLineView.
10.

6.3.

| 6.3. CLineView
// CLineView
CLineView::CLineView()
{

'

ipDC - NULL;
lpPen = MULL;
oldPen = NULL;
nWidth = 1;
isDown = false;

11.

6.4.

; 6.4. CLineView
// CLineView
//
void CLineView::OnLButtonDown(UINT nFlags, CPoint point)
{
IpDC = new CClientDC(this); //
//
lpPen = new CPen(PS_SOLID, nWidth, RGB(0,0,0));
//
oldPen = lpDC-> SelectObject(lpPen);
isDown = true;
lpDC-> MoveTo(point.x, point.y); //
CView::OnLButtonDown(nFlags, point);

6.

183

II
void CLineView::OnLButtonUp(OINT nFlags, CPoint point)
(
lpDC-> SelectObject(oldPen);' //
delete ipPen; //
delete lpDC;
//
isDown = false;
CView::OnLButtonUp(nFlags, point);

//
void CLineView::OnRButtonDown(UINT nFlags, CPoint point)
{
nWidth++;
CView::OnRButtonDown(nFlags, p o i n t ) ;

//
void CLineView::OnRButtonDblClk(UINT nFlags, CPoint point)
{
if(nWidth > 2)
nWidth -= 2;
else
nWidth = 1;
CView::OnRButtonDblClk(nFlags, point);

//
void CLineView::OnMouseMove(UINT nFlags, CPoint point)
{
if(isDown)
lpDC->LineTo(point.x, point.y);
CView::OnMouseMove(nFlags, point);

12.

<F5> .
.

13. , , . , .
7 . 629

184

II.

14. , .
.
15. .
. . 6.3.

File Edit Ve
i w Wn
i dow Help
P'Linel

Ready
. 6 . . Line


onLButtonDown, , .
,
. , ,
, .
onMouseMove, ,
, -

6.

185

,
.
onLButtonup, . ,
, .
onRButtonDown,
.

onRButtonDblcik.
, OnRButtonDown. , ,
, , , ,
, ,
. - , , .
.
, ,
,
,
:
.
,
OnRButtonDown, ,
OnRButtonDblcik, .
. , .


, . , (pattern)
.

186

II.


Brush, ,
. :
1. Windows , 1, Brush.
2. Class View ( ),
Brush.
3. CBrushview Properties ().
Properties ().
4. Properties () Messages (). , .
5. WM_LBUTTONDOWN OnLButtonDown.
6.

. 5 WM_RBUTTONDOWN.

7. Class View ( )
CBrushview
Go To Definition ( ). Brush View. h.
8. CBrushview DECLARE_MESSAGE_MAPO
:
int

nBrushStyle;

9. Class View ( ) CBrushview


. BrushView.cpp, CBrushview.
10. .
// CBrushview
CBrushview::CBrushview()
{

nBrushStyle

= 0;

11.
6.5.
: 6.5. CBrushview
// CBrushview
//
void CBrushview::OnLButtonDown(UINT nFlags, CPoint point)

6.

187

CClientDC dc(this);
CBrush* lpBrush;
CPen

//

pen(PS_SOLID, 0, RGB(0,0,255));

//

//
CPen*

oldPen = dc.SelectObject(spen);

//
if(nBrushStyle)
lpBrush = new CBrush(nBrushStyle - 1, RGB(0,0,0));
else
lpBrush = new CBrush(RGB(255,0,0));
//
CBrush*

oldBrush = dc.SelectObject(lpBrush);

//
dc.Rectangle(point.x, point.y, point.x + 40, point. + 40);
dc.SelectObject(oldBrush) ;
dc.SelectObject(oldPen);
//
delete

lpBrush;

CView::OnLButtonDown(nFlags, point);
}
//
void CBrushAppView::OnRButtonDown(UINT nFlags, CPoint point)
{
nBrushStyle++;
nBrushStyle

%= 7;

CView. :OnRButtonDown (nFlags, point) ;

12. <F5> .
.
13.
. ,
, . 6.4.

II.

188
Brush-Brushl
File Edit View Window Help
P Brush 1

Ready
. 6.4. Brush

onLButtonDown, . , . , ,
. ,
.
.
,
. ,
. ,
, .
.
onRButtonDown, .

6.

189



.
,
, ,
- .

. 3
,
, . .

cdialog, . Brush
.
:
I. File | Open Solution ( | ). Open Solution ( ),
. 6.5.

Solution
Look in:

History

Desktop

|_| Visual f ti

ttJ

, 1 ' Tools -

' I Brush
' I Console
I Dialog
JLl Line
_JList
_|MDI
Mil
I Progress
JjSDI
_ll Sheet
ijText
_U VSMscros

Favorites
File name:
Files of type: I Solution Files

. 6 . 5 . Open Solution

190

II.

2. Brush ()
Brush (). .
3. Resourse View ( ), Dialog )
Insert Dialog ( ).
, .
4. Resourse View ( ) Dialog (),
IDDDIALOGI
<F4>. Properties ().
5. ID ( ) Properties ()
IDD_BRUSH_DIALOG.
6. Language () Russian () (
).
7.
Caption () Properties ()
" ".
8. Output ( ) .
9. Toolbox () Group Box
( ),
.
10. Caption () Properties () " ".
11. Toolbox () Radio Button () .
12. Caption () Properties () " ".
13. Group (), Misc
( ) Properties (), True ().
14. .. 11 12 ,
: "", "", ", ", ", ", " " " ".
. , . 6.6.
15.
Add Class ( ).
Add Class - Brush ( ), . 6.7.

6.

191

,. Brush - Microsoft Visual C++ [design] -

Fjle dit Veiw Project Build Debug Format lools Wn


idow Hepl
,lp-_l*[>:Hl3lct*:
<P~ > Debug
"3

-i, -i-

d r

X i I Resource View - Brush

Brush.rc (IDD_B...IALOG - Dialog)]

"

- .31 Brush
_
) Brush re
!
+ ^_j Accelerator
- _ J Dialog
IDD_ABOUTBOX [Enc
3 IDD_8RU5H_DIALOG
_ J Icon
* _)Menu
_ J String Table
* _ J Toolbar

'

:*> OnEnHscroEditBox

*"" ,
,

I IDC RADIQ7 (Radio-button Co J^

; |

Left Text False


Modal Frame False
MuMn
ie
False
Notify
False
Push Lite False
(Name)

Ready

. 6.6.
I Add Class - Brush
lemplates:

Categories:

Snapln

Iransacti,,, ^1

ATL OLEDB ATL OLEDB ATL


Consumer Provider Performanc...
ATL Property ATL Sm
i pe
l Generic Class
Page
Object

j Add an MFC class.

MFC Class MFC Ca


l ss MFC ODBC j j
Open

Cancel

. 6.7. Add Class - Brush

Help

II.

192

16. Templates () MFC Class (


MFC) Open (). MFC
Class Wizard ( MFC), . 6.8.

MFC Class Wizard - Bmm


Welcome to the MFC Class Wizard
This wizard adds a class that inherits from MFC to your project. Options may change
depending on the base class selected.
DHTML resource ID:
HTM file;
Automation:
& None
Automation

C (Treatable by type ID

" Active accessibility

Finish

Cancel

Help

. 6.8. MFC Class Wizard - Brush


17. Class name ( ) CBrushDiaiog.
18. Base class ( ) CDialog.
19. Dialog ID
( ) IDD_BRUSH_DIALOG ( ).
20. BrushDialog.cpp
Finish (). MFC Class Wizard - Brush (
MFC) .
21. Class View ( ), Brush.
22. CBrushDiaiog Add | Add Variable ( | ). Add Member Variable Wizard - Brush
( ), . 6.9.

6.

193

Add Member Variable Wizd - Brush


Welcome to the Add Member Variable Wizard
This wizard adds a member variable to your class, struct, or union.

Access:
" Control variable

Variable type:

fbooi
Variable name:

Comment (// notation not required);

J
Fn
is
ih

Cancel

Hep
l

. 6 . 9 . Add Member Variable Wizard - Brush

23. Control variable ( ).


24. Control ID
( )
IDC_RADI01.

25. Category () Value


().
26. Variable type ( ) i n t .
27. Variable name ( )
m nBrush Finish ().
28. BrushView.cpp
ttinclude "BrushView.h" #include "BrushDialog.h".
29. OnRButtonDown 6.6.
j 6.6. CBrushView: :OnRButtonDown
//
void CBrushView::OnRButtonDown(UINT nFlags, CPoint p o i n t )

II.

194
//

nBrushStyle++;

//

nBrushStyle

%= 7;

CBrushDiaiog

dig;

dlg.m_nBrush

= nBrushStyle;

//
//

//
if (dlg.DoModaK) == IDOK)
nBrushStyle

= dlg.m_nBrush;

CView::OnRButtonDown(nFlags, p o i n t ) ;

30. .
31. . , . 6.10.


OK

Cancel

I <f
| <"*
| f"*
i

f ,

| <" ,
i *
(*

. 6.10.
32.
. .
33. .
, .
34. .. 3133 .
OnRButtonDown CBrushDiaiog.
mnBrush -

6.

195

nBrushstyle CDialog: :DoModai,


onRButtonDown .
,
nBrushstyle
m_nBrush.

m_nBrusn nBrushstyle ,
.
.


. ,
. , , , .
- (device-independent bitmaps DIB). bmp
, .
- (device-dependent bitmap DDB).

, Windows .

-
- , , .
-
.

.
. , , . , , - .
, .
- DDB,

196

II.

, .
:
1. DDB , 1. .
2. Class View ( ) DDB.
3. CDDBView Add | Add Variable ( | ). Add Member Variable Wizard
( ).
4. Variable Type ( )
CRect, Variable name ( )
m_Rect Finish ().
5. .. 3 4 was__copied,
booi.
6. CDDBView Properties ().
7. Properties () Messages
(). ,
CDDBView.

8. WM_LBUTTONDBLCLK.
9. CDDBView Go To Definition (
).
DDBView.h.
10. booi was_copied;
BYTE m_Buffer[327 68];
11. Class View ( ) CDDBView,

onLButtonDbicik
Go To Definition ( ). DDBView.cpp, .
12. OnLButtonDbicik 6.7.
| 6.7. CDDBView: :OnLButtonDbicik
// CDDBView
//
void CDDBView::OnLButtonDbicik(UINT nFlags, CPoint point)

6.

197

CClientDC pDC(this); //
CDC
memDC;
//
CBitmap m_Bitmap;
//
int

wd = m_Rect. Width () >> 2;

//
m_Bitmap.CreateCompatibleBitmap(&pDC, wd, m_Rect.Height());
memDC.CreateCompatibleDC(&pDC) ;
//
CBitmap* oldBitmap = memDC.SelectObject(&m_Bitmap);
if(m_Rect.PtlnRect(point)) //
{
int nRect = (point.x m_Rect.left)/wd;
memDC.BitBltIO, 0, wd, 40, SpDC, m_Rect.left + nRect*wd, 10, SRCCOPY);
m_Bitmap.GetBitmapBits(327 68, m Buffer);
was_copied = true;
}
else //
{
CRect rect;
GetClientRect(rect);
if(was_copied && (point.x < (rect.right wd)) && (point. <
(rect.bottom - 40))){
m_Bitmap.SetBitmapBits(32768, m_Buffer);
pDC.BitBlt ( p o i n t . x , p o i n t . y , wd, 40, memDC, 0, 0, SRCCOPY);

//
memDC.SelectObject(SoldBitmap);
CView::OnLButtonDblClk(nFlags, point);

13. OnDraw 6.8.


I 6.8. CDDBView: : OnDraw

// CDDBView
void CDDBView::OnDraw(CDC* pDC)

198

II.

//
//
CDDBDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//
CRect rect;
GetClientRect(rect);
if((rect.Width() > 24) && (rect.Height() > 80)) //
{"
//
m_Rect = CRect(10, 10, rect.right - 10, 50);
int wd = m_Rect.Width() 2;
rect = m_Rect;
rect.right = rect.left + wd;
pDC->FillRect(rect, &CBrush(RGB(0, 0, 0)));
rect.left = rect.right;
rect.right += wd;
pDC->FillRect(rect, SCBrush(RGB(255, 0, 0)));
rect.left = rect.right;
rect.right += wd;
pDC->FillRect(rect, SCBrush(RGB(0, 255, 0) ) ) ;
rect.left = rect.right;
rect.right += wd;
pDC->FillRect(rect, &CBrush(RGB(0, 0, 255)));
}
was_copied = false;

14. <F5> . , . 6.11.

6.

199

Ble Edit., e
i w Wn
idow Hep
l

KBdUy
. 6 . 1 1 .

15.
, .
. .
16. .
. 6.12.
17. .
- , (
).
,
OnDraw. , , ,
cwnd: :GetciientRect, , cwnd,
, .
-

II.

200

, .

m_Rect. , wd, .
CDC: : F i i i R e c t , .
onDraw , , was_copied FALSE, , , ,
.
UVDDB-DDBI
File Edit Ve
i w Wn
i dow Help
PDDBI

Ready
. 6.12.

O n L B u t t o n D b l C l k . CDC C B i t m a p .

memoc, CDC, , , .
.

CBitmap

CBitmap: : C r e a t e C o m p a t i b l e B i t m a p , -

6.

201

, , . ,

CDC

CDC: :CreateCompatibieDC, , .
CBitmap. CBitmap .
CDC::SelectObject.

,
.
CRect: :PtinRect. , ,
CDC: :BitBit . .
. . ,
.
, .
CBitmap: :GetBitmapBits,
CBitmap , . .
,
, , ,
. ,
.
, .
was_copied TRUE, ,
.
, CWnd: :GetClientRect
:
. , , .

202

II.

CBitmap: : SetBitmapBits,
,
. CDC: :BltBit, .
, ,
,
, .
, . , , ,
CDDBView
, m_Buffer .
Microsoft
. Visual C++ 6.0 Add Member Variable
( ) . , Visual C++ 7.0
.

-
, - ,
, ,
.- , .
. - .
- .
,
.
-
D1B,
, .
:
1. DI , 1. .
2. Class View ( ) DIB.
3. CDDBView Add | Add Variable ( |
). Add Member Variable Wizard (
).

6.

203

4. Variable Type ( )
BITMAPINFO*, Variable name ( )
m i n f o Finish ().
5. Class View ( ) CDiBView,

Go To Definition ( ).
DIBView.cpp, CDiBView.
6.

CDiBView 6.9.

! 6.9. CDiBView
// CDiBView
CDiBView::CDiBView()
{
// BITMAPINFO
m_Info
= (BITMAPINFO*) new char[ sizeof(BITMAPINFOHEADER) +
(sizeof(RGBQUAD) 8) ];
//
m_Info-> bmiHeader.biSize
= sizeof(BITMAPINFOHEADER);
m_Info-> bmiHeader.biWidth
= 4;
m_Info-> bmiHeader.biHeight
=0;
m_Info-> bmiHeader.biPlanes
= 1;
m_Info-> bmiHeader.biBitCount
= 8;
m_Info-> bmiHeader.biCompression = BI_RGB;
m_Info->
m_Info->
m_Info->
m_Info->

bmiHeader.biSizelmage
=
bmiHeader.biXPelsPerMeter
bmiHeader.biYPelsPerMeter
bmiHeader.biClrUsed

m_Info-> bmiHeader.biClrlmportant

0;
= 0;
= 0;
= 0;
= 0;

//
for(int i=0; i < 256; i++)
{
m_Info-> bmiColors[i].rgbBlue
= (BYTE) i;
m_Info-> bmiColors[i].rgbGreen = (BYTE) i;
m_Info-> bmiColors[i].rgbRed
= (BYTE) i;

204

II.
m_Info-> bmiColors[i].rgbReserved = 0;

}
CDIBView::-CDIBView()
delete m_Info;
}
7. OnDraw 6.10.
j 6.10. CDIBView: :OnDraw
// CDIBView
void CDIBView::OnDraw(CDC* pDC)
{
//
//
CDIBDoc* pDoc = GetDocument ;
ASSERT_VALID(pDoc);
int i, k, q;
CRect Draw__Rect;
//
GetClientRect(Draw_Rect);
// BITMAPINFO
int Rect_Height = Draw_Rect.Height();
int Rect__Width = Draw_Rect .Width ();
HDC hDc
= pDC-> GetSafeHdc();
m_Info-> bmiHeader.biHeight
= Rect_Height;
m_Info-> bmiHeader.biSizelmage = Rect_Height 2;
m_Info-> bmiHeader.biXPelsPerMeter = (::GetDeviceCaps(hDc,
HORZRES)*1000)/::GetDeviceCaps(hDc, HORZSIZE);
m_Info-> bmiHeader.biYPelsPerMeter = (::GetDeviceCaps(hDc,
VERTRES)*1000)/::GetDeviceCaps(hDc, VERTSIZE);
char
Frg[8192];
for(i=0; i < Rect Width;

6.

205

II
q = i & 3;
for(k=0; k < Rect__Height; k++)
Frg[ (k 2) + q] = (char) (i+k) ;
if(q == 3)
::SetDIBitsToDevice(hDc, i - 3, 0, 4, Rect_Height, 0, 0, 0,
Rect_Height, Frg, m_Info, DIB_RGB_COLORS);

//
if(q != 3)
: :SetDIBitsToDevice (hDc, i q, 0, q+1, Rect__Height, 0, 0, 0,
Rect_Height, Frg, m_Info, DIB RGB COLORS);

<F5> . , . 6.13. (, .)

File Edit View window Help


1

D ?

i f :

DEEEBSB9I

Hfc .

^ ,'* 1''

- '

"V

K
- '

1
I:
I K * *

'

'

Ready
. 6 . 1 3 . - ( High Color)

206

II.

9. 256 .
. 6.14.

DIB - oral
File

Edit

View

Window

Help

Ready
. 6 . 1 4 . - ( 256 )

10. .
, CDiBView
BITMAPINFO, - (DIB) .
,
.

bmiHeader,

BITMAPINFOHEADER. , .
. bmiHeader bmicoiors,

6.

207

RGBQUAD, , .
BITMAFIHFO ,
CDiBView.

CDiBView: :OnDraw. CDIBDOC (, ,
) :: ..,.ii-nt:t-L
, . BITMAPINFOMEADER.
- ,
.
, -

, . . . I , .
setoiBitsToDevice. ,
.

, . , ,
, .
.
/, 2. , ,
.


2, ,
, c o b j e c t : : S e r i a l i z e ,
CArchive.

.
. , ,
, , MS-DOS.
Text ,

.
Text , , , :
1. File | Open Solution ( | ) Open Solution ( )
Text (). Open Solution ( ) , . 7.1.
2. Text () Open
().

7.

209

. 7 . 1 . Open Solution
3.

TextView.cpp OnLButtonDown lpDoc-> a Y . A d d ( p o i n t . ) ;


//
lpDoc-> SetModifiedFlag();

4. TextDoc.cpp
Serialize 7.1.
] 7.1. CTextDoc: : S e r i a l i z e
// CTextDoc
void CTextDoc::Serialize(CArchives ar)
int
i, n;
if (ar.IsStoring())
{

//
n = aX.GetSizef) ;
ar n;
for(i=0; i < n; i)

210

II.
ar
ar

else
//
;
.SetSize();
aY.SetSize(n);
for(i=0; i < n; i
ar aX[i];
ar aY[i];

Text-Text 1
File Edit View Window Help
Q ^ B
< .>\ m t
IPJleKtl

[41.49]
[18i.es]

[74.134]

Ready
. 7.2. Text

-.

.-

.!._:

7.

211

5. <F5> .
Text.
6. .
, . 7.2.
7. File | Close ( | )
Close () . Text (),
. 7.3.
8. Yes (), ,
Textl. Save As
( ), .7.4.

1 1 U.

Cancel

. 7 . 3 . Text

JJ.SJ
_A

is a m-

Te-t

_JC'ebug
^Jres
c;] " h i l d F r m . c p p
It] G n l d F r m . h
c:]MamFrm.cpp
^(lamFrm.h
M ] PeadMe
h]Resource,h
^stdafx.cpp
Jjstdafx.h

]Text

ci]Text.cpp
;h]Text.h
^ Text
4 le..L,tc
^Text
e|Text.s!jo
PjjjText
ci] TextDoc.cpp
Ji] TextDoch
_ci] TextView.cpp
_K] TextView.h

-lie name:

Save as type:

Filesl".")

. 7.4. Save As
9.

Save (). .

Cancel

II.

212

10. File | Open ( | )


Open () .
Open (), . 7.5.

Look in a Text
v

'

|Debug
Zjres
*j ChildFrm.cpp
JV) ChildFrm.h
iCt] MainFrm.cpp
hlMainFrm.h
1] ReadMe
Ji] Resource.h
jcijstdafx.cpp
[h]stdafx.h
S]Text

*3 Text.cpp
ji] Text.h

ih] TextView.h

Text
OS Text.re
:**Text
jalText.suQ
lS-Text
^]Textl
2 TextDoc.cpp
|K]TextDoc.h
*f]TextView.cpp

F
elisofy
tpe:AlF
e
lis(".
File name:

-i

Open

. 7.5. Open
11. TextAppl Open
(). , , .
CDocument: :SetModif iedFlag,

,
, , .
, . 7.3
.
c o b j e c t : : S e r i a l i z e . CArchive: : IsStoring
, .
, , ,
. CArchiue <<.

, . , .

7.

213

CArchive
>>.
:
, Open () Save As ( )
;
,
.
:
1. Resource View ( ).
2. Text.rc, String Table (
) String Table.
.
3. iDR_TextTYPE Caption () . , . 7.6.
".. Tent - Microsoft Visual C++ {design] -'-{$9!1
File Edit ew Project Build D_ebug Jpols ffiindom 1
. J _J L=i &
%

i .

,|.

ID
IDR MAINFRAME

jj
'

AFX IDS TITLE


AFXJDSJDLEMES5AGE
ID_INDICATOR_EXT
ID_INDICATOR_CAPS
ID_INDICATOR_NUM
IDJNDICATOR SCRL
I0JNDICATOR_OVR
IDJNDICATOR_REC
,ID FILE NEW
| ID_FILE_OPEN
:ID FILE CLOSE
i ID_FILE!SAVE

I ID_FILE_SAVE_AS
i ID FILE PAGE SETUP
I IDJ=ILE_PRINT_5ETUP
I ID_FILE_PRINT
ID FILE PRINT PREV...
. IDIAPP.ABOUT"

i ID_APP_EXIT
;ID_FILE_MRU_FILE1
; ID FILE MRU FILE2
j ID.FILE_MRU_FILE3
j ID_FILE_MRU_FILE4
i ID_FILE_MRU_FILE5
1 ID_FILE_MRU_FILE6
!
ID_FILE MRU FILE7
i ID FILE MRU FILE8
i ID_FILE_MRU_FILE9
ID_FILE_MRU_FILE10
ID_FILE_MRU_FILE11
'I
Ready

@,

<P . .

Debug

OnEnHscroIEdltBox

Text.rr (String Table) J


i Value
128

i Caption
Text

57344
57345
59136
59137
59138
59139
59140
59141
57600
57601
57602
57603
57604
57605
57606
57607
57609
57664
57665
57616
57617
57618
57619
57620
57621
57622
57623
57624
57625
57626

Ready
EXT
CAP
NUM
SCRL
OVR
REC
Create a new document\nNew
Open an existing document\nOpen
Close the active document\nClose
Save the active document\n5ave
Save the active document with a new name\nSave As
Change the printing options\nPage Setup
Change the printer and printing options\nPrint Setup
Print the active documenUnPrint
Display full pages\nPrint Preview
Display program riforrnation, version number and copynght\nAbout
Quit the application prompts to save documents\nExit
Cpen this document
Open this document
Open this document
Open this document
Open this document
Open this document
Open this document
Open this document
Open this document
Open this document
Open this document

" ^ -_|* J

Resource View - Text

^>

*
+
j Accelerator
+
j Dialcg
+
J Icon
+
1 (lenu
- _ J String Table
abc String Table [English (U
+
+

~~

. j

ii " i"

j Toolbar
j Version

^ ' 4 .

Properties
String Editor

j
1
3lReso...
~

IStrEd

(Name)
^

. 7 . 6 .

X
]

~y~\ ti 1

iff Properties | G ' i

.
'
1

" I

214

II.

4.

"\nTextApp\nTextApp\nTextApp file
(*.tpf)\n.tpf\nTextApp.Document\nTextAp Document",
5. Text.cpp
initinstance return TRUE,- :
//
CString

Work_Dir;

Work_Dir = GetProfileString("CONTROL","DIR","c:\\");
SetCurrentDirectory(Work_Dir) ;

6. TextDoc.cpp
Serialize 7.2.
I 7.2. CTextDoc: : S e r i a l i z e
// CTextDoc
void CTextDoc: :Serialize(CArchives. ar)
{

int

i, n;

CWinApp*

pApp = AfxGetApp();

if (ar.IsStoringO )
{
//
n = aX.GetSizeO ;
ar n;
for(i=0; i < n;
ar

aX[i];

ar

aY[i];

}
//
char

Cur_Dir[_MAX_DIR];

GetCurrentDirectory(_MAX_DIR, Cur_Dir);
ASSERT(pApp-> WriteProfileStringf"CONTROL","DIR",Cur_Dir));
else
//
ar

n;

aX.SetSize(n);

7.

215

aY.SetSize(n);
for(i=0; i < n;
ar

aX[i];

ar

aY[i];

7. <F5> .
8. .
9. File | Save ( | ).
Save As ( ), . 7.7.

& -

SYSTEM (:)
r
v;
f.

_J ARCHIV
_JDOS
_J DRIVERS
msdownld.tmp
_J Multimedia Files
_JProgram Files
_J SIERRA

WN
I _95

File name:
Sa/eastype:

JTextApp file ("tpf)

Cancel

. 7 . 7 . Save As

10. , ,
Save (). Save As ( ) .
11. File | Open ( | )
Open () .
Open (), . 7.8.
12. TextAppl.tpf Open
(). , , .
8 . 629

II.

216

Look in. [
Ue] Text App I .tpf

4=

File name:
: Files of iype:

TextApp file (".tpf)

zl

Open |
Cancel I

. 7.8. Open
Save As ( ),
. 7.7, , . 7.4, ,
Save as type (
) "TextApp file (*.tp0", Save in ( ) "SYSTEM (:)",
, :
tpf.
Open (),
. 7.8, , . 7.5, , Files of type ( ) "TextApp file (*.tpf)", Look
in ( ) ,
, tpf.
, Caption ()
. 4, , ,
.
, (\)
(
,
, ).
CDocTemplate: : G e t D o c S t r i n g .
, , ,
, -

7.

217

( Files
of type ( ) Open ()
Save as type ( ) Save As ( )).
,
, , ,
, .
.
, ,
.
.

.

cwinApp: :WriteProfiieString, ,
,
,
. CTextDoc::Serialize , . , GetCurrentDirectory,
cur_Dir ,
.
w r i t e P r o f i l e S t r i n g , . cwinApp, , AfxGetApp.

cwinApp: : G e t P r o f i i e s t r i n g , , , ,
, ,
, , .
CText: : i n i t i n s t a n c e ,
.
. i n i t i n s t a n c e
, cwinApp, .

SetCurrentoirectory, .

218

II.




. Windows , . , ,
.
, , .
, Windows
.
, ,
.
, , .
.
, , .
, , .
CDocument: : s e r i a l i z e , , .
,
.
. , S e r i a l i z e ,
, . CFiie.

CFiie
CArchive
CFiie MFC .
. CArchive
MFC.
CFiie . 2.
.

CDocument: : s e r i a l i z e .

7.

219

,
.
, , ,
. ,
.
Text,
. :
1. File | Open Solution ( | ) Open Solution ( )
Text (), Text Open ().
File | Recent Projects ( | )
.
Visual C++ ,
.
2. Class View ( ), Text ()
cTextview.
3. Properties ().
Properties ().
4. Properties () Messages (). , .
5. WMRBUTTONDOWN
. CTextview OnRButtonDown.
6. Class View ( ) CTextview

OnRButtonDown. TextView.cpp, .
7. OnRButtonDown 7.3.
I 7.3. C T e x t v i e w : :OnRButtonDown
//
void CTextview::OnRButtonDown(UINT nFlags,

CPoint point)

//
CTextDoc*

lpDoc = GetDocument();

CFileException
int

fe;

i , n;

if(lpDoc-> GetPathName() == "") //

II.

220

CView::OnRButtonDown(nFlags, p o i n t ) ;
return;

// CFile
CFile* lpFile = lpDoc-> GetFile(lpDoc-> GetPathName(),
CFile::modeRead | CFiie::shareDenyNone, &fe) ;
if(fe.m cause)

//

{
::MessageBox(0, " ", ""
_ | MB_SYSTEMMODAL) ;
CView::OnRButtonDown(nFlags, point);
return;

//
lpFile->Read(&n,

sizeof(int));

//
lpDoc-> aX.SetSize(n);
lpDoc-> aY.SetSize(n);
//
f o r ( i = 0 ; i < n; i++)
{

lpFile->Read(&lpDoc-> a X [ i ] , sizeof(UINT)
lpFile->Read(&lpDoc-> a Y [ i ] , sizeof(UINT)

//
lpDoc->ReleaseFile(lpFile, true);
//
lpDoc-> SetModifiedFlag(FALSE);
//
Invalidate();
CView::OnRButtonDown(nFlags, point);

7.

221

8. <F5> .
9. Open () ,
tpf Open
(). ( ,
, .)
10. .
11.
.
12. . .
OnRButtonDown CDocument::GetFiie. , , ,
CDocument CFiie.
, ,
. CDocument: :GetPathName.
, , .
GetFile . , Ger.PathName , ,
, OnRButtonDown
.

CDocument: :GetFile CFiie. ,
,
. MessageBox, MB_SYSTEMMODAL
, , , ,
.
- ,
.
CTextDoc: : S e r i a l i z e , CFiie,
chive,
CFiie: :Read.
,
. , . .

222

II.

,
sizeof,
.
CDocument::ReleaseFile.
cwnd: : i n v a l i d a t e , ,
.
.
,
. ,
C F i i e : : W r i t e . ,
CFiie: :Read.
,
, ,
.
, .

, .
, S e r i a l i z e
. " "
File | Save ( | ) , , , .
, , . .
.

UPDATE_COMMAND_UI

ID_FILE_SAVE,
ccmdui:: Enable FALSE, . , File | Save
As ( | ),
S e r i a l i z e , .

CFiie
CFiie
CArchive , . , , ,
,
CArchive.
CFiie, ,
, / -

7.

223

. (. 2).
Text CFile,
/:
1. File | Open Solution ( | ) Open Solution ( )
Text (), Text Open ().
File | Recent Projects ( | )
.
Visual C++ ,
.
2. Class View ( ), Text ()
CTextDoc.
3.

Add | Add Variable


( | ). Add Member
Variable Wizard - Text ( ).

4. Variable type ( )
CFile*, Variable name ( )
l p C i i p F i l e Finish ().
5. .. 24 lpOutFile, CFile*.
6. TextView.cpp OnLButtonDown lpDoc-> aY.Add(point.);
:
//
lpDoc-> lpClipFile-> Write(Spoint.x, sizeof(LONG));
lpDoc-> lpClipFile-> Write(spoint.y, sizeof(LONG));
7. onRButtonDown 7.4.
! 7.4. CTextView: : OnRButtonDown
//
void CTextView::OnRButtonDown(UINT nFlags, CPoint point)
{

int
CString

i, n;
File_Name;

//
CTextDoc* lpDoc = GetDocument();

224

II.

//
CWinApp* pApp = AfxGetApp();
VERIFY(pApp-> m_pDocManager != NULL);
// ,
if (pApp-> m pDocManager-> DoPromptFileName (File_Name,
AFX_IDS_SAVEFILE,
OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, FALSE, NULL))
{
//
char Cur_Dir[_MAX_DIR];
GetCurrentDirectory(_MAX_DIB, Cur_Dir);
VERIFY(WriteProfileString("CONTROL","DIR",Cur_Dir));
//
try
{
lpDoc-> lpOutFile = new CFile(File_Name,
CFile::modeCreate I CFile::modeKeadWrite
CFile::shareDenyNone) ;

}
// ,
catch (...)
{
::MessageBox(0, " ",
"", MBJDK ] MB_SYSTEMMODAL);
exit(l);

//
UINT nTemp;
n = lpDoc-> lpClipFile-> GetLengthO / (2*sizeof (UINT) ) ;
lpDoc-> lpOutFile-> Write(&n, sizeof(int));
lpDoc-> lpClipFile-> SeekToBegin();
while(ipDoc-> lpClipFile-> Read(&nTemp, sizeof(LONG)))
lpDoc-> lpOutFile-> Write(SnTemp, sizeof(LONG));

//
CFileException fe;
if(lpDoc-> GetPathName() == "")

//

7.

225

CView::OnRButtonDown(nFlags, point);
return;
}
// CFile
CFile* lpFile = lpDoc-> GetFile(lpDoc-> GetPathName(), CFile::modeRead
CFile::shareDenyNone, Sfe);
if(fe.m_cause)

//

::MessageBox(0, " ",


"", _ I MB_SYSTEMMODAL);
CView::OnRButtonDown(nFlags, point);
return;

//
lpFile->Read(&n, sizeof(int));
//
lpDoc-> aX.SetSize(n);
lpDoc-> aY.SetSize(n);
//
for(i=0; i < n;
lpFile->Read(&lpDoc-> aX[i], sizeof(UINT);
lpFile->Read(&lpDoc-> aY[i], sizeof(UINT))

//
lpDoa->Relea"seFile (lpFile, true) ;
//
lpDoc-> SetModifiedFlaglFALSE);
//
Invalidate();
CView::OnRButtonDown(nFlags, point);

226
8.

II.

TextDoc.cpp #include
"Text.h"
#include <io.h>

9.

CTextDoc 7.5.

I 7.5. CTextDoc

// CTextDoc
CText Doc::CText Doc
: lpClipFile(NULL)
, lpOutFile(NULL)
{
struct _finddata_t file;
long
hFile;
CString
File_Name = ":\\ . ";
//
if((hFile = _findfirst(File_Name, sc_file)) != -1L )
f
::MessageBox(0, " ", "", MBJDK I MB_SYSTEMMODAL);
exit(1);
}
_findclose(hFile);
//
try
{
lpClipFile = new CFile(File_Name, CFile::modeCreate
CFile::modeReadWrite | CFile::shareDenyNone);
SetFileAttributes(File_Name, FILE_ATTRIBUTE_HIDDEN);
lpOutFile = NULL;

//
catch (...)

7.

227

::MessageBox(0, " ",


"", _ I MB^SYSTEMMODAL);
exit (1) ;

CTextDoc::-CTextDoc()
{
//
CString
F_Name = lpClipFile-> GetFilePath()
//
lpClipFile-> Closed;
//
if(lpOutFile)
lpOutFile-> Close();
//
delete lpClipFile;
delete lpOutFile;
//
CFile: -.Remove (F_Name) ;

10. Text.
CText:: i n i t i n s t a n c e :
// Dispatch commands specified on the command l i n e . Will return FALSE if
//
app
was
/Unregister.
if

launched

with

/RegServer,

/Register,

/Unregserver

or

(!ProcessShellCommand(cmdlnfo))
return FALSE;

11. <F5> .
12. File | Open ( | )
Open () .
13.

Open () TextApp I .tpf, , Open ().

228

II.

14. , , TextAppl.tpf.
15. . .
16. .
Save As ( ). .
, Save As ( )
, ,
. 7.9.

^JSJxJ

Savem
<
lf
iij*]TextApp.tp
I ^] 1

- 3

Veiw
ArangecIons
j!
i
Refresh
Fe
li name: " PPaassetet Shortcut

;
Saveasy
tpe
(T:
ext/ New
l
!I
Properetis

Ready

on-

*] j Save

] Cancel
-.

. 7 . 9 . Save As

17. File name ( ) TextApp2 Save (). , .


18. File | Open
( | ).
19. Open () TextApp2.tpf Open ().
,
.

7.

229

onLButtonDown ,
.
CFile: :write,
, , .
OnRButtonDown ,
, .
,
Save
As
(
).

CDocManager: : DoPromptFileName. m_pDocManager,


CDocManager, cwinApp. cwinApp
AfxGetApp. CDocManager: : DoPromptFileName .
c s t r i n g , , . . Open () AFX_IDS_OPENFILE, Save As
( ) AFX_IDS_SAVEFILE.
,
. :
OFN_HIDEREADONLY ,
" ";
OFN_PATHMUSTEXIST ;
OFN_FILEMUSTEXIST , .
BOOL . TRUE, TO
Open (),
Save As ( ). , ,
CDocTempiate,
. , Files of type (
) ( Open ()) Save as type ( ) ( Save As ( ))
.
All Files ("*.*) ( ).
,
Files of type ( ) Save as type ( )
,

(. 2).

230

II.

Save As ( ) Save (), CDocManager::DoPromptFileName , ,


Save As ( ).
,
S e r i a l i z e .
OnRButtonDown
CFile
l p o u t n i e .
. MessageBox,
, e x i t .
CFile
,
.
CFile: :GetLength,
. .

,
CFile: :SeekToBegin, .
.
CFile: :Read

C F i l e : : w r i t e . CFile: :Read , ,
, . .
.
OnRButtonDown .
CTextDoc
CFile. , , , . ,
. , CTextDoc,
. ,
, , , .
, ,
CFile -

7.

231

CMainFrame ,
. .
, .
, (, ).
,
, , , . ,
, .
, ,
1
, CFile
,
s e t F i i e A t t r i b u t e s , .

"" , : " ?", .
CTextDpc
CFile, .
* ,
C F i i e : : G e t F i l e P a t h , .
,
. , ,
GetFileName , .
CFile: :close, . ,
, .
CFiie , , CFile: :close .
CFiie .
CFile
. CFile::Remove, . ,
,
Microsoft.
CText: : i n i t i n s t a n c e , ,

232

II.

.
.


16- Windows , ini. ,
,
,
, . 32- Windows . , , ,
"" , , , .
Windows ,
, .
, . RegEdit.exe Windows.
Start (), , Run (). Run (), . 7.10.

Type the name of a program, folder, document, or


Internet resource, and Wn
i dows wil open it for you.
Open:
Cancel

Browse.,

. 7 . 1 0 .

Open () "regedit",
. 7. . Registry Editor
( ), . 7.11.
.
, -

7.

233

.
,
.
: Registry Editor
Registry Edit Ve
i w Favorites Hep
l
My Computer
_J HKEY_CURRENTJJSER
HKEY_LOCAL_MACHN
IE
HKEYJJSERS
HKEY_CURRENT_CONFG
I

Name
'^(Default)

Type
REG_SZ

Data
(value not set)

My Computer\HKEY_CLA55ES_ROOT
. 7 . 1 1 . Registry Editor


, . 7..
:
> HKEY_CLASS_ROOT
, , . , ,
, ;
HKEY_CURRENT_USER , . ,
;
HKEY_LOCAL_MACHINE ;

234

II.

HKEY_USERS , , ;
HKEY_CURRENT_CONFIG ;
HKEY_DYN_DATA ,
. . .
. 7.12 CONTROL, .

ft Registry Editor
Registry Edit Ve
i w Favorites Hep
l
- ^ My Computer
* Name
+ _J HKEY_CLASSES_ROOT
^(Default)
- _| Hr"Ef_CURRENT_USER
+ | AppEvents
I Consoe
l
+ | Control Panel
I Environment
+ | Identities
+ I Kevboard Layout
+ ] Printers
+ j RenioteAccess
- J Software
+ _J Adobe
+ | Ca
l sses
+ _J Intel
- 1 Local AppWziard-Ger
| Brush
_| DDB
_J DIB
_l Line
_J Projectl
~

Type
REG_SZ
REG_SZ

j Data
_
(value not set)
E:\DAT

I Project2

- _J Text
I Recent File L
_ ] Settings
I MediaLingua
I Microsoft
-rj
;My Computer\HKEY_CURRENT_USER\Software\Locai AppWijard-Generated Applications\Text\CONTROL
. 7 . 1 2 . CONTROL


i n i t i n s t a n c e ,
cwinApp, SetRegistryKey,
. Registry Editor ( ) ,

Software,
,

,

HKEY_CURRENT_USER. , -

7.

235

. AppWizard "Local AppWizard-Generated Applications"


( , AppWizard).
, , ,
, , .
, , .

L o a d s t d P r o f i i e S e t t i n g s , , , .
, , File
(). ,
. , ,
. ,
, . File ()
: ,
.
, cwinApp. w r i t e P r o f i l e S t r i n g ,
W r i t e P r o f i l e i n t . GetProf i l e S t r i n g
G e t P r o f i l e i n t .

, Microsoft
.
Windows
. , Visual C + + , .
Visual C + + , , , , ,
. CEdit CRichEditview.
, . .
, CRichEditview. , ,
WordPad,
, MSDN.



, CEdit,
EditApp,
, .
:
1. , 1
EditApp, MFC Application Wizard EditApp ( MFC) Finish
().
2.

, Generated Classes ( ), . 8.1.

3. Base class ( )
CEditview Finish ().

8,

Generated Classes
Review generated classes and specify base classes for your application,

. 8 . 1 . MFC Application Wizard - EditApp

File Edit View Window Help

I
!
i
Ready
. 8 . 2 .

237

238

II.

4. <F5> . , . 8.2.
, ,
, , , . Edit | Cut ( | ) Edit | ( | ) Edit | Paste ( | )
. , ,
, ,
, . ,
.


. ,
cEdit, ,
. EditApp :
1. Resource View ( ) EditApp.rc Menu ().
2. iDR^EditAppTYPE. . , ,
, .
3. Edit () , "
" ( ).
4. Insert Separator ( ). .
5. " ",
, "&Find"
<Enter>.
6.
Properties ().
Properties ().
7. ID ( ) I D S E E K , Prompt
() "Finds the specified text\nFind".
8. Dialog (),
EditApp.rc Resource View ( ).

8.

239

9. Insert Dialog (
). .
10. Dialog () IDD_DIALOG1
11. ID (
) Properties () IDD_SEEK.
12. Caption () Properties
() "Find".
13. Cancel (),
, .
14. Toolbox () Edit Box
( ) ,
.
15. ID ( ) Properties
() IDC_SAMPLE.
., EditApp - Microsoft Visual ++1 design] - Him>
Efe

Edit

View

Eraiect

guild
?

Eebug

Fcymat

lools

ffindow

Help

i(Ed
A
tippc
r.D
I(D_SEE
C
I -Dao
ilg)|
.1 dJ - .' ^

&

> i

Oebug

-+]E
A
tdp
iA
p
e
ro
D
ac
lic
)
e
l
a
r
tr
-L3JD
I9
DB
J
sO
U
T
B
O
X[Er
J Icon
J Menu
jjjj] IDR.EdtiAppTYPE [E
2j IDRJIAINFRAME [E
~~ "u
lWTPFCT
Jlj
SReso
.,

|D
a
o
ilgNodeD
IgIRes
Properte
is

[_] \m\
..

Condtion
D
I
D
I D_SEK
Language Russa
in
(Name)

Ready
. 8..

II.

240

16. Toolbox () Static Text


( ) , .
17. Caption () Properties ()
"Find:". , . 8.3.
18. Add Class
( ). MFC Class Wizard - EditApp
( MFC), . 8.4.
19. Class name ( )
cseekDig Base class ( )
CDialog.

20. .h file.
VS Wizards Select File, . 8.5.

MFC Class Wljard - EditApp


Welcome to the MFC Class Wizard
This wizard adds a class that inherits from MFC to your project, Options may change depending
on the base class selected.

Finish

Cancel

Help

. 8 . 4 . A d d Class Wizard - EditApp

21. EditApp View, h


File name ( ) Save ().

8.
VS Wizards Select File
Save in:
EditApp
_JDebug
res
|IV] ChildFrm.h
History
ih] EditApp.h
Jh]EditAppDoc.h
jhp EditAppView.h
My Projects !) MainFrm.h

241\
2]

JCj ?^

Tools -

JV) Resource, h
|K]stdaFx.h

Desktop

Favorites
File name:

Save as type: visual C++ Header Files

Save
Cancel

. 8.5. VS Wizards Select File


22. .. 20 21 . file,
EditAppView.cpp.
23. Finish (). ,
. 8.6, , EditAppView.h ,
.
I Microsoft Development Environment
E:\Documents and Setn
i gs\Nc
ik\My Documents!VsiualStudo
i Proe
j cts\EdtiApp\EdtiAppVe
i w,h arleady exists. Do you want to merge this da.ss into the same file?
If V ?l No |
. . 8.6. Microsoft Development Environment
24. Yes (). , EditAppView.cpp.
25. Yes (). MFC Class Wizard ( MFC) .
26. Class View ( ),
EditApp
27. cseekDig Add | Add Variable ( | -

242

II.
). Add Member Variable Wizard
( ).

28. Control variable ( )


Control ID
( )
IDC_SAMPLE.

29. Category () Value


(), Variable name ( )
m_sample Finish ().
Add Member Variable Wizard (
) .
30. CEditAppView Properties ().
Properties ().
31. Properties () Messages (). , .
32. WMLBUTTONDBLCLK,
. , EditAppView.cpp
.
33. Properties () Events ().
, .
34. ID_SEEK COMMAND.
,
. 32.
35. EditAppView.cpp
CEditAppView
8.1.
| 8.1. CEditAppView: :OnSeek
// CEditAppView
void CEditAppView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
//
CEditS edit = GetEditCtrl();
//
UINT n = Oxffff & edit.CharFromPos(point);
while(n< (int) GetBufferLength())

8.

243

edit. SetSel (n,' n, E'ALSE) ; //


Sleep(200);
}
CEditView::OnLButtonDblClk(nFlags, point);

// Edit, Find
void CEditAppView::OnSeek(void)
{
CSeekDlg dig(this); //
//
if(dlg.DoModal() == IDOK) //
{
FindText(dig. Sample); //
}
}

36. <F5> .
37. , .
38.
.
39. ,
. , , .
, , .
,
.
40. Edit | Find ( | ).
Find ().
41. , , . ,
. .
. onLButtonDown CEdit, . CEditView: :GetEditCtrlT

244

II.

, cEdit, CEdit: : CharFromPos,


, , .
,
65 534 , .
, CharFromPos
.

. ,
.
CEditView: :GetBufferLength.

,
. Visual C++, , ,
OnSeek .
, .
c o i a i o g : :DoModai,
. ,
, CEditView: :FindText,
. CEditView: :OnFindNext
, ,
,
.


,
CRichEditview. WordPad, MSDN. -
. , .
, CRichEditview
, RichApp ,
. :
1. , I
RichApp, MFC Application Wiz-

8.

245

ard - RichApp ( MFC)


Finish ().
2. Generated Classes (
).
3. Base class ( )
CRichEditview Finish ().
4. <F5> .
TextApp. . ,
, Word, . RichApp Edit | Paste Special ( |
). Paste Special ( ), . 8.7.

OK

Source: E:\VC7WC08WC08_.doc

As:
<? Paste

!** Paste Link

Microsoft word
Picture (Metafile)
Rich Text (RTF)
Unformatted Text

Cancel
" Display As Icon

-ResultInserts the contents of the clipboard into your


document so that you may activate it using
Microsoft Word 7.0.

. 8 . 7 . Paste Special

, ,
,
.
. .
. . 8.8.
. 8.8 "",

Word. ,
Word.
, Edit | Insert New Object ( | ), Object Type ( ) In-

246

II.

sert Object ( ), . 8.9, Microsoft Word .

UV RichApp - RichApp 1
File

'

* ', . ..
Window

) \

Times New Roman CYR - 10

Jg)

! I

I LS3 =

*?

ll

> = iW

PJ RichApp 1
^^

* 1''--.'^|

. 8.8. RichApp Word

Object Type:

OK

CtealeNew
Create from File

mage Document
Media Clip
Microsoft Clip Gallery
Microsoft Equation 3.0
Microsoft Map
Microsoft Photo Editor 3.0 Photo
Microsoft Photo Editor 3.0 Scan

Cancel

Display As Icon

Result
Inserts a new Bitmap Image object into your
document.

. 8.9. Insert Object

"

8.

247

"" , .
,
OLE, , CRichEditview.
RichApp :
1. Resource View ( ) EditApp.rc Menu ().
2. iDR_RichAppTYPE. .
3. " ",
,
"&Format".
4. <Enter>. .
5. Format
(), , ,
, View () Window ().
6. Format (), " ",
"&Left" <Enter>.
.
7.
Properties ().
Properties ().
8. Prompt () Properties ()
"Align left\nLeft".
9. , .. 68, "&Center"
"Center text\nCenter".
10. , .. 68, "&Right"
"Align right\nRight".
11. " ",
Insert
Separator ( ). .
12. , .. 68, "&Italic"
"Italic font\nItalic".
13. , .. 68,
"&Underline" "Underlined font\nUnderline".

14. File | Save All ( | )


Save All ( ) Standard
(). , ,
.
9 . 629

248

II.

15. Class View ( ),


RichApp.
16. CRichAppview
Events () Properties (). ,
.
17. IDFORMATCENTER COMMAND. .
18. .
RichAppView.cpp.
19. .. 17 18 ID_FORMAT_ITALIC,
ID_FORMAT_LEFT, ID_FORMAT_RIGHT ID__FORMAT_UNDERLINE.

20. RichAppView.cpp
CRichAppview
8.2.
: 8.2. CRichAppview
II CRichAppview
//
void CRichAppview::OnFormatCenter(void)
{

OnParaAlign(PFA_CENTER);

//
void CRichAppview::OnFormatItalic(void)
{
OnCharEffect(CFM ITALIC, CFE ITALIC);

//
void CRichAppview::OnFormatLeft(void)
{
OnParaAlign(PFA_LEFT);

//
void CRichAppview::OnFormatRight(void)

8.

249

OnParaAlign(PFA RIGHT);

//
void CRichAppView::OnFormatUnderline(void)
{
OnCharEffeet(CFM UNDERLINE, CFE UNDERLINE);

VRichApp-RidlAppl
File Edit View Format Window Help
RichAppI





|
'

Ready
. 8 . 1 0 . RichApp
21. <F5> .
22. Format | Italic ( | Italic)
. .
23. Format | Underline ( | Underline)
. .

250

II.

24. Format | Italic ( | Italic)


. .
25. Format | Underline ( | Underline)
. .
26. Format | Right ( | ).
.
27. Format | Center ( | ).
.
28. Format | Left ( J ).
. , . 8.10.
,
.
CRichEditview::OnParaAliqn,
. CRichEditview: :oncharEffect,
, , ,
,
.


,
CRichEditview, ,
CEdit, .
CRichEditview :
1. File | Open Solution ( | ). Open Solution ( )
RichApp RichApp.
.
2. Resource View ( ) RichtApp.rc Menu ().
3. iDR_RichtAppTYPE. .
4. Format (),
, " ",

Insert Separator ( ). .

8.

251

5. "
", , "& Font"
<Enter>.
6.
Properties ().
7. Prompt () "Set user font\nMy
Font".
8. File | Save All ( | )
Save All ( ) Standard
(). , ,
.
9. Class View ( ),
RichApp.
10. CRichAppview
Events () Properties (). ,
.
11. ID_FORMAT_MYFONT COMMAND. .
12. .
RichApp View. cpp.
13. RichAppView.cpp
onFormatMyfont 8.3.
| 8.3. CRichAppView: : OnFormatMyfont
//
void CRichAppView::OnFormatMyfont(void)
{

CHARFORMAT2&

cf = GetCharFormatSelection();

cf.dwMask
I = CFM_COLOR;
cf.yHeight
= 600;
cf.crTextColor =RGB(0, 0, 255);
cf.bCharSet
= ANSI_CHARSET;
Cf.bPitchAndFamily = VARIABLE_PITCH I
strcpy(cf.szFaceName, "MS Sans Serif");

FF_ROMAN;

II.

252

if(cf.dwEffects & CFE_AUTOCOLOR)


cf.dwEffects = 0;
SetCharFormat(cf) ;

14. <F5> .
15. - ,
Format | My Font ( | ).
16. .
, ,
, . 8.11.

UV RichApp - RichApp 1
File Edit Ve
i w Format Wn
i dow Help

m as

"

WRc
ihAppl

Ready
. 8 . 1 1 . RichApp

CHARFORMAT2, . , ,

8.

253

, CHARFORMAT2, ,
CRichEditview: :oncharEffect , , .
Visual C++ 6.0 CHARFORMAT2
CHARFORMAT, (
) . Visual C++ 7.0 .
CHARFORMAT 2 ,
OnCharEffect, .
OnFont
CHARFORMAT2, .
CRichEditview::GetcharFormatselection, .
CHARFORMAT2 . ,
dwMask CFM_COLOR, (- , ). yHeight
. crTextCoior . bcharSet
. bPitchAndFamily ,
, , . szFaceName .
, dwEffects CFE_AUTOCOLOR, crTextCoior ,
,
. OnFont CRichEditview: :setcharFormat, CRichEditview.
CHARFORMAT2.



Windows. . , ,
,
.
2S1

IMFC Application &

Specify User Interface Features


Specify options that control the look and Peel of your application.

Application Type
Compound Document Support
Document Template Strings
Database Support

Select: man
i frame styles:
^ ;Thick frani^
P? Minimize box
[v* Maxm
i zie box
Minimized
~ Maximised
! System menu

: :

Jser Interface Features

P* Initial status bar

Advanced Features

* Spjt window

Select child frame styles:


fc' Child minimize box
f7 Child maximize box
~ Child minimized
I Child maximized
Select toolbars:
None
f* Standard docking
" Browser style

Generated Classes
Cancel

Help

. 9 . 1 . MFC A p p l i c a t i o n W i z a r d - T o o l



. , .

9.

255

Caps Lock ( ),
Num Lock ( Num) Scroll Lock ( SCRL). , . , .

User Interface Features ( ) MFC Application Wizard - Tool ( MFC),
. 9.1.
, Select toolbars
( ) Standard docking (
). ,
Initial status bar
( ).


, . . 9.2.

D
. 9 . 2 .

, ,

(New, ),

(Save, (Open, )
). , ,

(Cut, ),

(, )

(Paste,

).

(Print, -

), I
).

I (About, , -

Visual C++
, ,
.

II.

256


, . ,
. , , , , . . ,
, .
" " : " ?"
, , Tool ,
. :
1. Tool , 1. .
2. Resource View ( ), Tool.rc,
Toolbar.
. Tool - Microsoft Visual C++ [dcHiqn] - Tooljc (
Project

-t P -

guild

\\

Debug

'

lools

>

Window

Help

WorHnq wtih Resources


Ctgjtinq a New Resource
Vjewina Resources in Resource E

LtL

Ready

, 9..

9.

257

3.
IDRMAIN FRAME. ,
,
.
, . 9.3.
4. Cut () , .
, , . ,
Cut ().
5. () Paste ().
.
6. <F5> .
, . 9.4.

. 9.4. Tool
- , ,

.

II.

258




, ,
, .
Tool:
1. File | Open Solution ( | ) Open Solution ( )
Tool, Tool Open ().
2. Resource View ( ), Tool.rc.
3. Toolbar Insert Toolbar ( ).
, . 9.5.
, Tool - Microsoft Visual C++1 design]
| File | Edit Ve
iw Eroe
j ct Bud
li debug lools fiction Mndrw Hep
l
~ _J - 1_? S
Debug
-* '/ ' t P - [ T | ' : N L ^ i f 1 ! '."
1!
ir u' in. ill* 1 l * i Tool.rc(IDR_T...ARl Toolbar)* |

'2,
- _j Tool.rc
) Acceleratoi
) Da
io
lg
jIcon
j Menu
_J StringTatfe

JSl

j Verso
in

U .-' , ^ - . ? .

-> -

U
n
o
a
d
e
d
E
''w
\:W
I_2
_2u0
00C
H
ys
e
tim
2\oe
la
u0
3
te
2n
d
.ru
i.d
'iU
Un
n
ollla
ad
de
ed
dlE
E
:iW
N
iN
0
A
s\sysys
tec
n
3m
23
\m
fcn
7
'l
o
'
:
\
N
I
_
2
0
u
0
s
e
3
2
\
i
d
c
i
d
.
d
'
l
l
;i U
n
o
l
a
d
e
d
E
w
i
:
N
i
_
2
0
0
0
\
s
y
s
e
t
m
3
2
V
m
n
3
i
2
d
.
r
i
n
ole
adeth
drea
EW
t: N
I8_0
20Ca
ns\s<ise
tm
32\o
:.m
3lt:i2d
.ro
ide0(0x0).
;;U
T
h
2
te
i:d
Th
ep
o
rga
rd
m0x['2
72]hT
oo.e
lexxe
Nw
avtth
iie'ch
asexte
idwth
i code0(0x0).

'

* i

| I.

Ml lUrtelp
Reso^cce View Wir^oiiv
les Affected bv Resource Editing
d Fi
Resource Files __
Wot'kina with Resources
Creatinci a N^w Rescujice
Resource Editors
J Viewina Resources in a Resource EdiLL
j

jffl1 Propestiei Dynamic Help |

Ready

. 9 . 5 .

9.

259

4. Toolbar ( ),
IDR_TOOLBARI Properties (). Properties
().
5. ID ( )
Properties () IDR_TOOLBARI
IDRTOOLBAR.
6. Rectangle () Image
Editor ( ) .
7. Show Color Window (
). Colors
(), . 9.3 9.6.
8. Colors
().
9. Fill () Image Editor
( ),
, .
.
10. ID ( ) Properties () ID_SQUARE

( Prompt () ).
11. ,
Prompt () Properties ()
"Draw red square\nSquare". , . 9.6.
12. Menu () Resource View ( )
IDR_MAINFRAME.

.
13. View ().
14. "
", . .
15. "& Toolbar"
.
.
16. My Toolbar ( ), , ,
Toolbar ( ).

260

II.

,. Tool - Microsoft Visual [design] Toolrt (IDR tQOt8Mtl

File Edti Ve
i t Eroe
i ct BuJd Debug Toosl Wn
idow Hep
l
,
-'

^
.,

'
\

1 , . - 1!

Debug

^ ."

"

., , b . i '

. EDIT1

fi>

.!" C>

Tool.rc(IDR_T-ARl -Toolbar)' | < *

- _]
+
+

S L J

Tool.re
:_J Accelerator
j Dialoq
_ ] Icon
_J Menu.

_ J -nng Table
j Toolbar
alii IDR_MA!NFRAME [English
Ul IDR^TOOLBAR
+
I Version

("Toolbar Editor ICTBEd

_J

_ j

jDebug
" Unloaded 'E:\WIN_2n00\system32\ole32.dir
: Unloaded 'E:\WIN_20nCl\system32teleaut32.dir 1
i Unloaded 'E:\WlN_2O0O\si'Stem32\mfc70enu.dll
:
Unloaded 'E:iwiN_Z000\system32\indicdll.dir1
Unloaded t:\WINJ0OO\system32Vmm32.dll
l Unloaded 'E:\WIN_2000\systein32\comctl32.dir
: The thread 0x280 has exited with code 0 (0x0).
| The program '[272] Tool.exe: Native' has exited with code 0 (0x0).

ID.SQUARE
\
Prompt
J

6 : 1 Magnification

. 9 . 6 .
Colors

17. ID ( )
Properties () ID VIEW__MYTOOLBAR
File | Save All ( | )
Save All ( ) Standard
(). , ,
.
18. Prompt () Properties ()
"Show or hide the toolbar\nToggle ToolBar".
19. IDRTOOITYPE Resource View (
). .
20. , .. 1319, .
21. "
", . .

9.

261

22. "&Draw"
.
.
23. View () Window
().
24. "
", .
.
25. "&Square"
. .
26. ID ( )
Properties () ID_ SQUARE (
)
File | Save All ( | ) Save All
( ) Standard (). , , .
27. Prompt () Properties ()
"Draw red square\nSquare".
28. Class View ( )
CToolView.

29. Properties () Events ().


, .
30. ID_SQUARE
COMMAND. .
31. .
32. .. 30 31
UPDATE_COMMAND_UI .
33. Class View ( ) CMainFrame.
34. .. 29 32 ID_VIEW_MYTOOLBAR.
35. Properties () Messages (). , .
36. WM_CLOSE
.
37. Class View ( )
CMainFrame
Add | Add variable ( | ).
Add Member Variable Wizard ( ).
38. Variable type ( ) CTooiBar, Variable name ( -

262

II.
) _1 Finish
(). ,

CMainFrame.

39. MainFrm.h.
40. CMainFrame
void OnUpdateViewMytoolbar(CCmdOI *pCmdUI);

BOOL OnMyToolbarCheck(UINT nID) ;
41. MainFrm.cpp

ON_UPDATE_COMMAND_UI (ID_VIEW_MYTOOLBAR, OnUpdateViewMytoolbar)

ON_COMMAND_EX(ID_PROCESS_TOOLBAR, OnMyToolbarCheck)
42. Oncreate 9.1.
; 9.1. CMainFrame: :OnCreate

//
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
//
if (!m_wndToolBar.CreateEx(this, TBSTYLE^FLAT, WS_CHILD I
WS_VISIBLE I CBRS_TOP I CBRS_GRIPPER | CBRS_TOPLTIPS
CBRS_FLYBY I CBRS_SIZE_DYNAMIC) I I
!m_wndToolBar. LoadToolBar (IDRJ4AINFRAME) )
{
TRACEO("Failed to create toolbar\n");
return -1; //

//
if ( !m_MyToolBar.CreateEx(this, TBSTYLE^FLAT, WS_CHILD | WS__VISIBLE I
CBRS TOP | CBRS GRIPPER | CBRS TOOLTIPS I CBRS FLYBY I

9.
CBRS_SIZE_DYNAMIC) | | !m_MyToolBar.LoadToolBar(IDRJTOOLBAR))
{
TRACEO("Failed to create toolbar\n");
return -1; //

//
if (!m_wndStatusBar.Create(this)

I I

!m_wndStatusBar.Setlndicators(indicators,
sizeof(indicators)/sizeof(UINT) ) )
{
TRACEO("Failed to create status bar\n");
return -1;

//

//
SetWindowLong(m_MyToolBar.m_hWnd, GWL_ID, ID_VIEW_MYTOOLBAR)
//
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
m_MyToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar) ;
DockControlBar(sm_MyToolBar) ;
//
//
LoadBarState("Local AppWizard-Generated Applications");
return 0;

43. OnClose 9.2.


I 9.2. CMainFrame: :OnClose
// CMainFrame
//
void CMainFrame::OnClose(void)

263

264

II.

//
SaveBarState("Local AppWizard-Generated Applications");
CMDIFrameWnd::OnClose() ;

44.

OnUpdateMyTooibar 9.3.

| 9.3. CMainFrame: :OnUpdateViewMytoolbar


//
void CMainFrame::OnUpdateViewMytoolbar(CCmdUI *pCmdUI)
if (&m_MyToolBar != NULL)

//

//
//
pCmdUI->SetCheck((m_MyToolBar.GetStyle() & WSJVISIBLE) != 0) ,
return;

//

//
pCmdUI->ContinueRouting() ;

45.

9.4.

! 9.4. CMainFrame: :OnMyToolbarCheck


//
BOOL CMainFrame::OnMyToolbarCheck(UINT nID)
if (&m_MyToolBar != NULL)

//

ShowControlBar(&m_MyToolBar,
(m_MyToolBar.GetStyle() S WS_VISIBLE) == 0, FALSE);
return TRUE;
}
return FALSE;

9.

265

46. Class View ( )


CTooiview
Add | Add Variable ( | ).
Add Member Variable Wizard ( ).
47.
) booi,
)
ish ().
ToolAppView.cpp.

Variable type ( Variable name ( bDrawn Fin

48. onSquare 9.5.


j 9.5. C T o o l V i e w : :OnSquare
//
void CToolView::OnSquare(void)
{

CClientDC d c ( t h i s ) ;
CBrush
recffirush(RGB(255,0,0));
CPen
pen(PS_SOLID, 0, R G B ( 0 , 0 , 2 5 5 ) ) ;
CPen +
oldPen - dc.SeiectObject(&pen);
CBrush* oldBrush = dc.SeiectObject(SredBrush);
dc.Rectangle(20, 20, 120, 120);
dc.SeiectObject(oldBrush);
dc. SeiectObject. (oldPen) ;
bDrawn

= true;

49. onUpdateSquare 9.6.


j 9.6. CToolView: :OnUpdateSquare
//
+

void CToolView::OnUpdateSquare(CCmdUI pCmdUI)


f
pCmdUI-> Enable(!bDrawn);

50. onLButtonDown 9.7.

II.

266

! 9.7. CToolView: : OnLButtonDown


// CToolView
//
void CToolView::OnLButtonDown(UINT nFlags,

CPoint p o i n t )

{
bDrawn = false;
Invalidate () ;
CView::OnLButtonDown(nFlags,

point);

51. <F5> .
, . 9.7.

File Edit Ve
i w Draw Wn
i dow Help

. 9 . 7 . Tool
.

9.

267

52. Square () . , Square ()


.
53. . , Square ()
.
54. Draw | Square ( | ). , Square () .
55. Draw () , Square
() .
56.
. Square () , Draw () , . 9.8.

. 9.8. Tool

268

II.

57. View () My Toolbar (


). , . 9.9.

. 9.9. Tool

58. View () My Toolbar ( ).
.
59. , . 9.10.
60. .
.
,

, .
, Visual C++ ,
.

9.

269

. 9.10.

"Jj

Visual C++ 6.0 Visual C++ 7.0


, . (
). Visual C++ 7.0, Visual C++ 6.0,
,
.
CTooiBar
CMainFrame , , CTooiBar
.
,
.
, .
C M a i n F r a m e : : O n C r e a t e , . .

270

II.

, , , , .
.
CTooiBar: :CreateEx .
Windows ( )
CTooiBar.
CTooiBar: :LoadTooiBar, Windows, .

TRACEO, , Windows ,
.
1,
.
. .
. ,
.
.
setwindowLong, . ,
, ,
00000800.
,
, , ,
.
, , , .
ccontrolBar: :EnableDocking ,
.
. CFrameWnd: : EnableDocking,

.
ccontrolBar::EnableDocking.

9.

271

DockControiBar,
.
OnCreate CFrameWnd: : LoadBarState, ,
. ,
cwinApp: :SetRegistryKey,
CToolAppApp::Initlnstance.
CFrameWnd: : LoadBarState -

, CMainFrame Onciose, WM_CLOSE, ,

CFrameWnd: :saveBarstate,
, .

onUpdateMyTooibar

UPDATE_COMMAND_UI,
. ,
, , . , ccmdui: :Setcheck, .
, . cwnd: :Getstyle,
, W S V I S I B L E .
, ,
.
, ,
OnUpdateMyTooibar CCmdUI: : ContinueRouting,

,
,
.
OnMyTooibarCheck ,
.
, ,
. ,
OnUpdateMyTooibar,
, .

CFrameWnd::ShowControlBar, -

.
,
. ,
,
.

272

II.

onMyTooibarCheck TRUE,
FALSE.

CTooiAppview: :OnSquare ,
.
,
,
. onsquare . , , , ,
. bDrawn,

FALSE, TRUE.

onUpdateSquare . ccmdui: : Enable


bDrawn .
, . , , .

onLButtonDown, , bDrawn FALSE i n v a l i d a t e , , onDraw .


, MFC Application Wizard,
, , .
Microsoft , ,
. , , .
, Microsoft ,
, , Microsoft
, Windows.

9.

273

" ",
Microsoft,
, Visual C++.
. MFC , indicators.
. , Microsoft.
, Tool:
1. File | Open Solution ( | ) Open Solution ( )
Tool, Tool Open ().

I Resource Symbols
Name

.g^^^^
ID_SQUARE
ID_VIEW_MYTOOLBAR
IDD_ABOUTBOX
IDP_OLE_INIT_FAILED
IDR_MAINFRAME
IDR_TOOLBAR
IDR_ToolTYPE

xj

136 "
32771
134
100
100
128
132
129

In Use

Close
jjjew...

Delete
Change...

*>

~ Show read-only symbols


Used by:
-not used-

. 9.11. Resource Symbols

Help

II.

274

2. Resource View ( ),
Tool, Tool.rc Resource Symbols ( ). Resource Symbols ( ), . 9.11.
3. New (), New Symbol
( ), . 9.12.
_?

Value:

|
Cancel

jlOl

. 9.12. New Symbol


4. Name ()
ID_INDICATOR_X . .
5. ID_INDICATOR_Y Close () Resource Symbols
( ).
6. Tool.rc, String Table ( ). String Table (group)
[English (U.S.)]. .
7.
.
8. New String (
). .
9. .
, .
10. ID_INDICATOR_X,
. 9.13.
11.
Caption ()
"X".
12. .. 711
ID INDICATOR Y "Y".

9.

275

File Edit Veiw Proe


j ct Bud
li Cebug Toosl ijrdnn Hep
l
Local ApqaWizard-Generdted Apple
J J ' t 1. ,
<P t Cebug
L viavj,- Tool.re (String Table (group))*
_ J Tool re
JD
j y - L | crirn
+
J Accelerator
D
I _EDT
I_REPA
I CE
57641
Replace specific text with different text\nReplace
- _ J Dialog
D
I _EDT
I_SELECT_ALL 57642 Select the entire document\nSelect All
3 toD_ABOUTBO>! [English (I
D
I _EDT
I_UNDO
57643
Undo the last action'inUndo
D
I _ED1T_REDO
57644
Redo the previously undone action\nRedo
_ J Icon
1D_VE
IW_TOOB
I AR 59392 5how or hide the toolbar\nToggle ToolBar
- , j Menu
D
I _VE
I W 5TATUS_BAR 59393 Show or hide the status bar\nToggle StatusBar
Sj IDR_MAINFRAME [English
AFX_D
I S_SCSZ
IE
61184
Change the window size
Sj IDR.ToolTYPE [English (U.:
AFXD
IS_SCMOVE
61185
Change the window position
_JStrng
Table
AFX_D
I S_5CMN
IM
IZ
IE 61186 Reduce the window to an icon
be String Table (group) [Engli:
AFX_D
I S_SCMAXM
IZ
IE 61187 Enlarge the window to full size
+ _ j Toolbar
AFX_D
I S_SCNEXTWrIJ . 61188 Switchtothenext document window
AFX_D
I S_5CPREVWN
I ,. 61189 Switch to the previous document window
+
j Version
AFX_D
I 5_5CCLOSE
61190
Close the active window and prompts to save the documents
AFX_D
I S_SCRESTORE 61202 Restore the window to normal size
AFX_D
I S_3CTASkL
'S
I T 61203 Activate Task List
AFXJDSJ4DC
I HL
ID 61215 Activate this window
AFX_D
I S_PREVE
I W_C. 61445 Close print preview mode\nCancel Preview
' ID SQUARE
32771
Draw red square\nSquare
.11
ID INDICATOR_CAPS
ID INDICATOR_EXT
IDJNDICATOR_KANA
ID INDICATORJJUM
ID_INDICATOR_OVR
IDJMDICATOR REC
5tem32\mfc70?nu.dll'
ID INDICATOR SCRL
ystem32\ir>dicdll.dll'
ysteni32\imrri32.dir
/stem 32>comctl32. dH'
:ed with code 0(0x0),
The program '[1228] Tool.eve: Nahve' has exired wii"h code 0 ().

^ p - [string Editor IStrEd

ID INDICATOR
ID NEXT PANE

. 9 . 1 3 .

13. MainFrm.h
cstatusBar
m_wndstatusBar,- , .
p r o t e c t e d public.
14. MainFrm.cpp
i n d i c a t o r s :
static UINT indicators!] =
{

ID_SEPARATOR,

//

ID_INDICATOR__X,
ID INDICATOR Y,

15. Class View ( ) CToolview


Messages (). , .
16. WM_MOUSEMOVE
.

276

II.

17. Class View ( )


CToolView
Add | Add Variable ( | ).
Add Member Variable Wizard ( ).
18. Variable type ( ) cpoint, Variable name ( ) m Point Finish
().
19. ToolView.h
CToolView
.
//
protected:
DECLARE__MESSAGE_MAP ()

public:
afx_msg void OnLButtonDown(UINT nFlags,

CPoint p o i n t ) ;

void OnSquare(void);
void OnUpdateSquare(CCmdUI *pCmdUl);
afxjrisg void OnMouseMove (DINT nFlags, CPoint p o i n t ) ;
void OnUpdateXPanel(CCmdUI* pCmdUI);
void OnUpdateYPanel(CCmdUI* pCmdUI);

20. ToolView.cpp
CToolView
.
BEGIN_MESSAGE_MAP(CToolView, CView)
//
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ONJ2OMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
ON_VM_LBUTTONDOWN ()
ON_WM_MOUSEMOVE()
ON_COMMAND(ID_SQUARE, OnSquare)
ON_UPDATE__COMMAND_UI (IDJ5QUARE, OnUpdateSquare)
ON_UPDATE_COMMAND_UI (ID_INDICATOR_X, OnUpdateXPanel)
ON_UPDATE__COMMAND_UI (ID_INDICATOR_Y, OnUpdateYPanel)
END_MESSAGE_MAP ()
21. OnMouseMove 9.8.

9.
I 9.8. C T o o l V i e w : : OnMouseMove

277
I

//
void CToolView::OnMouseMove(UINT nFlags, CPoint point)
{

//
m_Point = p o i n t ;
CView::OnMouseMove(nFlags, p o i n t ) ;
}

22. OnMouseMove 9.9.


i 9.9.

II
void CToolView::OnUpdateXPanel(CCradUI* pCmdUI)
{
CString text;
text.Format("%d", m_Point.x);
pCmdUI->SetText(text);

//
void CToolView::OnUpdateYPanel(CCmdUI* pCmdUI)
{
CString text;
text.Format("%d", m_Point.y);
pCmdUI->SetText(text);

23. <F5> .
24. .
,
. 9.14.
CToolAppView: : OnMouseMove
. point
.
, m Point .

II.

278

lA-Tool-Tooll
File Edit View Draw Window Help

Ready

1187 =71

. 9 . 1 4 . ,

ON_UPDATE_COMMAND_UI. - ,
.
.
, , .
.

CToolView: :OnUpdateXPanel

CTooiview:: onUpdateYPanei

. c s t r i n g : : Format
,
m p o i n t , , ,
ccmdui: : setText, .

, I D _ I N D I C A T O R _ X
I D _ I N D I C A T O R _ Y
. ,
. . 9.14,
.

9.

279

Microsoft
:
. , , .

:
1. File | Open Solution ( | ) Open Solution ( )
Tool, Tool Open ().
2. MainFrm.cpp
CMainFrame: :OnCreate , 9.10.
I 9.10. CMainFrame: :OnCreate

//
i n t CMainFrame::OnCreate(LPCREATESTRUCT l p C r e a t e S t r u c t )
{

//
if (CMDIFrameWnd::OnCreate(lpCreateStruct)

== -1)

return - 1 ;
//
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD I WS_VISIBLE
CBRSJTOP |

CBRS_GRIPPER

CBRS_SIZE_DYNAMIC)

CBRS_TOOLTIPS

CBRS_FLYBY

!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))

TRACEO("Failed to create toolbar\n");


return - 1 ;

//

//
if (!m_MyToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD I WS_VISIBLE I
CBRSJTOP I CBRSJ3RIPPER I CBRS_TOOLTIPS I CBRS_FLYBY |
CBRS_SIZE_DYNAMIC) I I !m_MyToolBar.LoadToolBar(IDRJTOOLBAR))
{
TRACEO("Failed to create toolbar\n");
return -1; //
}
10 . 629

280

II.

II
if (!m_wndStatusBar.Create(this)

!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{

TRACEO("Failed to create status bar\n");


return - 1 ;

//

//
SetWindowLong(m_MyToolBar.m__hWnd, GWL_ID, ID_VIEW_MYTOOLBAR) ;
//
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
mJMyToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY) ,
DockControlBar(&m_wndToolBar);
DockControlBar(&m_MyToolBar);
//
//
LoadBarState("Local AppWizard-Generated Applications");
//

ra_wndStatusBar.SetPanelnf(m_wndStatusBar.CommandToIndex(ID_INDICATOR_X)
ID_INDICATOR_X, SBPS_NORMAL, 64);
m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(ID_INDICATOR_Y),
ID_INDICATOR_Y, SBPS^NORMAL, 64);
return 0;
}
3.


#inciude "Tooiview.h"

ToolAppView.cpp

linclude "MainFrm.h"

4.

9.11.

9.
I 9.11. CTooiview
//
void CTooiview::OnMouseMove(UINT nFlags, CPoint point)
{
//
CMainFrame* lpFrame = (CMainFrame*) GetParentOwner () ;
//
char szTemp[16];
sprintf(szTemp,"%d", point.x);
lpFrame-> m_wndStatusBar.SetPaneText(lpFrame->
m_wndStatusBar.CommandToIndex(ID_INDICATOR_X), szTemp);
sprintf(szTemp,"%d", point.y);
lpFrame-> m_wndStatusBar.SetPaneText(lpFrame->
m_wndStatusBar.CommandToIndex(ID_INDICATOR_Y), szTemp);
//
m_Point

= point;

CView::OnMouseMove(nFlags, point);

//
void CTooiview::OnUpdateXPanel(CCmdUI* pCmdUI)
{
CString t e x t ;
text.Format("%d", m P o i n t . x ) ;
//

pCmdUI->SetText(text) ;

//
void CTooiview::OnUpdateYPanel(CCmdUI* pCmdUI)
{
CString text;
text.Format("%d", m_Point.y);
// pCmdUI->SetText(text);

281
I

282

II.

5. <F5> .
, .
6. ,
X Y, . 9.15.

Tool-Tool 1
File Edit Ve
i w Draw Wn
i dow He!
[''GSOT#

Ready
. 9 . 1 5 .

7. .
,
. 9.16.
8.

.
CMainFrame: :OnCreate
, ,

c s t a t u s B a r : : Create ( )
cstatusBar. cstatusBar: : S e t i n d i c a t o r s
, ,

9.

283

, , , .
i n d i c a t o r s , .
OnCreate , 1.

jpi

UVTool- Tooll
' .'"'.>
File Edit View Draw Window Help

? '
."]v:.ss|jg

"

V ; ;
;

'..

"_:

"

' ' ' . "

1
*
i

,.

Ready

150

1 2 7

. 9.16. ,

c s t a t u s B a r : :SetPaneinfo
, . . ,
.
, .
,
,
CDC: :GetTextExtent,

284

II.

csize, . .
CToolAppview: :OnMouseMove.
cwnd: :GetParentOwner, ,
. .
cstatusBar: :SetPaneText, . , . CStatusBar: :CommandToIndex,
. . .
Microsoft ,
. ,
,
CToolView::OnUpdateXPanel CToolView::OnUpdateYPanel -

ccmdui: :SetText, .

10




Windows
MFC .
.

MFC Application Wizard*


Advanced Features
Specify additional support to build into your application.

Advanced features:

dumber of files on recent file list:

" Context-sensitive Help


Application Type
Compound Document Support
Document Template Strings
Database Support

Printing and print preview


Automation
P? ActiveX controls
MAPI (Messaging API)

User Interface Features

" Windows sockets

Advanced Feature

* Active Accessibility

Generated Classes

P? Common Control Manifest

Finish

Cancel

Help

. 1 0 . 1 . MFC Application Wizard - Print

, , Printing and
print preview ( ) Advanced Features
( ) MFC Application Wizard,

286

II.

. 10.1. . ,
" ", . .
.
, ,
.
, , ,
,
.
, , ,
, .


, .

, ,

.
,
, Print ,
. :
1. , 1 Print, MFC Application Wizard - Print
( MFC) Finish ().
2. , Generated Classes ( ), . 10.2.
3. Base class ( )
c s c r o i i v i e w Finish ().
4. Class View ( ). Print
() cPrintDoc.
5. Add | Add Variable
( | ). Add Member
Variable Wizard - Print ( ), . 10.3.
6. Variable type ( ) i n t , Variable name ( )
m_nRects Finish ().

PrintAppDoc.cpp.
7. S e r i a l i z e 10.1.

10.

287

Generated Classes
Review generated classes and specify base classes for your application.

. 1 0 . 2 . MFC AppWizard - Print

ill

Add Member Variable Wtoard - Print

Welcome to the Add Member Variable Wizard


This wizard adds a member variable to your class, struct; or union.
Access:
Variable type:
I trad
Variable name:

_J

Comment (// notation not required):

Finish

Cancel |

Help

. 1 0 . 3 . Add Member Variable Wizard - Print

288

II.

I 10.1. CPrintDoc: : Serialize

// CPrintDoc
void CPrintDoc::Serialize(CArchives ar)
{
if (ar.IsStoringO )
{
//
ar m_nRects;
}
else
{
//
ar mnRects;

8. Class View ( )
CPrintview
Properties (). Properties ().
9. Properties () Messages (). , .
10. WMLBUTTONDBLCLK
.
PrintView.cpp, .
11. onLButtonDbicik 10.2.
] 10.2. CPrintView: :OnLButtonDblClk
// CPrintView
//
void CPrintView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
CPrintDoc*

lpDoc = G e t D o c u m e n t ( ) ;

ASSERT_VALID(lpDoc);
lpDoc-> m _ n R e c t s + + ;
Invalidate () ;

10. 289
CScrollView::OnLButtonDblClk(nFlags, point);
}
12. OnDraw 10.3.
! 10.3. CPrintView: : OnDraw

// CPrintView
void CPrintView::OnDraw(CDC* pDC)
{
CPrintDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc) ;
//
CPen
pen(PS_SOLID, 0, RGB(0, 0, 0) ) ;
CPen*
oldPen = pDC-> SelectObject(&pen);
f o r ( i n t i=0; i < pDoc-> m_nRects; i
pDC-> Rectangle(50, 50+500*i, 250, 250+500*i);
pDC-> SelectObject(oldPen) ;
//
CSize ' docSize(300, 300 + 500*pDoc-> m_nRects);
CRect

rect;

GetClientRect(srect);
CSize

pageSize(rect.right, rect.bottom);

CSize

lineSize(0, 500);

SetScrollSizes(MM_TEXT, docSize, pageSize, lineSize)

13. <F5> .
14. .
, ,
. 10.4.
15. . .
16. . , , . 10.5.
,
, " ".

290

II.

. 1 0 . 4 .

File Edit View Window Help

Ready
. 1 0 . 5 .

10.

291

17. . , . 10.6. "


", .

IrV Print -Printl

Edit

View

Window Help

,..#

Ready
. 1 0 . 6 .

18. Save () . Save As ( ).


19. Save
().
20. Open () . Open ().
21.
Open (). ,
, , .
, . ,
, .

292

II.

, CPrintAppDoc: :Serialize, , ,
.
CPrintAppView: : OnLButtonDblClk -

.

cview: :GetDocument , , . .
mnRects, .
cwnd:.: invalidate,
.
onDraw.
, OnLButtonDblClk, , ,
. ,
oldPen. CDC: :Rectangle.
.

. csize.
docsize . , 50 .
pagesize .

. ,
C W n d : : G e t C l i e n t R e c t .

linesize .

.

cscroiiview: : setscroiisizes.
.
TEXT, , Y .

10.

293


GDI
- . . Windows
( ) , . , : ,
.
. 10.1.
10.1.

MM TEXT

MM

0.01

HIMETRIC

MM TWIPS

1/1440

MM

0.001

MM LOMETRIC

0.1

MM LOENGLISH

0.01

MM ISOTROPIC

(X=Y)

MM ANISOTROPIC

(X!=Y)

HIENGLISH

Windows . , X
, Y .
. . WMMOVE
CreateWindow,

MoveWindow,

GetCursorPos,

SetCursorPos,

GetWindowRect

windowFromPoint. createDC,
GDI .

294

II.


. , , .
Getwindowoc.
GDI, , .
.
.
GDI Getoc BeginPaint, ,
.

CWnd::ScreenToClient.

,
.
, .

, .
, ,
.



, MFC
, .
,
.
Print:
1. PrintApp.
2. <F5> .
3.
.
4. File | Print Preview ( | ). ,
. 10.7.

10.

295

J>r Print - Printl


File Edit Ve
i w Wn
i dow Hep
l
"f

. 10.7.
5. . .
6. . , ,
. 10.8.
7. . , . 10.9.
8. Zoom Out ().
, . 10.8.
9.

Zoom Out (), , Two Page ( ).

10. , . 10.10.
11. Close () .
12. PrintAppView.cpp.
13. OnDraw 10.4.

II.

296
liUPrint-Print!
File Edit Sew Window Help
Q

Zoom|n j Zoom Qu(

CTQS.^

Pagel

. 10.8.
Print- Print I

.JSliiJ

File Edit View JWndow Help

Pnnl

; Nexi Page

Zoom CM

_ _,'
Page 1

. 10.9.

10.

File Edit lew Window

' D
I

Pnnl _J fclexlPageJ

Page 1

. 1 0 . 1 0 .

{ 10.4. CPrintView: :OnDraw


// CPrintView
void CPrintView:rOnDraw(CDC* pDC)
f
CPrir.tDoc* pDoc = GetDocument () ;
ASSERT_VALID(pDoc);
//
CPen
pen(PS_SOLID, 0, RGB (0, 0, 0) ) ;
CPen*
oldPen = pDC-> SelectObject(Spen);
forfint i=0; i < pDoc-> m_nRects; i++)
pDC--> Rectangle (50, - 50-500*i, 250, -250-500*i)
pDC-> SelectObject(oldPen);
//

297

298
CSize
CRect

II.
docSize(300, 100 + 500*pDoc-> m_nRects);
rect;

GetClientRect(Srect);
CSize

pageSize{rect.right, rect.bottom);

CSize

lineSize(0, 500);

SetScrollSizes(MM_LOENGLISH, docSize, pageSize, lineSize);

14. , .. 24. , . 10.11.


UVPrint-Print I
Etle Edit Bew Wn
idow Hep
l
E
Hi

I If Fa .

| Iwo Page | Zoom In

'agel
. 1 0 . 1 1 .

15.
.
16. Two
Page ( ). . 10.12.
17. .

10.

299

- Print- Print I
File Edit View Window Help

D Eg

'

9
Prn
it Next Page j

~?oomn
I

__~XI
Cc
l

Page!
. 10.12.
. 10.7 10.11, MMLOENGLISH
_. ,
MMLOENGLISH ,
.
. 10.12. ,
Print , . . ,
, .
.


- ,
, . , -

300

II.

, .
Print :
1. Print.
2. PrintView.cpp.
3. onBeginPrinting 10.5.
j 10.5. CPrintView: :OnBeginPrinting

//
void CPrintView::OnBeginPrinting(CDC* pDC, CPrintlnfo* plnfo)
{

//
//
CPrintDoc* lpDoc = GetDocument();
ASSERT__VALID(lpDoc) ;
//
pInfo-> SetMaxPage((pDC-> GetDeviceCaps(LOGPIXELSY)+(1 + 5*lpDoc->
m__nRects) ) /pDC-> GetDeviceCaps (VERTRES) + 1) ;

4. <F5> .
5. ,
Two Page ( ). , . 10.13.
6. .
7. Class View ( ) CPrintView
Overrides ( )
Properties (). CPrintView.
8. onPrepareDC. .
9. .
CPrintView OnPrepareDC,
PrintView.cpp, .
10. OnPrepareDC 10.6.

10.

301

I/ Print - Print!

File Edit View Window Help


_ x
n

_J _Fre 4eJ Zoom In [

Pages 1-2

. 10.13.

| 10.6. CPrintView: :OnPrepareDC


//
void CPrintView::OnPrepareDC(CDC* pDC, CPrintlnfo* plnfo)
{
if(pDC-> IsPrintingO)
{
//
ASSERT(m_nMapMode > 0);
//
pDC->SetMapMode(m_nMapMode); //
//
pDC-> SetViewportOrg(0, -pDC-> GetDeviceCaps(VERTRES)*
(p!nfo->ra_nCurPage 1));

II.

302

II
CView::OnPrepareDC(pDC,

plnfo);

else
//

CScrollView::OnPrepareDC(pDC,

plnfo);

11. , .. 4 5. , . 10.14.

. 1 0 . 1 4 . 10.6

12. .
13. Class View ( ) cprintview
Overrides ( )
Properties (). cprintview.

10.

303

14. OnPrepareDC.
.
15. (
<Delete>). OnPrepareDC
CPrintView.

Visual C++ 7.0


. Visual C++ 6.0 ,
.
16. Properties () onPrint
CPrintView .
17. PrintView.cpp OnPrint
10.7.
I 10.7. C P r i n t V i e w : : O n P r i n t

//
void CPrintView::OnPrint(CDC* pDC, CPrintlnfo* plnfo)
{
LOGFONT

logFont;

CFont

font;

CString

Out;

// LOGFONT
logFont.IfHeight
logFont.IfWidth

= 24;
= 0;

logFont.IfEscapement

= 0;

logFont.lfOrientation

= 0;

logFont. If Weight

= FW_NORMAL;

logFont.IfItalic

= 0;

logFont.IfUnderline

= 0;

logFont.IfStrikeOut
logFont.lfCharSet

= 0;
= ANSI_CHARSET;

logFont.lfOutPrecision

= OUT_DEFAULT_PRECIS;

logFont. l f C l i p P r e c i s i o n
logFont.lfQuality

= CLIP_DEFAULT__PRECIS;

= PROOF_QUALITY;

logFont.lfPitchAndFamily
strcpy(logFont.IfFaceName,

= VARIABLE_PITCH
"MS Sans S e r i f " ) ;

FF_ROMAN;

304

II.

II
font.CreateFontIndirect(slogFont);
//
CFont* oldFont = pDC-> SelectObject(sfont);
//
sprintf(Out.GetBuffer(16)," %d", pInfo-> m_nCurPage);
Out.ReleaseBuffer();
//
pDC-> SetViewportOrg(0, ( (pInfo-> m__rectDraw.top + 50)*pDC->
GetDeviceCaps(LOGPIXELSY))/100 - pDC->
GetDeviceCaps(VERTRES)*(pInfo->m_nCurPage - 1));
//
CScrollView::OnPrint(pDC, plnfo);
//
CBrush wtBrush(RGB(255, 255, 255));
CRect rect = plnfo-> m_rectDraw;
rect.bottom = pInfo-> m_rectDraw.bottom*(plnfo->m_nCurPage 1);
rect.top = rect.bottom + 60;
pDC-> FillRect(rect, SwtBrush);
//
pDC-> TextOut(0, rect.bottom + 36, Out);
pDC-> SelectObject(oldFont);

18. OnBeginPrinting 10.8.


| 10.8. CPrintView: : OnBeginPrinting
//
void CPrintView::OnBeginPrinting(CDC* pDC, CPrintlnfo* plnfo)
//
//

10.

305

CPrintDoc* lpDoc = GetDocument{);


ASSERT_VALID(lpDoc) ;
//
pInfo-> SetMaxPage((pDC-> GetDeviceCaps(LOGPIXELSY)*(1 + 5*lpDoc->
m__nRects) )/ (pDC-> GetDeviceCaps (VERTRES) - 50) + 1);

19. , .. 4 5. , . 10.15.
rA-Print-Print 1
File Edit View Window Help

D &
PPrintl

-"
Zoomln

Pages 1-2
. 10.15.

20. Print () .
Print (), . 10.16.
21. . .
22. .

II.

306

Printer
Name ^ ^ ! H
Status Ready
Type' Windows NT Fan Driver
Where. MSFAX
Comment.
Print range
All
r

Properties... j

H H E L I

;
Print to fi]e
Copies
N umbel of copies

Pages from fi

to |
_

11

I
I
I
J l J j ^ _
OK

' :

Cancel |

. 10.16. Print
, , .
onBeginPrinting, MFC Application
Wizard .
,
:
void CPrintView::OnBeginPrinting(CDC* /*pDC*/, CPrintlnfo* /*plnfo*/)
, ,
, .
,
, . , , .

OnPreparePrinting. OnBeginPrinting .
C P r i n t l n f o : :SetMaxPage, .
CDC: : GetDeviceCaps,
.
LOGPIXELSY .

10.

307

MMLOENGLISH,
0,01 ,
,
100. . VERTRES CDC: :GetDeviceCaps .
,
,
.
, , .

, , . 10.13, .
,
. onPrepareoc.
,
, , , .
CDC: : i s P r i n t i n g , ,
CDC .
.
CDC: : i s P r i n t i n g .
cscroiiview: :OnPrepareoc , , , , , ,
, , ,
. , , cPrintAppView: :OnPrepareDC , cscroiiview: :OnPrepareDC,
CView::OnPrepareDC.

CDC: :setMapMode ,
.
cscroiiview: :m_nMapMode, .
CDC: :Setviewportorg
. , , GDI , , , setwindowOrg.

, . , -

308

II.

.

. CDC: :GetDeviceCaps VERTRES,
,
C P r i n t i n f o : :m_nCurPage, . cview: :OnPrepareDC, .
. 10.14,

.

.

. , WYSIWYG ( , ).
. ,
onPrint.
, , .
.
onDraw,
.
OnDraw.

MSDN, , , m rectDraw, CPrintinfo. ,


. ,
m_rectDraw. OnPrint , .
- onPrepareDC,
CDC: : s t a r t P a g e . .
OnPrint.

OnPrint CFont: :CreateFontIndirect


CFont.
TextApp 6.
.
c s t r i n g -

10.

309

. -. :Setviewportorg. , , top CRect, CPrintinfo: :m_rectDraw.


, , 50 , ( ). c s c r o i i v i e w : :OnPrint,
. , (. 6).
, . , ,
C P r i n t i n f o : :m_rectDraw,
, . ,
. ,

. .
onPrepareDC ,
,
O n P r i n t .


MFC
MFC .
Print (),
CDC: :StartDoc.
CDC: :StartPage , CDC: :EndPage.

,
CDC: :Escape .
C D C : : E n d D o c .

cview , . -

310

'

II.

. . 10.2 , .
10.2. cview,

OnPreparePrinting

Print ()

OnBeginPrinting

GDI,

OnPrepareDC

OnPrint
OnEndPrinting


GDI,

,

.
:
OnPreparePrinting , ,
, Print (), , ,
, ;
OnBeginPrinting , , , , GDI,
;
CDC: :startDoc,
,
s t a r t P a g e EndPage ,
EndDoc;
OnPrepareDC ,

.
, , ;
CDC: : s t a r t P a g e
;

10.

311

OnPrint , .
onDraw,
OnPrint;
CDC: :EndPage, ,
.
onPrepareoc ;
CDC :: , , startDoc;
OnEndPrinting , GDI,
OnBeginPrinting.
,
CPrintinfo.
. CPrintinfo
. 10.3.
10.3. CPrintinfo,

GetMinPage/SetMinPage

GetMaxPage/SetMaxPage

GetFromPage

GetToPage

mnCurPage

1, . . 1, 0.

onPreparePrinting , CPrintinfo. MFC Application Wizard
OnPreparePrinting, CView: : DoPreparePrinting. DoPreparePrinting Print () .
, .
1,
OxFFFF. ,
OnPreparePrinting
CPrintinfo: :SetMaxPage , DoPreparePrinting.
11 . 629

312

II.

Print () .
DoPreparePrinting Print ().
cPrintinfo
. ,
Print (). CPrintinfo: :GetFromPage
CPrintinfo: :GetToPage. , GetMinPage GetMaxPage
.

: onPrepareoc onPrint.
:
CPrintinfo. ,
onPrepareDC onPrint,
CPrintinfo: :m_nCurPage, .
, ,
.
onPrepareDC .
,
. OnPrepareDC
, : -, CDC
, , -,
CPrintinfo. (
NULL OnPrepareDC
.) OnPrepareDC ,
. ,
.
OnPrint . onPrint CDC CPrintinfo. OnPrint
onDraw. OnPrint
, . , .

OnDraw , , .
, OnDraw ,
, ,
WYSIWYG ( , ).
, OnDraw , . Microsoft

10.

313

onPrint, . .
,
.

. .
. , , ,
.
.
1 20 6 10.
c p r i n t i n f o .
onPrepareDC onPrint

onPreparePrinting . (
), . , . , OnPreparePrinting
,
,
C P r i n t l n f o : : SetMaxPage. OnPrepareDC,
mnCurPage , .

. , ,
WYSIWYG
.
OnPreparePrinting ,
CPrintlnfo: :SetMaxPage .
, ,
.
.
OnPrepareDC
. CPrintlnfo: :m_bContinuePrinting.
TRUE, . FALSE, TO
. OnPrepareDC
m_bContinuePrinting FALSE, 1. , , ,
, .

III

VISUAL C++

11. , Visual C++


12. Windows
13.
14.
15.
16. Internet

11

,

Visual C++
Microsoft Visual C + + .
, , , .


Windows , . , , ,
, .
,
. ,
MFC, .
.
Visual C + + :
t r y , ;
catch,
t r y , ,
;
throw
catch.
catch, MFC,
.
,
:
//
try

318

III. Visual C++

throw;

//

//
catch (. . .)

try . if . , throw
catch, .
try, catch .
try , throw,
try, throw
return try
catch. throw try
, , try, , ,
try.
.
try, .


,
, . catch
, catch.
,
. catch
, , .
,
,
, 11.1.

11. , Visual C++


\ 11.1.
II
class MyException
{
protected:
UINT nIDSError;
public:
MyException(int nErr) ( nIDSError = nErr;};
-MyException() {};
void

Error_Put();

//
void MyException::Error Put()

CString
buf;
VERIFY(buf.LoadString(nlDSError)) ;
::MessageBox(0, buf, "Error", MB_OK I MB_SYSTEMMODAL) ,

//
int SomeFunc()
{
int* aBuffer;
try
{
if((aBuffer = new int[1024]) == NULL)
{
MyException* me = new MyException(ID_MEMORY)
throw me;
}
else
delete aBuffer;

319
!

320

III. Visual C++

catch(MyException* me)
{

me-> E r r o r P u t ( ) ;

11.1 MyException, niDSError, ,


, ErrorPut,
. niDSError . ErrorPut cstring: :Loadstring
. MessageBox
. .
MFC .

MFC, try.
MFC throw, try. , cstring: :Loadstring ,
CMemoryException. ,
try
. .
, throw
return
, ,
, , , ,
, .
,
, . - , ,
. , ,
.

Visual C++
Visual C++ :
, C++.
MFC 3.0 ;
, MFC.

11. , Visual C++

321

, MFC,
C++.
, .
, , C++. .
:
1. Class View ( ) Solution Explorer ( ), ,
, View | Property
Pages ( | ). Print Property
Pages ( ), . 11.1.

_*]

Print Property Pages


Configuration: ()
63 Configuration Properties
%> General
Debug
D C/C++
Q Linker
C".\ Resources

. 3 Platform; (Active(Win32)
'B 'imr; ,ii
! Intermediate Directory
| Extensions to Delete on Clean
Output Directory
Hro)ect Defaults

CJMIDL

f~\ Browse Information


CJ Build Events
GJ Custom Build Step
Q SDL Import

i
!
|
!
j

Build Browser Information


Configuration Type
Use of ATL
Minimize CRT Use in ATL
Use of MFC
Use Managed Extensions
Character Set

Configuration Manager

Debug
*.obj;*.ilk;*.pdb;*.tlb;*,tli;*.tlh;$(TargetName)
Debug
| No
No
Application (.exe)
Not Using ATL
No
Use MFC in a Shared DLL
No
Use Multi-Byte Character Set

l Whole Program Optimization


I Specifies that the program will be optimized across .obj boundaries; works best if
i C/C++ optimizations are turned on,

OK

Cancel

Help

. 11.1. Print Property Pages


2. C/C++, Code Generation ( ).
3. , Enable C++ Exceptions
( C++) , "Yes (/EHsc)",
. , Print Property Pages (
) .

III. Visual C++

322

4. . .
5. "Yes (/EHsc)".
Print Property Pages ( ) , . 11.2.

xj

1 Print Property Pages


Configuration: [Active(Debug)
2J Pa
l tform |Acrvie^Wn
i 32)
_^J
Cgnfg
i urato
i n Manager
al Configuration Properties ; Smae
l r Type Check
No
General
\ Ful Runm
ti e Checks
Yes(/RTC1)
Debug
Enable C++ Excepto
i ns
| Yes (/EHsc)
6 c/c++
j Check for Uninitialized Vara
i be
l s No
General
j Runm
ti e Library
Multi-threaded Debug DLL (,/MDd)
Optimization
Bufer Securtiy Check
No
Preprocessor
; Struct Member Ag
il nment
Default
sj* Code Generatio ; Enabe
l String Poon
il g
No
Language
j Check Stack Frames
No
Precompe
li d Hei ! Enabe
l Functo
i n-Level Ln
i kn
i g No
Output Files
l Mn
im
i al Rebud
li
Yes (/Gm)
Browse Inforrna j Enabe
Advanced
Command Line
Linker
f_j Resources

'

QNIIDL

C J Browse Information
f_| Build Events
"

i -

1
j
J

L
Enable C++ Exceptions
Casl destructors for automatc
i obe
j cts durn
i g a stack unwn
i d caused by an excepto
in
ben
i g thrown. Incompatb
ie
l with the use of managed C++ extenso
i ns (/EHsc) j
OK J Cancel J

Hep
l |

. 11.2. Print Project Settings, C/C++


6.

.
) .

Print

Property

Pages


:
:
. ,
. . .
. , , , , , ;

11. , Visual C++

323

:
.
, ASSERT;
:

, . ,
/ . .
.
C++
MFC CException
. MFC , :
CMemoryException ;
CFiieException , ;
CArchiveException , Serialize;
CNotSupportedException ,
;
CResourceException , ;
CDaoException , ( DAO);
CDBException , ( ODBC);
coieException , OLE;
coieDispatchException , ;
cuserException ,
CException.
catch
, MFC , , CException.
, MFC,
catch
CException ( , CException,
, CMemoryException).
, .
, CFiieException mcause,
.

324

III. Visual C++

CFileException::fileNotFound CFileException::readonly.

.
try
{
// ,
// .

// CFileException
catch(CFileException* theException)
{
if(theException->m_cause == CFileException::fileNotFound)
TRACE("File not found\n");
theException->Delete() ;


, "" . catch :
catch . , . .
catch(CException* e)
{

if

(m_bThrowExceptionAgain)
throw; //

catch .
CException
Delete , delete,
.
, try.
, , try. , , catch.
, try
, -

11. , Visual C++

325

catch. t r y catch, .
//
try
{
// ,

//
catch(CException* e)
{
// .
// "" .
e->Delete();
}
//

catch,
, . catch, , .
, CException* catch ( . . . ) . catch
.
catch.
try

// ,
// .
}
catch(CFileException* e)
{
// .
)
catch(CMemoryException* e)
{
// .

326

III. Visual C++

catch(CException* e)
{
// .



. .
:
, ;
catch ,
.
,
:
void SomeFuncO //
{
CSomeClass* Local = new CSomeClass;
// ,
// .
Local-> OtherFpnc() ;
// .
delete Local;

Local
someFunc. ,
,
.
, ,
. ""
.
,
"" .
void SomeFuncO
{

CSomeClass* Local = new CSomeClass;

11. , Visual C++

327

try
{
// ,
// .
Local-> OtherFunc() ;
}
catch(CException* e)
{
//
e-> Delete();

// ,
delete Local;

.
, , , .

(, ,
), .
catch
, , . .
void SomeFunc()
{
CSomeClass* Locale = new CSomeClass;

try
{
// ,
// .
Locale->SomeFunc();
}
catch(CException e)
{
// .
delete Locale;

328

III. Visual C++


// ,
throw;

//
// ,
delete Locale;

,
.


, MFC . .
AfxThrowMemoryException . someFunc :
void SomeFunc()
{

char* s z F i r s t = new char[ 128 ];


i f ( s z F i r s t = NULL)
AfxThrowMemoryException() ;
char* szSecond = new chart 1024 ];
if(szSecond = NULL)
.

delete s z F i r s t ; //
AfxThrowMemoryException();

//
delete szFirst;
delete szSecond;

, , , , , -

11. , Visual C++

329

. , .

MFC, .
, .
#include "mmsystem.h"
#define WAVE__ERROR -5
void Play(CString Name)
{
// Win32 API ,
// .
// .
if(!sndPlaySound(Name, SND_ASYNC))
throw WAVE ERROR;

, MFC, , CException ( ).
MFC .


C++
MFC 3.0
C++. MFC CATCH, . . C++ .
,
. .
TRY
{
THROW((CException*)

new C C u s t o m E x c e p t i o n f ) ) ;

CATCH(CCustomException, e)
{

TRACE(" MFC 2.x \");


}
AND_CATCH(CException, e)

330

III. Visual C++

TRACE(" MFC 3.0 \");


}
END_CATCH

3.0,
catch, .
THROW((CException*)new CCustomException());
CException*, ,
CCustomException. CATCH MFC 2.5 cobject: :isKindOf
.
e->IsKindOf(RUNTIME_CLASS(CException))
, CATCH . 3.0,
C++ , CATCH, CException.
.
, , CException*, ,
.
throw , .
catch , .
, 3.0 .
TRY
{
// ,
// .
}
CATCH(CSomeException, e)
{
THROW();
}
END_TRY

// . THROW_LAST()

THROW , -

11. , Visual C++

331

.
THROW_LAST.

C++ ( , MFC , C++), ,
. C++ , :
, C++ ,
;
C++
,
(int, float, char . .),
CException
.
C++,
, , ,
. C++ , .
,
C++. .
.
CATCH :
CATCH(exception_class, exception_object_pointer_name)

.
catch :
catch(exception_type exception_name)


.
.
CATCH ( ),
AND_CATCH, END_CATCH.
C++
catch ( ).
END_CATCH . catch
.

332

III. Visual C++

.
THROW_LAST. throw .
, , , C++:
1. MFC, TRY,
CATCH, AND_CATCH, END_CATCH, THROW THROW_LAST.

2. :
TRY try;
CATCH catch;
AND_CATCH catch;
END_CATCH;
THROW throw;
THROW_LAST throw;
3. , . ,
CATCH(CException, e)

catch(CException* e)
4. , .
, .

TRY
{
// ,
}
CATCH(CException, e)
{
if (m_bPassExceptionsUp)
THROW_LAST();
if (m_bReturnFroinThisFunction)
return;
//
}
END CATCH

11. , Visual C++

333

:
try

// ,
}
catch(CException* e)
{
if (m_bPassExceptionsUp)
throw;
if (m_bThrowDifferentException)
{
e->Delete() ;
throw new CMyOtherException;
}
if (m_bReturnFromThisFunction)
{
e->Delete();
return;
}
e->Delete();


C++

C++. , ,

, C++ .
"" , , .
.

TRY
{
TRY
{
// ,
// .

334

III. Visual C++

)
CATCH(CException, e)

// "" catch

{
throw;

//
// catch,

}
END_CATCH
}
CATCH(CException, e) // "" catch
{
// ,
// catch.
}
END_CATCH
,
"" CATCH. THROWLAST throw "" CATCH .
TRY

TRY
// ,
// .
}
CATCH(CException, e) // "" catch
{
THROW_LAST();

//
// catch.

}
END_CATCH
)
CATCH(CException, e) // "" catch
{
// ,
// THROW_LAST() .
}
END CATCH

11. , Visual C++

335

try,
CATCH.
.

TRY
{
// ,
// .
}
CATCH(CException, e)
{
try
{
throw; // .
// ( )
)
catch(CException exception)

END CATCH


, ,

. , , . , ,
.
, .
,
ISO WG21/ANSI X3J16.
template.
template, , .
template < [typelist] [, [ arglist ]] > declaration

template (
c l a s s i d e n t i f i e r typename i d e n t i f i e r ) , -

336

III. Visual C++

. declaration .
, ,
, template. .
// ,
template <class Type, int n> class Demo
{
public:
Type

buffer[n];

Type

Some Func(int);

// ,
template <class Type, int n>
Type Demo<Type,i>::Some_Func(int i)
{
return

buffer[i];

,
, .
Demo<int, 12> Classlnst;



.
,
, , ,
.
, ,
, , .
//
int max(int a, int b)

11. , Visual C++

337

return (a > b) ? : b;

//
s h o r t max(short a,

s h o r t b)

return (a > b) ? a : b;

//
float max(float a, float b)
{
return (a > b) ? a : b;
}

// . ....

, .
template <class Type> Type max(Type a, Type b)
{
return ( > b) ? : b;
}

.
,
:
.
, ;
,
;
.
, ,
,
.
,
. , ,
d e f i n e max ( i , j)

( ( (i) > (j))

? (i)

(j))

338

III. Visual C++

:
template<class Type>
Type max (Type i, Type j)
{
return ((i > j) ? i : j)
}
:
.
;
i j . , , , ;
,
, .
,
.
, void,
,
, . , , ,
.
,
.
, .
,
, , , .
, ,
, .
,
,
.


,
, , . :
template <class Type>
void Swaplt(Types x, Types y)

11. , Visual C++

339

;
= ;
= ;
b = ;
}

.
,
int long, , . swapit , ,
, , ,
.
, , , .
, ,
. :
int i, j;
char k;
Swapit(i, j); // OK
Swapit(i, k);

// .

. :
template<class Type>
void SomeFunc(Type)

}
void OtherFunc(short k)
{
SomeFunc<long>(k);

// SomeFunc(long)

. , short, long.
Visual C++ 5.0 . :
template<class Type> void Some_Func(Type v)

III. Visual C++

340

// char Some_Func:
templateo

void Some_Func<char>(char v)

// double : Some_Func:
templateo
void Some_Func(double v)

:
// char : Some_Func:
void Some Func(char)

, ,
, . ,
. , .
,
, .
template<class Type>
void SomeFunc(Type, int)

int i;
char c;
SomeFunc(i, c);
i , int.

11. , Visual C++

341


,
, ,
.
:
template <class Type, int n>
class Some_Class
{
public:
Some_Class(void);
~Some_Class(void) ;
void Some_Func(Type*);
private:
Type

array[n];

,
, . , . . ,
, , .
, ,
, . ,
some_Func, , :
template <class Type, int n>
void Some_Class< Type, n >::Some_Func(Type* a)
{
f o r ( i n t i=0; i < n;
array [i] = a [ i ] ;

,
.
template <class Type, int n>
Some_Class< Type, n >::Some_Class(void)
{
//

342

III. Visual C++

)
template <class Type, int n>
Some_Class< Type, n >::~Some_Class(void)
{
//

,

. TempClass :
Some_Class< float, 6 > First;
// OK
Some_Class< char, items++ > Second;

// ,
// .

( ) , . , ,
. , .
, .
Visual C++ 5.0
. :
template<class Type>
class Some Class

// int Some_Class
templateo class Some_Class<int>

:
// char Some_Class
class Some Class<char>

11. , Visual C++

343


(<>).
, , >> ->. ,
Some_Class< f l o a t , a > ? : >

X;


Some_Class< f l o a t , (a > b ? : b) >

X;

, ,
.
, , , , . , ,
.
,
.
,
, . , some_ciass ,
.
Template

class Some_Class<int, 6>;

,

.

, .
Template Some_Class <int, >::Some_Class (void);
extern
. :
extern template class Some_Class<int, 6>;
,
:
extern template Some_Class<int, >:: Some_Class(void) ;
extern , . ,
, .
12 . 629

344

III. Visual C++


MFC
. :
, ;
, .

, MFC, 1.0.


" . .
MFC : ,
( ).
, .
.

, , . , .
,
. .

,
.
.

( )

.
,
, , MFC , . . 11.1 .
11.1. ,

CArray

CList

CMap

11. , Visual C++

345

11.1 ()

CTypedPtrArray

CTypedPtrList

CtypedPtrMap

, ,
, . . 11.2
, .
11.2. ,

CObArray

CObList

CByteArray

CPtrList

CMapPtrToPtr

CDWordArray

CStringList

CMapStringToOb

CMapPt'rToWord

CPtrArray

CMapStringToPtr

CStringArray

CMapStringToString

CWordArray

CMapWordToOb

CUIntArray

CMapWordToPtr


.
:
,
, .
. 11.3;
C++;
;
;
.
11.3 :
2 3 .
;
4 5
.
.

III. Visual C++

346

11.3.

. 11.4 , MFC.
11.4.

C++

'

'

CByteArray

CDWordArray

CList

'

'

CMapPtrToPtr

CMapPtrToWord

CMapStringToOb

CMapStringToPtr

CMapStringToString

CMapWordToOb

CMapWordToPtr

CObArray

CObList

CPtrArray

CPtrList

CStringArray

CStringList

CTypedPtrArray

11. , Visual C++

347

11.4 ()

C++

CTypedPtrList

CTypedPtrMap

CUIntArray

CWordArray


S e r i a l i z e .
Dump.
c o l i o b j dmp << c o l i o b j .

. , c o b A r r a y ,
. C P t r A r r a y ,
. , " P t r " .

"" , , ,
. , , C B y t e A r r a y ,
, .

,
, , MFC 3.0 . , ,
.
cobject, , cobject.

,
, , MFC. ,
c p t r L i s t CPtrArray.
,
.
,
, ,
.

348

III. Visual C++

CList : TYPE
ARGTYPE. , , TYPE:
C + + , i n t , char f l o a t ;
C + + ;
, .
ARGTYPE .
ARGTYPE , TYPE. :
CArray<short, short>

Some_Array;

CList<CSomej;lass, CSome_Class&>

Some_List;

Some_Array,
s o m e L i s t , csome_ciass.
,
ARG_TYPE. CArray: :Add.
CArray<int, int>

Some_Array;

Some_Array.Add(5);

: KEY, ARG_KEY,
VALUE ARG_VALUE.
. ,
, . KEY
,
. KEY ,
ARGKEY , KEY. VALUE , .
VALUE , ARG_VALUE
, VALUE. :
< int, int, SOME_STRUCT, SOME_STRUCT& > First_Map;
CMap< CString, LPCSTR, CMyClass, CMyClass > Second_Map;
F i r s t M a p
SOME_STRUCT, .
SecondMap CMyClass,
,
c s t r i n g , ,
, . ,
.
KEY c s t r i n g , ARG_KEY
LPCSTR, TO

11. , Visual C++

349

c s t r i n g , , setAt
LPCSTR, :
< CString, LPCSTR, CMyClass, CMyClass& > Second_Map;
CMyClass person;
LPCSTR lpstrName = "";
Second_Map.SetAt(lpstrName, person);
,
, , ,
, ,
.
CTypedPtrArray
CTypedPtrList : BASE_CLASS TYPE.
, , TYPE. , . BASECLASS.
cptrArray,
cobList c p t r L i s t . , cobList, ,
,
. . :
CTypedPtrArray<CObArray, CMyClass*> myArray;
CTypedPtrList<CPtrList, MY_STRUCT*> myList;
myArray cobArray.
CMyClass (,
CMyClass cobject). cobArray GetAt ElementAt, , [ ], .
myList,
c p t r L i s t .
MYSTROCT. , c p t r L i s t , , cobject. CTypedPtrList , : GetHead, GetTail, RemoveHead, RemoveTail,
GetNext, GetPrev GetAt.

CTypedPtrMap : BASE_CLASS,. KEY VALUE. BASE_CLASS -

: CMapPtrToWord, CMapPtrToPtr, CMapStringToPtr,


CMapWordToPtr, CMapstringToOb . . KEY KEY
: ,

III. Visual C++

350

. VALUE VALUE
: , . :
CTypedPtrMap<CMapPtrToPtr, CString, MY__STRUCT*> myPtrMap;
CTypedPtrMap<CMapStringToOb, CString, CMyObject*> myObjectMap;
, CMapPtrToPtr,
c s t r i n g MY_STRUCT.
Lookup,
. [] , . GetNextAssoc, .
, CMapstringToOb,
c s t r i n g CMyobject.
, .
,
,
.
CArray, CList ,
. , .
constructEiements DestructEiements
. . 11.5 , .
11.5.

ConstructEiements DestructEiements

ConstructEiements

CArray::SetSize
CArray::InsertAt

CList: AddHead
CList: AddTail
CList: InsertBefore
CList: InsertAfter
CMap::operator [

DestructEiements

CArray::SetSize
CArray::RemoveAt
CList::RemoveAll
CMap::RemoveAll

CList: ReraoveHead
CList: RemoveTail
CList: RemoveAt
CMap::RemoveKey

, .
constructEiements ,
, . DestructEiements .

11. , Visual C++

351

constructElements , (
)
. DestructEiements ,
, , . constructElements .
class CMyClass : public CObject

CArray< CMyClass, CMyClasss >

Some_Array;

template <>
void AFXAPI ConstructElements <CMyClass> (CMyClass* pNewElements, int
nCount)
{
for (int i = 0; i < nCount; i++, pNewElements++)
{
// CMyClass
new(pNewElements)CMyClass;

CMyClass .
CMyClass , new.
CArray, CList SerializeElements .
SerializeElements
.
cobject IMPLEMENT_SERIAL, TO :
c l a s s CMyClass : p u b l i c CObject

CArray< CMyClass, CMyClass , > Some Array;

352

III. Visual C++

template <> void AFXAPI ConstructElements <CMyClass> (CArchiveS, ar,


CMyClass* pNewElements, i n t nCount)
{

for (int i = 0; i < nCount; i++, pNewElements++)


{

// CMyClass
pNewElements->Serialize(ar);

,
MFC , , . , cobject*, UINT, DWORD
cstring. ,
, cobject ( cobList). , MFC
, UINT (void*).
, :
;
.
,
.
, cwordArray, .
, cwordArray 32- . .
cobList cobject.
. ,
cobList csomeciass,
csomeciass*.
:
class CSomeClass : public CObject

CSomeClass* lpObject = new CSomeClass(


CObList myList;

11. , Visual C++

353

myList.AddHead(lpObject);
//
CSomeClass* lpOtherObject = (CSomeClass*)myList.GetHead();


. , .

, .

.
, cobList , CSomeClass,
AddHeadPerson GetHeadPerson, .
class CSomeClassList : public CObList
{
public:
void AddHeadElement(CSomeClass* element) (AddHead(element);}
const CSomeClass* GetHeadElement()

{return (CSomeClass*)GetHead();}

CSomeClass.
, .


, MFC, , , . POSITION .
,
. .
,
.

354

III. Visual C++

GetAt.
.
CTypedPtrArray<CObArray, CSomeClass*> Some_Array;
for(int i = 0; i < Some_Array.GetSize() ; i
CSomeClass*

lpElement = Some_Array.GetAt(i);

csomeciass.
, .
GetAt csomeciass.
CTypedPtrArray [], . , :
CSomeClass* lpElement = Some_Array[ i ];
const, . const, ,
.
GetHeadPosition GetNext.
:
CTypedPtrList<CObList,

CSomeClass*>

Some_List;

POSITION

pos = Some_List.GetHeadPosition();

while(pos

!= NULL)

{
CSomeClass*

lpElement

= Some_List.GetNext(pos);

csomeciass.
, , cobList.
GetNext csomeciass.

G e t s t a r t P o s i t i o n ,
GetNextAssoc . :
CMap<CString, LPCTSTR, CSomeClass*, CSomeClass*> Some_Map;
POSITION pos = Some_Map.GetStartPosition() ;
while(pos != NULL)

11. , Visual C++ 355


CSomeClass* lpElement;
CString string;
// (string) (lpElement)
Some_Map.GetNextAssoc(pos, string, lpElement);
//


( ), c s t r i n g csomeciass.
, GetNextAssoc,
csomeciass.
, cobject
csomeciass. . , GetNextAssoc cobject*&.
CMapStringToOb Some_Map; // ,
POSITION pos = Some_Map.GetStartPosition();
while(pos != NULL)
{
CSomeClass* lpElement;
CString string;
// (string) (lpElement)
Some_Map.GetNextAssoc(pos, string, (CObject*&) lpElement);
ASSERT (lpElement-MsKindOf (RUNTIME_CLASS (CSomeClass) ) ) ;
//

, Lookup, ,
,
. [ ].


,
cobject ( , cobject), . ,
. -

356

III. Visual C++

,
.
:
1. GetHeadPosition GetNext
.
2. d e l e t e , .
3. Remove
, .
csomeCiass .
csomeCiass, .
CTypedPtrList<CObList, CSomeClass*> Some_List;
POSITION pos = Some_List.GetHeadPosition() ;
while(pos != NULL)
{
delete Some_List.GetNext(pos);
}
Some_List.RemoveAll();
RemoveAll . RemoveAt
.
, , . ,
. . ,

.
:
1. Getsize
.
2. d e l e t e , .
3. RemoveAll
, .
csomeCiass .
csomeCiass, .
CArray<CSomeClass*, CSomeClass*> Some_Array;
for(int i = 0; i < Some_Array.GetSize();
delete Some_Array.GetAt(i);
Some_Array.RemoveAll();

11. , Visual C++

357

, RemoveAii
, RemoveAt .
:
1. G e t s t a r t P o s i t i o n GetNextAssoc .
2. d e l e t e / , .
3. RemoveAii , .
. csomeciass ( cobject).
CMap<CString, LPCSTR, CSomeClass*, CSomeClass*> Some_Map;
//
//
POSITION pos = Some__Map.GetstartPosition () ;
while(pos != NULL)
{
CSomeClass* lpElement;
CString string;
// (string) (lpElement)
Some_Map.GetNextAssoc(pos, string, lpElement);
delete lpElement;
}
// RemoveAii
Some_Map.RemoveAii();
RemoveAii ,
RemoveKey .



.
CTypedPtrList .
"",
. ""
, . -

358

III. Visual C++

AddHead,
RemoveHead.
, , MFC , .
.
class CBullet : public CObject

class CStack : public CTypedPtrList< CObList, CBullet* >


{
public:
/
void Push(CBullet* newBullet) { AddHead(newBullet); }
//
CBullet* Peek() { return IsEmptyO ? NULL : GetHeadO; }
//
CBullet* Pop() { return RemoveHead(); }

cobList,
,
.
"", "",
.
: .
, AddTail,
RemoveHead:
, , MFC,
, .
.
class CSomeClass : public CObject

11. , Visual C++

359

class CQueue : public CTypedPtrList< CObList, CSomeClass* >


{

public:

//
void AddToEnd(CSomeClass* newPerson)
{ AddTail(newPerson); } //
//
CSomeClass* GetFromFront()
{ return IsEmptyO ? NULL : RemoveHead(); }

"" ,
"" .

12

Windows
Windows
(cooperative multitasking) . , ,
, , .

,
. .
. (threads)
(preemptive multitasking).
,
.
, , , ,
.
Win32 .
(process) .
. , Paint ,
. .
, .
, ,
,
. . Paint
.
. ,
. main winMain.
,
. , , ,

12. Windows

361

. , MFC,
cwinThread .
.
AfxBeginThread, .
MFC :
.
. ,
. , . Win32 API .
, . , . cwinApp, cwinThread , .
,
. . .
, ,
,
.


.
,
, . .
- .
: . , cwinThread. , , .

362

III. Visual C++

AfxBeginThread
:
;
.
, .
.
.
: :SetThreadPriority.
, .
,
.
CREATE_SUSPENDED, .
,
.
.
,
.
AfxBeginThread CWinThread,
,
. AfxBeginThread
, ,
, ,
.
,
.
, .
:
UINT MyThreadFunction(LPVOID pParam);

32- . , ,
AfxBeginThread, . .
,
, , . ,
, .
UINT,
, .

12. Windows

363

,
.
.
.
:
//
UINT MyThreadProc(LPVOID pParam)
{
CMyObject* lpObject = (CMyObject*)pParam;
if (lpObject == NULL I |
!lpObject->IsKindOf(RUNTIME_CLASS(CMyObject)))
return 1; //
//
return 0; //

//
CMyObject* lpMyObject = new CMyObject;
AfxBeginThread(MyThreadProc, lpMyObject),




. ( cwinApp)
.

, cwinThread.
DECLARE_DYNACREATE
IMPLEMENT_DYNACREATE. .
. 12.1 , .
12.1. cwinThread

E x i t instance

364

III. Visual C++


12.1 ()

Initinstance

Onldle

PreTranslateMessage


T r a n s l a t e M e s s a g e D i s p a t c h M e s s a g e .

ProcessWndProcException

,
.

. .

Run


AfxBeginThread ,
cwinThread. , .
.
.
: :SetThreadPriority.
, .
,
.

.

CREATE_SUSPENDED,

,
.
.
,
.
AfxBeginThread .
, ,
, ,
cwinThread::CreateThread.

AfxBeginThread , , ,
, .

12. Windows

365


: , , , . , ,
, , .
,
.
,
,
.
.
r e t u r n
AfxEndThread, .
,
, : : PostQuitMessage,
. ,
, , .

AfxEndThread .
.
, ,
, .
AfxEndThread . ,
,
.

: :GetExitCodeThread.
( mhThread cwinThread), a
32- , . ,
STILL_ACTIVE.
.
cwinThread . , m_hThread
cwinThread , . .
- :
m_bAutoDeiete FALSE. cwinThread
;

366

III. Visual C++

m_hThread
;


CWinThread.

;
: :DuplicateHandle
mjiThread
GetExitCodeThread.
.
, .
CREATE_SUSPENDED AfxBeginThread,

,
::ResumeThread.
.



,
.
, , ,
. . , , .
MFC
. . ,

c s t r i n g . . , Win32, , .

, , , .
, - ,
CWinThread, MFC, . ,
MFC, ,
MFC.

12. Windows

367


, MFC,
. ,
Windows
. ,
updateAiiviews ,
.
,
cwnd HWND . ,
Windows C + + , C++. ,
, .
.
( HWND),
C + + . FromHandie.
, Attach, ,
, , .
, , ,
: :PostMessage.
,
.



. . ,
, . , . ,
.
MFC , .
, ,
. .

368

III. Visual C++

, ,
.
,
. ,
,
. .
:
, csemaphore,
.
, , ;
c c r i t i c a i s e c t i o n ,
;
CEvent , .
.
, , , , . csemaphore,
c c r i t i c a i s e c t i o n , CEvent.

. , , , , csingieLock CMuitiLock
. Lock.

, unlock .
unlock,
.
, , , , .
,
. , ,
, .
.

12. Windows

369

, MFC
, : (cSyncObject,, CSemaphore, CMutex, C C r i t i c a l S e c t i o n CEvent)
(CMultiLock CSingleLock).

,
.
.
, , .
,
? (,
, .) ,
CEvent.


? (, , .) ,
CSemaphore.
? (,
, .) , CMutex. ,
CCriticalSection.
CSyncObject .
.
,
, .
, CSingleLock,
, CMultiLock.



Sync, .
, .
, :
1. , 1,
Sync.

370

III. Visual C++

2. Resource View ( )
IDD_SYNC_DIALOG, Dialog (), <F4>. Properties ().
3. Language (). .
4. Russian ().
5.
IDD_SYNC_DIALOG Caption () Properties () "".
6. Output ( ) .
7. Cancel () .
8. Caption () Properties
() "".
9. ,
,
.
10. Cancel () Caption () Properties () "".
11. Toolbox () Button
() .
12. Caption () Properties () "", ID ( ) IDC_START.
13. Properties () ControlEvents ( ). ,
.
14. BN_CLICKED.
.
15. . .
16. Toolbox () Check Box
() .
17. Caption () Properties () "",
ID ( )
IDC_SYNC.

18. Toolbox () Edit Control


( )
.

12. Windows

371

19.
.
20. ID ( ) Properties () IDCOUTPUT.
21. Readonly ( ).
.
22. TRUE.
23. .. 24 25 Multiline ( ), VerticalScroll
( ), HorisontalScroll (
), ClientEdge () AutoVScroU (
).
, . 12.1.
.. Sync - Microsoft Visual C++ [deslgfti^
File Edti Vtew Proe
j ct Bud
li Debug Format Toosl Wn
idow Hep
l
ibi-I'l^HfiPtttV'

> Debug

P. .

% Syncrc (D
I D_S.ALOG - Dialog) |

m_bTime

g].

t x
1

Sample edit box

" 3 "

Resoutce View-^Sync
^
t
- .11 Sync
- _J Sync re
- _JDralog
3 ] IDD.ABOUTBOX [Englis
3 ] IDD_5YI\IC_DIALOG
+ _ J Icon
' _J RT_MANIFEST
_| String Table
+
j Version

i s...

Properties

| IDC_OUTPUT (Edit Control) IEdEJ


j i i Q _

"

Read Only
True
Visible
True
Wart Return False

"

(Name)

_]
Ready

* Properties I L' i if H i

22,30

'

; " 150x145

. 12.1.
24. Add Variable ( ). Add Member Variable Wizard - Sync
( ), . 12.2.

III. Visual C++

372

| Add Member Variable Wizard - Sync '

.' 5--

JSl

Welcome to the Add Member Variable Wizard


This wizard adds a member variable to your class, struct, or union,

Access;

| |

" Cgntiolvanable

Variable type:

Vara
i be
l name;

Comment(// notation not required);


Fn
is
ih

Cancel

Hep
l

. 12.2. Add Member Variable Wizard - Sync


25. Control variable ( ) Control ID ( ) IDCSYNC.
26. Category () Value
(), Variable name ( )
mbsync Finish ().
27. .. 2426, IDCJOUTPUT m o u t p u t , Category () .
28. Class View ( ), Sync
csyncDig.
29. Properties () Overrides (
). csyncDig.
30. onCancel.
.
31. .
csyncDig .
32. .. 29 30 .

12. Windows

373

33. Class View ( )


csyncDig
Add | Add Variable ( | ).
Add Member Variable Wizard ( ).
34. Variable type ( )
i n t , Variable name ( )
mcount Finish ().
csyncDig.
35. . 33 csyncDig m C r i t i c ,
c c r i t i c a i s e c t i o n .
36. Class View ( )
csyncDig. SyncDlg.h.
37. SyncDlg.cpp csyncDig 12.1.
| 12.1. csyncDig
//
void CSyncDlg::OnBnClickedStart(void)
{

//
UpdateData();
//
AfxBeginThread(TextThreadProc,

this);

AfxBeginThread(TextThreadProc,

this);

//
void CSyncDlg::OnCancel(void)
{

//
if(m_Count)
return;

//
CDialog::OnCancel ();

//
void CSyncDlg::OnOK(void)

III. Visu

II
if(m_Count)
return;
//
CDialog::();

38. CAboutDig 12.2.


! 12.2.
//
UINT TextThreadProc(LPVOID param)
{'
int

i;

CString

szTemp;

CSyncDlg*

pt = (CSyncDlg*) param;

CSingleLock
pt->m_Count++;

FirstLock(&(pt->m_Critic)) ;
//

for(i=0; i < 20; i


if(pt-> m_bSync)
FirstLock.Lock(); //
if(!pt-> m_bSync I I FirstLock.IsLocked()) //
{
//
szTemp.Format("
");
pt->m_Output.ReplaceSel(szTemp);
Sleep(10) ;
szTemp.Format(" ") ;
pt->m_Output.ReplaceSel(szTemp);
Sleep(10);
szTemp.Format(" ") ;
pt->m_Output.ReplaceSel(szTemp) ;
Sleep(10);

12. Windows

375

szTemp.Format(" " ) ;
pt->m_Output.ReplaceSel(szTemp);
Sleep(10);
szTemp.Format("%d \r\n", i);
pt->m_Output.ReplaceSel(szTemp);
}
Sleep(lOO); //
if(pt-> m_bSync)
FirstLock.Unlock(); //
}
pt->m_Count--;
return 0;

39.

//

<F5> .
.

40. . , . 12.3.
j :

1 -

*12

13

14

15

16

17

18

19
_

<!

'

"

*|

. 12.3.
41. , . , . 12.4.
13 . 629

III. Visual C++

376

D 12
12
13
13
14
14
15
15
1G
16
17
17
18
18
19
19

<!

_^

>

]|

OK

. 12.4.

42.
. .
43. . .
,
. ,
.
csingieLock, ccriticalsection. ,
.
csingieLock: :Lock,
ccriticalsection
. ccriticalsection (), , .
csingieLock:: isLocked (
, ).
csingieLock::unlock, ( ).
.
. ,
.

12. Windows

377

.
. ,
,
csingieLock: :Unlock sleep,
, .
.
onBnciickedstart, , OpdateData, ,
AfxBeginThread . OnCancel
,
. (
.



:

. , ,
, , , , .
, , . (
, , , ,
, , ).
Sync:
1. File | Open Solution ( | ). \ Open Solution ( ),
. 12.5.
2. Sync
Sync. .
3. Solution Explorer ( ), Sync, Source Files ( ).
4. Sync.cpp.
.
5. initinstance 12.3.

III. Visual C++

378
Solution
Look in:

History

|Q| Visual Studio Projects


iJbrushj
'I Console
_1) DateTime
ZjDDB
_)DemoLib
_J Dialog
JjDIB
ZjEditApp
1 Extension
.llHelp
_l Library
_l)Line
ZjList
IJMDI
_L|Multi

P3 ' Tools -

Print
'" 1 Progress
_U Reflect
CllRichApp
ZlSDI
2J Sheet /
d l Sync
;_jText
ZllTool
OvSMacros

File name:
Files of type: I Solution Files

. 12.5. Open Solution

j 12.3. Xnitlnstance
// CSyncApp
BOOL CSyncApp::InitInstance()
{
//
CWinApp::InitInstance();
AfxEnableControlContainer();
//
CSyncDlg dig;
m_pMainWnd = &dlg;
//
AfxBeginThread(SyncroThreadProc, &dlg),
int nResponse = dlg.DoModal();
if (nResponse == IDOK)

Cancel

12. Windows

II
}
else if (nResponse == IDCANCEL)
{
//

// ,
// FALSE,
//
return FALSE;

6. csyncApp 12.4.
\ 12.4.
extern UINT TextThreadProc(LPVOID param);
//
UINT SyncroThreadProc(LPVOID param)
{
CSyncDlg*
pt = (CSyncDlg*) param;
DWORD
dwResult;
//
pt-> m_pEvents[0] = CreateEvent(NULL, FALSE, FALSE, NULL);
pt-> m_pEventS[l] = CreateEvent(NULL, FALSE, FALSE, NULL);
pt->m_eFinish.SetEvent();
while(true)
{
//
dwResult = ::WaitForMultipleObjects(2, pt-> m_pEvents, FALSE,
INFINITE);
switch(dwResult) //
{
case WAIT_OBJECT_0 + 0 : //
//

379

380

III. Visual C++


AfxBeginThread(TextThreadProc, pt);
AfxBeginThread(TextThreadProc, pt);
break;
case WAIT_OBJECT_0 + 1 : // OK
//
::WaitForSingleObject(pt->m_eFinish.m_hObject, INFINITE);
//
CloseHandle(pt-> mjpEvents[0]);
CloseHandle (pt-> m_pEvents [1] ) ;
//
: :PostMessage(pt->GetSafeHwnd(), WM_FINISH, 0, Obreturn 0;

7. Class View ( ), Sync,


csyncDlg Add | Add Variable ( |
). Add Member Variable Wizard
( ).
8. Variable type (
) CEvent, Variable
name ( ) m_eFinish
Finish ().
csyncDlg.
9.

Class View ( ) csyncDlg


csyncDlg. SyncDlg.h.

10. CEvent' m e F i n i s h ;
HANDLE m _ p E v e n t s [ 2 ] ;

11. void onOK(void);


LRESULT OnFinish(WPARAM, LPARAM);

12. #include "afxmt.h"


#define

WM_FINISH

WMJJSER + 0x100

13. SyncDlg.cpp.
14. csyncDlg
12.5.

12. Windows
\ 12.5. CSyncDlg
//
void CSyncDlg::OnBnClickedStart(void)
<
//
UpdateData();
//
/*
AfxBeginThread(TextThreadProc, this);
AfxBeginThread(TextThreadProc, this);
*/
SetEvent(m_pEvents[0]); //

//
void CSyncDlg::OnCancel(void)
{
/*
//
if(m_Count)
return;
//
CDialog::OnCancel();
*/
SetEvent(m_pEvents[1]); //

//
void CSyncDlg::OnOK(void)
{
/*
//
if(m_Count)
return;
//
CDialog::OnOK();

381
!

382

III. Visual C++

*/
SetEvent(m_pEvents[1]);

//

// WM_FINISH
LRESULT CSyncDlg::OnFinish(WPARAM /*wParam*/, LPARAM /*lParam*/)
{
CDialog: :OnOK() ;
return 0;

15. 12.6.
! 12.6.
//
UINT TextThreadProc(LPVOID param)
{
int
i;
CString
szTemp;
CSyncDlg*
pt = (CSyncDlg*) param;
pt->m_eFinish.ResetEvent(); //
CSingleLock
FirstLock(&(pt->m_Critic));
pt->m_Count++;
//
for(i=0; i < 20; i
if(pt-> m_bSync)
FirstLock.Lock(); //
if(!pt-> m_bSync I | FirstLock. IsLockedO ) //
{
//
szTemp.Format(" ") ;
pt->m_Output.ReplaceSel(szTemp) ;
Sleep(10);
szTemp.Format(" ") ;
pt->m_Output.ReplaceSel(szTemp);
Sleep(10);
szTemp.Format("
");

12. Windows
pt->m_Output .ReplaceSel (szTemp) ;
Sleep(10);
szTemp.Format("
");
pt->m_Output.ReplaceSel(szTemp);
Sleep(10);

383
"**

szTemp.Format("%d \r\n", i) ;
pt->m_0utput.ReplaceSel(szTemp);
}
Sleep(lOO); //
if(pt-> m_bSync)
FirstLock.Unlock(); //
}
pt->m Count; //
if(!pt->m_Count)
pt->m_eFinish.SetEvent(); //
return 0;

16. csyncDlg 12.7.


I 12.7. csyncDlg

BEGIN_MESSAGE_MAP(CSyncDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_START, OnBnClickedStart)
ON_MESSAGE(WM_FINISH,OnFinish)
END_MESSAGE_MAP()
17.

<F5> . ,
,
.

, ,
. ,
, . , . -

384

III. Visual C++

,
,
, . .

, , . ,
.
. DoModai
.
, .

, ,
,
.
, Add Member Variable Wizard no - .

createEvent.
. FALSE ,
, ,
.

.
: :WaitForMuitipieObjects. , .

. FALSE ,
, . , ,
, .
.- :WaitForMuitipleObjects
, ,
. .

12. Windows

385

,
, . .

,
::WaitForMultipleObjects.

,
, . : :waitForSingleObject. , ,
. ,
.
^ :
w h i l e ( p t - > m_Count)
Sleep(100);


, .
closeHandie
, . , .
coiaiog: :EndDiaiog, ,
,
. , .
:: PostMessage.
, .

cwnd: :GetsafeHwnd. .
.
, ,
WMJJSER + Oxioo, . . 256
, . ,
.

, -

386

III. Visual C++

, . OnFinish , . ,
. C D i a l o g : :OnOK,

.
, , r e t u r n .
. onBnciickedstart
setEvent, , . oncancel
SetEvent. ,
, .
, .

CEvent: :ResetEvent. . , MSDN ResetEvent , .
, .
: ,
,
, .
, ,
CEvent:: SetEvent .
CEvent
. , , mpEvents .

13


. ,
, , , , .
,
.
.
, .
, .

. , ,
, .
.



Microsoft Windows , ,
, . .
.
?
?
?
?
. , .

388

III. Visual C++



. ,
, , . ,
.
.
.


. ,
WM_COMMAND,
. , , , .
.
<F1> Windows.
WM_HELP , . (, ),
DefWindowProc .
<F1> ,
, . , ,
,
. ,
<F1>
.
lParam WM_HELP
HELPINFO, , .
.
, HELPINFO
. <F1>. .
.
,
I-XJI
. ,
.

13.

389


WM_CONTEXTMENU , . , DefwindowProc . WM_CONTEXTMENU ,
lParam, .
, wParam .

.-f

I vi\

\~-\ , WMHELP.
, WS_EX_CONTEXTHELP
createwindowEx . lParam WM_HELP HELPINFO,
,
, .

.
. .



, . Windows , , . winHeip.
.
Microsoft , , Internet
Windows Internet Explorer,
: ,
, Windows,
.
Internet Explorer.
HTML Help.

.
Help Topics ( ).
, . 13.1, ,
.

III. Visual C++

390

|.[|1.:..!

Contents I Index | Find |


Click a book, and then click Open. Or click another tab, such as Index.


,
,






()

Microsoft Wotd

,,]
I

Open

Print..

2J

Cancel

. 1 3 . 1 . Help Topics

.
, . 13.2,
. , , . , , .
.
.
, . 13.3,
. .
.
HTML Help ( HTML).
, . 13.4,
Internet Explorer.
.
.

13.

391

I > Microsoft Word

File Edit Bookmark Options Help


Print
QontenUJ index 1 /
MICROSOFT
! : )
, (
) Microsoft Corporation : Microsoft)
Microsoft (:
), ,
, .
, ,
. ,
, ,
.

,
, .
, .

. 13.2.
,
/ ,
"".
.

. 1 3 . 3 .

lls? Windows 2000


Hide

Qptions Web Help

Contents I index | Search I Favorites j


Introducing Windows 2000 Professional
Files and Folders
Internet, E-mail, and Communications
Working with Programs
Personalizing Your Computer
Hardware
\ b Printing
4 Troubleshooting and Maintenance
Networking
Accessibility for Special Needs
Mobile Users
Security
3 Control Panel
Glossary
Reference

2 0 0 0

P r o f e s s i o n a l

Start Here Find it fast


If you've used
Windows before
Troubleshooting
Information and
support on the
Web
1965-1999 Microsoft Corporation.
All rights reserved.

. 1 3 . 4 . HTML Help

zl

III. Visual C++

392

Find (), Help Topics


( ) .
.

:
1. Help Topics ( )
Find (). Find Setup Wizard
( ), . 13.5.

Find Setup Wizard


Find enabe
l s you to search foe specific words and
phrases in help topics, instead of searching for
information by category.
Before you can use Find. Wn
i dows must first create a list
(or database], which contains every word from your help
file(s)
To create this list now click Next.
^ Mn
im
i zie database size ((ecommsndedj
<"" Maxm
i zie search capabilities
f~ Customzie search capabilities
Next> Zl

Cancel |

. 13.5. Find Setup Wizard


2. Next
(). Find Setup Wizard ( ), . 13.6.
3. Finish (). Help Topics
( ), Find (), . 13.7.
4. 1. Type the word(s)
you want to find ( )
2. Select some matching words to narrow your search (
). 3. Click a topic, then click Display
( Display) , .
5. 3. Click a topic, then click Display (
Display)
Display ().

13.

393

Find Setup Wizard


Click Finish to start creating the word list. This process
may take a while, but you only need to do it once.
Once the list has been created, you can click the Find
tab to search for specific words and phrases.

Back

Finish "

Cancel

. 13.6. Find Setup Wizard


Help Topics: Microsoft Word
Contents | Index Find |
1 Jype the word(s}you want to find
2 Select some matching words to narrow your search

3 Click a topic, then click Display


AbsQ Example
Accessing an Embedded Word Object
Accessing Word for OLE Automation
Activate
Activate Example
ActivateObiect
[280 Topics Found

I!

j All words. Begin, Auto. Pause

Bisplay

. 13.7. Help Topics, Find

6. , . 13.8.

394

III. Visual C++

I Microsoft Word

Abs()
Abs(/>)
Returns the absolute value of n . For example, Abs(--E) returns the value 5.

See also
Strings.ind_Nurnbers,Stfl!gir!OlS.and Fu.netins
tntfl

BM)
, t3.8.
Find () Help Topics (
) . 4.
Find (),
Rebuild ().
HTML Help ( HTML) Index ( ),
.
,
, winHeip.
hip .
. ,
, , . .
, Windows .
,
( ).
[MAP] ,
.
winHeip
, Help
. , winHeip
, :
HKEY_LOCAL__MACHINE\Software\Microsoft\Windows\H.elp

, . , .

13.

395

winHeip , Windows Help ( Windows), . 13.9.

Windows Help
Cannot find the E:\CPP_7\Hep
l App\Debug\Hep
l App.HLP file, Do you want to try to find this file yourself?
Yes
. 13.9. Windows Help
, . Yes () Open
(), . 13.10.
JJ2S1
Look in

z\

s| Debug

IS EH-

File name:
Files of type:

Help Files

Qpen
Cancel

. 13.10. Open

. winHeip
,
.
winHeip . :
case IDHELP:

396

III. Visual C++


WinHelp(hWnd, "DemoApp.hlp", HELP_FINDER, 0) ;
break;

.
, , , , . ,
. , .
WinHelp:
BOOL WinHelp(HWND hWndMain,
LPCTSTR lpszHelp,
UINT uCommand,
DWORD dwData);

//
//
//
//
// uCommand

uCommand -
dwData Visual C + + . . 13.1.
13.1. UCommand
UCommand

HELPCONTEXT

, dwData

HELP_QUIT

HELP_INDEX

HELP_FINDER

( CNT)

HELP_HELPONHELP

HELPKEY

,
dwData

WinHelp MFC
cwinApp: :WinHeip. :
virtual void WinHelp(DWORD dwData, UINT nCmd = HELP_CONTEXT);
API.
, , . DemoApp.exe, DemoApp.hlp, WinHelp :
AfxGetApp->WinHelp(O, HELP_INDEX); //
AfxGetApp->WinHelp(O, HELP_FINDER); // ,
// .CNT

13.

397

^5

,
CWinApp: :m_pszHelpFilePath.
winHelp Windows NT.
HWND hwnd;
//
BOOL bResult //
bResult = WinHelp(hWnd, "WINNT.HLP", HELP_CONTENTS, OL);
Windows NT
.
HWND hwnd; //
BOOL bResult //
bResult = WinHelp(hWnd, "WINNT.HLP", HELP_KEY, (DWORD) "finding topics");
Help Topics ( )
winHelp HELPFINDER. , Help Topics ( )
, , ,
, .
. ,
<F1>, ,
.
HELPCONTENTS winHelp
Contents () Help Topics
( ) HELPINDEX Index
( ). .
HELP_FINDER.
winHelp
HELP_CONTEXT . HELPCONTEXT Help Topics ( )

. , .
HELPCONTEXT Windows,
.
,
, , ,

398

III. Visual C++

, , . .
.
winHelp
HELP_WM_HELP HELP_CONTEXTMENU.

,
.
HELP_WM_HELP WM_HELP
.
WM_HELP Defwindov.-P;.;,c,
( ).
,
, , winHelp
, hitemHandie,
HELPINFO, WM_HELP.
, WMHELP
.

HELP_CONTEXTMENU

WM_CONTEXTMENU. WM_CONTEXTMENU Defwindowpro>:., (


).
,
.
winHelp wParam . ,
, ,

HELP_WM_HELP, HELP_CONTEXTMENU What's This? ( ?).


, WinHelp .
.

HELP_CONTEXTPOPUP, .
HELP CONTEXT,
.
WMHELP

13.

399

,
.
.
. WMHELP
HELPINFO .
winHeip .
setwindowContextHelpid , setMenuContextHeipid .
GetWindowContextHelpId GetMenuContextHelpId .
Windows
. ,
.
HELPKEY,
HELP_PARTIALKEY HELPJMULTIKEY W i n H e i p .

winHeip , ,
. , , winHeip .
Index ( )
Help Topics ( ), . 13.11.
1. Type the first few letters of the word you're looking for (
) .
2. Click the index entry you want, and the click
Display ( Display)
, , . 2. Click the index entry you want, and the click Display ( Display) ,
Display ().
, Topics
Found ( ), . 13.12.
, .
,
, winHeip
( HELP_KEY HELPPARTIALKEY),
( HELP MULTIKEY).

winHeip. . (

III. Visual C++

400

, Windows 3.x)
, ,
( cnt), : index :Link.
^ ^ ^

mi

IHelp Topics: Microsoft W o r t H p a t

Contents

Index

| pr,d

4U.XJ

T y p e t h e first t e w l e t t e r s o f t h e w o r d y o u ' r e l o o k i n g for.

]l
2

Click the index entry y o u w a n t , a n d t h e n click Display.

1111
- (subtraction) operator
{] (parentheses) in expressions
" (multiplication) operator
/ (division) operator
[ ] (squaie brackets) in WordBasic syntax
\Cell predefined bookmark
\Char predefined bookmark
\Doc predefined bookmark
\EndOfDoc predefined bookmark
\EndOfSel predefined bookmark
WeadingLevel predefined bookmark
VLine predefined bookmark
\Page predefined bookmark
\Para predefined bookmark
\PrevSel1 predefined bookmark
\PrevSel2 predefined bookmark

Display

^Cancel!

i '

. 13.11. Help Topics, Index


JJJ<J
Click a topic, then click Display.
CheckBox
ComboBox
Creating Dynamic Dialog Boxes
Dialog Function Syntax
Dialog, Dialog))
DlgControlldfJ
DlgEnable, DlgEnableO
3lgFocus, DlgFocus$()
DlgListBoxArray. DlgListBoxArrayO
| Display J

zi
Cancel |

. 13.12.
Topics Found

13.

401

HELPKEY winHelp
, . HELP_MULTIKEY HELP_PARTIALKEY
, :Link.
Windows
, . Windows
,
, . ( ,
.) MULTIKEY
[OPTIONS] .
Index ( ) , , HELPSETINDEX
winHelp.
,
, HELP_MULTIKEY.
MULTIHELP,
winHelp.
WinHelp
, ">" , ,
:Base , .
WinHelp
,
. Topics Found (
) Help Topics ( ) .
Windows . Windows
. , . ,
. , , Windows .
[WINDOWS] . , , .
Windows , (>) . WinHelp.
HELPWININFO

402

III. Visual C++

HELP_SETWINPOS WinHeip. HELPWININFO


, .
,
, ,

. , . , ,
, TCard,
,
.
, .
winHeip,
, HELP_CONTEXT,
HELP TCARD. , TCard Windows WMTCARD. wParam
, lParam
, wParam.
Windows
, ,
. , winHeip
HELP_QUIT.
, .
winHeip,
,
(, WM_DESTROY ).
winHeip , . ,
(dll) .
Windows, WinHeip HELPTCARD
HELPQUIT. , .
Windows
, WMTCARD, wParam IDCLOSE.

13.

403



, . :
. (
" ?" " ?");
. (
,
. , , );
. ( ).
Windows .
<F1> WinHelp, , .
<Shift>+<Fl>. ( )
.
<F1>
.
.
( ).

,
.


,
. .

Context-sensitive Help ( ) Advanced Features ( )
MFC Application Wizard - Help (
MFC), . 13.13.

III. Visual C++

404
IHFC Application Wizard - Help

2l

Advanced Features
Specify additional support to build into your application.

Application Type
Compound Document Support
Document Template Strings
Database Support

Advanced features:
ly Context-sensitive Help
(f WinHelp Format

Number of files on recent file list:

HTML Help format


I"? Printing and print preview
" Automation
P? ActiveX controls
. MAPI (Messaging API)

User Interface Features

" Windows sockets

Advanced Features

" Active Accessibility


W Common Control Manifest

Generated Classes

Finish

Cancel

Help

. 13.13. Context-sensitive Help



.
, . , AppWizard .
h (header file) ,
.
hrn (help mapping file)
. , ,
.
rtf (rich text format) .
cnt ,
Contents ( ) Help Topics (
). (, , hip).

13.

405

hpj (help project file),


, hm
rtf, hip.

. , .
gid , , .
fts ,
.
ftg , .
, , ASCII,
. INI-.
. 13.2
. Microsoft
Help Workshop, .
13.2.

[OPTIONS]

[ FILES ]

RTF, HLP

[WINDOWS ]

[ALIAS ]

:
[OPTIONS]
ERRORLOG = DemoApp.err
CONTENTS = HID_CONTENTS
TITLE = DemoApp Help
[FILES]
DemoApp.rtf
[WINDOWS]
Main = "DemoApp Help",(190,100,560,630),,,(192,192,192)

406

III. Visual C++

[OPTIONS] , ,
,
. [ F I L E S ] , [WINDOWS] .
.
, MFC Application Wizard ( OLE)
Context-sensitive Help ( )
:
CMainFrame
ID_HELP_FINDER ID_DEFAULT_HELP.

CMDiFrameWnd;
Help ();
, AppWizard ( , , , ), Help Topics ( );
<F1> ( I D HELP)
<Shift>+<Fl> (ID_CONTEXT_HELP);
Ready ()
For Help, press F1 ( F1);
,
, AFX_IDS_HELPMODEMESSAGE,
Select an object on which to get Help ( ,
).
ID_CONTEXT_HELP;
,
Help Topics (
);
afxcore.rtf, ;
Advanced Features ( ) MFC Application Wizard - Help (
MFC) Printing and print preview (
), afxprintf.rtf,
;

13.

407


BMP,
.



Help ()
Help () , , , WM_COMMAND. , WinHelp. , .
WM__CONTEXTMENU.
,
, . , ,
What's This? ( ?), .
Windows
<F1> . , (, ,
. .) ,
WinHelp,
.
WMHELP. , .
[MAP] hpj.
#define #inciude,
.
.
[MAP] #inciude, :
# i n c l u d e DemoApp.h


RTF .
[ALIAS], , RTF.
:
[ALIAS]
ID_FIRST=HID_FIRST
ID_SECOND=HID_SECOND
ID_THIRD=HID_THIRD
ID_HELP=HID_DEMO_MENU
IDM_ABOUT=HID_MAIN_INDEX
IDM_EXIT=HID_APP_EXIT
14 . 629

408

III. Visual C++

[MAP]
ID_FIRST=0x9000
ID_SECOND=0x9001
ID_THIRD=Ox9002
ID_HELP=32771
IDM_ABOUT=104
IDM_EXIT=105

,
. WM_HELP WM_CONTEXTMENU.
l Par am WM_HELP HELPINFO. hitemHandie
,
, i c t r i i d . WinHeip HELP_WM_HELP, .
,
:
case WM_HELP:
{
HELPINFO & helpinfo = * reinterpret_cast<LPHELPINFO>(lParam);
if(helpinfo.iContextType == HELPINFO_MENUITEM)
{
WinHeip(hWnd, "DemoApp.hlp", HELP_CONTEXT, helpinfo.iCtrlld);
}
break;
winHeip . Windows,
. ,
,
1, (,
, )
. , .
.

13.

409

<F1>
I D H E L P . . I D H E L P , .
I D HELP ,
. , ID_HELP cwinApp: :OnHeip.
, , .
cwinApp: :OnHeip :
AfxMessageBox,
. , WinHelp , ;
,
cwinApp: :OnHeip WM_COMMANDHELP . WMCOMMANDHELP
MFC, .
,
-cwinApp: :winHelp ,
. WinHelp,
, ;
, , .
ID_DEFAULT_HELP. CWinApp: :OnHelpIndex.
HELPCONTEXTMENU ,
Windows .
Help Topics ( ).
winHelp WM_CONTEXTMENU
WM_HELP :
WM_CONTEXTMENU wparam, , ;
HELP_CONTEXTMENU,
HELP WM H E L P .

410

III. Visual C++

LRESULT CALLBACK MyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,


LPARAM lParam)
{
//
// ,
static DWORD aIDs[] =
{
IDC_GO, HIDD_GO,
IDOK, HIDD_CONTEXT_OK,
IDCANCEL, HIDD_CONTEXT_CANCEL,
0, 0

//
switch (uMsg)
{
case WM_HELP:
WinHeip(((LPHELPINFO) lParam)->hItemHandle,
"MyHelp.hlp", HELP_WM_HELP, (DWORD) (LPSTR) alDs)
break;
case WM_CONTEXTMENO:
WinHeip((HWND) wParam, "MyHelp.hlp",
HELP_CONTEXTMENU, (DWORD) (LPVOID) alDs);
break;
// .

return FALSE;

,
winHeip HELP_SETWINPOS

HELPWININFO. , , .

"help_wnd". [WINDOWS] .
BOOL DoWindowSize(VOID)

13.
HANDLE

411

hWnd;

LPHELPWININFO lpHwi;
WORD
Size;
char*
szWndName = "help_wnd";
//
// LPHELPWININFO
Size = sizeof(HELPWININFO) + lstrlen(szWndName);
hWnd = GlobalAlloc(GHND, Size);
lpHwi = (LPHELPWININFO) GlobalLock(hWnd);
// LPHELPWININFO
lpHwi->
lpHwi->
lpHwi->
lpHwi->
lpHwi->

wStructSize = Size;
x
= 64;
//'

= 64;
//
dx
= 256;
//
dy
= 256;
//

lpHwi-> wMax
= SW_SHOW; //
lstrcpy(lpHwi-> rgchMember, szWndName); //
//
WinHelp(hwnd, "MyHelp.hlp", HELP_SETWINPOS, (DWORD) lpHwi);
//
GlobalUnlock(hWnd) ;
GlobalFree(hWnd) ;
return;


<Shift>+<Fl>,
ID_CONTEXT HELP.
,
(cWinApp: : Run).

,

(, ).

412

III. Visual C++

.
.
, , , . CWinApp: :OnContextHelp.
, , , .
PreTransiateMessage, .
PreTransiateMessage, TO
m_bHelpMode
cwinApp. PreTransiateMessage
CDialog , , isDialogMessage,

. ,
cwinApp: :Onidie.
( WM_COMMANDHELP). ,
onContextHelp WM_HELPHITTEST , . , .
, OnContextHelp
( , ). , ID_DEFAULT_HELP,
cwinApp: :OnHelpindex.
WM_HELPHITTEST MFC, ,
<Shift>+<Fl>. DWORD,
, WinHelp.


Visual C + + , .
Resource language ( ),
Application Type ( ) MFC Application
Wizard - Help ( MFC). , , -

13.

413

, ,
.
, Visual C++ ,
, .
Visual C++ 6.0 : ,
Windows, .
Visual Studio.NET
Windows 2000 , .
MFC Application Wizard ( MFC) ,
, . , ,
. ,
.
,
Microsoft,
,
, , , .
. .
,
.
(, , ,
, , ). ,
.
: Microsoft
"" , . , ,
. 13.14.
, ,
, MS
Word 7.0 Windows 2000 (. 13.15). ,
, Windows 2000.

III. Visual C++

414

77? 777777 ?????7?


)00s
????777? ???????
J29n
7????? ?????

?????????
/~>->->7
f

??????O79?77

?7?77?77?
i

|29

Next ^

Cancel

Help

. 13.14.
Windows 2000

_
_

'

i
\

1...
.

I
1

; _
j

. 13.15.
MS Word 7.0 Windows 2000
,
. ,

Windows,
. ,

13.

415

, ,
( , ).

. .
,
OLE,
afxres.rc afxprint.rc, . ,
,
,
( ).
, ,
, , Windows,
- .
(afxprint.rc) , .
, , . , , .
Help, ,
OLE.
, , . Help,
, ,
. :
1. , 1
Help, MFC Application Wizard
( MFC) Finish ().
2. Advanced Features (
), Context-sensitive Help (
) Finish ().
3.
. File | Open | File ( | |
) . Open ().

III. Visual C++

416

4. Help.rc, Open
(), . 13.16, Open
With ( ). Open With (
), . 13.17.
lopenFile
Looktn:

History

; "; -SSSii;f

Q Hepl
^J *"
_3
lhp
l
[Ksjtdafx.h
22
rh
elF
c|Cd
isrmc
.pp
h)Ch
d
liFrmh
.
||.
h] Help.h
Help.rc
e| HelpDoc.cpp
h] HelpDoc.h
ei| HelpView.cpp
h] HelpView.h
MainFrm.cpp
KJ MainFrm.h
hj Resource, h
stdafx.cpp

l X CJ * Tois'

M
yProejcts
j
j

y=y
Desktop

Fu
av*oJ
tre
is

File name:

'

zJ
zJ

Files of type: Jvisual C++ Files

Open |-|
Open
Open With...

. 13.16. Open

Open With - Help.rc


Select a program to open:

Source Code (Text) Editor


Source Code (Text) Editor With Encoding
HTML/XML Editor
HTML/XML Editor with Encoding
Visual
Binary Editor

Add...

Set as Default
Close

Help

. 13.17. Open With - Help.rc

13.

417

5. Select a program to open ( ,


) Source Code (Text) Editor (
) Open (). .
6.

13.1.
\
1

| 13.1.
!
II , Microsoft Developer Studio.
//
#include "resource.h"
#define APSTODIO_READONLY_SYMBOLS
mimmmm/mm/mimmmimmmmmiiimiiiimmm
II TEXTINCLUDE 2.
# include "afxres.h"
imimiiiiim/miiiimii/ii/iiim

iiimimimi/iimiiii

#undef APSTUDIO_READONLY_SYMBOLS
#ifdef APSTUDIO_INVOKED
iimiimmmiiiiimimmmiimimimmmmimiiiiiimiii
II TEXTINCLUDE
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"tinclude ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"tdefine _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"Idefine AFX NO TRACKER RESOURCES\r\n"

/mimi

418

III. Visual C++


"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL)

defined(AFX_TARG_ENU)\r\n"

"#ifdef _WIN32\r\n"
"LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT\r\n"
"#pragma code_page(1251)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\Help.rc2""
sources\r\n"

// non-Microsoft Visual C++ edited

re-

"#endif\r\n"
"\0"
END
#endif

// APSTUDIO_INVOKED

I/ Icon
// , ,
// ,
//
#if !defined(AFX_RESOURCE_DLL)

I defined(AFX_TARG_ENU)

#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32
IDR_MAINFRAME

ICON

"resWHelp. ico"

IDR_HelpTYPE

ICON

"resWHelpDoc. ico"

#endif
/////ll/lllll1111 III IIIIIIIII//I/I IIII/III/I IIII IIIIll/llllllIII IIIIllll
II Bitmap
IDR_MAINFRAME

BITMAP

"res\\Toolbar.bmp"

////////////////////' /Illlllll/llllllIIIIIIIlllllllllll/lllllIIIIIIIIIIIII
II CMiniFrameWnd Bitmap
AFX_IDB_MINIFRAME_MENU

BITMAP

DISCARDABLE

"res\\minifwnd.bmp"

13.

419

11 CCheckListBox Bitmaps
AFX_IDB_CHECKLISTBOX_95

mm/mi

BITMAP DISCARDABLE

"res\\95check.bmp"

in/mm ill in/mi mi iii i mmmiii /mil/in ill mm/mil /mm

1111111111111111111111 /11111 ii 111 in 11111/1 in i in 1111111111111 / ii /1


11 Cursors
AFX IDC CONTEXTHELP

CURSOR DISCARDABLE

"res Whelp, cur"

#ifndef _AFX_NO_SPLITTER_RESOURCES
AFX_IDC_SMALLARROWS
CURSOR DISCARDABLE
AFX_IDC_HSPLITBAR
CURSOR DISCARDABLE
AFX_IDC_VSPLITBAR
CURSOR DISCARDABLE
AFX_IDC_NODROPCRSR
CURSOR DISCARDABLE
#endif //!_AFX_NO_SPLITTER_RESOURCES

"resWsarrows. cur"
"resWsplith.cur"
"resWsplitv.cur"
"resWnodrop.cur"

#ifndef AFX NO TRACKER RESOURCES


AFX IDC TRACKNWSE
CURSOR DISCARDABLE
AFX IDC TRACKNESW
CURSOR DISCARDABLE
AFX_IDC TRACKNS
CURSOR DISCARDABLE
AFX_IDC_TRACKWE
CURSOR DISCARDABLE
AFX IDC TRACK4WAY
CURSOR DISCARDABLE
AFX IDC MOVE4WAY
CURSOP DISCARDABLE
#endif //! AFX NO TRACKER RESOURCES

"resWtrcknwse. cur"
"resWtrcknesw.cur"
"resWtrckns. cur"
"resWtrckwe. cur"
"res\\trck4way.cur"
"res\\move4way.cur"

#ifndef AFX NO MOUSE RESOURCES


AFX IDC MOUSE PAN_N CURSOR DISCARDABLE "res\\im_pann.cur"
AFX IDC MOUSE PAN_S CURSOR DISCARDABLE "res\\im_pans.cur"
AFX IDC MOUSE PAN_E CURSOR DISCARDABLE "res\\im_pane.cur"
AFX__IDC__MOUSE_PAN_W CURSOR DISCARDABLE "res\\im_panw.cur"
AFX IDC MOUSE PAN_NE CURSOR DISCARDABLE "res\\im_panne.cur"
AFX__IDC__MOUSE_PAN_NW CURSOR DISCARDABLE "res\\im_pannw.cur"
AFX__IDC MOUSE PANJ3E CURSOR DISCARDABLE "res\\im_panse.cur"
AFXJTDC__MOUSE_PAN_SW CURSOR DISCARDABLE "res\\im_pansw.cur"
AFX__IDC___MOUSE PAN_HORZ CURSOR DISCARDABLE "res\\im_panh.cur"
AFX IDC MOUSE PAN_VERT CURSOR DISCARDABLE "res\\im_panv.cur"
AFX IDC MOUSE PAN_HV CURSOR DISCARDABLE "res\\im_panhv.cur"

III. Visual C++

420

/I anchor bitmaps
AFX_IDC_MOUSE_ORG_HORZ CURSOR DISCARDABLE "res\\im_orgh.cur"
AFX_IDC_MOUSE_ORG_VERT CURSOR DISCARDABLE "res\\im_orgv.cur"
AFX_IDC_MOUSE_ORG_HV CURSOR DISCARDABLE "res\\im_orghv.cur"
tendif
AFX IDC MAGNIFY

CURSOR

DISCARDABLE

"resWraagnify.cur"

11111111II111111111 / III III III /I/1111111111111111111111111 /11111


II Toolbar
IDR_MAINFRAME TOOLBAR 16, 15
BEGIN
ID_FILE_NEW
BUTTON
ID_FILE_OPEN
BUTTON
ID_FILE_SAVE
BUTTON
SEPARATOR
ID_EDIT_CUT
BUTTON
ID_EDIT_COPY
BUTTON
ID_EDIT_PASTE
BUTTON
SEPARATOR
ID_FILE_PRINT
BUTTON
ID_APP_ABOUT
BUTTON
ID CONTEXT HELP
BUTTON
END
#if !defined(AFX_RESOURCE_DLL) I I defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32
II Menu
IDR_MAINFRAME MENU
BEGIN
POPUP "&"
BEGIN
MENUITEM "&...\tCtrl+N",
MENUITEM " . . . . \tCtrl+O",

ID_FILE_NEW
ID FILE OPEN

13.
MENUITEM
MENUITEM
MENUITEM
MENUITEM
MENUITEM
MENUITEM
MENUITEM

SEPARATOR
"& ...",
SEPARATOR
' ",
SEPARATOR
"^",
"&", .

END
POPUP "&"
BEGIN
MENUITEM " &",
MENUITEM " &",
END
POPUP "&?"
BEGIN
MENUITEM "& ",
MENUITEM SEPARATOR
MENUITEM "SO ",

421

ID_FILE_PRINT_SETUP
ID_FILE_MRU_FILE1, GRAYED
ID_FILE_CLOSE
ID APP EXIT

ID__VIEW_TOOLBAR
ID VIEW STATUS BAR

ID HELP FINDER
ID APP ABOUT

END
END
IDR_HelpTYPE MENU
BEGIN
POPUP "&"
BEGIN
MENUITEM "&...\tCtrl+N",
MENUITEM ' . . . \tCtrl+O",
MENUITEM ".",
MENUITEM "&CoxpaHHTb\tCtrl+S",
MENUITEM " &...",
MENUITEM SEPARATOR
MENUITEM
MENUITEM
MENUITEM
MENUITEM
MENUITEM
MENUITEM
MENUITEM

"&..AtCtrl+P",
"& "
"& ...",
SEPARATOR
". ",
SEPARATOR
"&",

END
POPUP "&"

ID_FILE_NEW
ID_FILE_OPEN
ID_FILE_CLOSE
ID_FILE_SAVE
ID_FILE_SAVE_AS
ID_FILE_PRINT
ID_FILE_PRINT_PREVIEW
ID_FILE_PRINT_SETUP
ID_FILE_MRU_FILE1, GRAYED
ID APP EXIT

III. Visual C++

422
BEGIN
MENUITEM
MENUITEM
MENUITEM
MENUITEM
MENUITEM

"&OTMeHMTb\tCtrl+Z",
SEPARATOR
"&Bbipe3aTb\tCtrl+X",
"&\1:1:1+",
"BcT&aBMTb\tCtrl+V",

END
POPUP "&"
BEGIN
MENUITEM " ^"
MENUITEM " &",
END
POPUP

ID_EDIT_UNDO
ID_EDIT_CUT
ID_EDIT_COPY
ID EDIT PASTE

I D_VIEW_TOOLBAR
ID VIEW STATUS BAR

"SOKHO"

BEGIN
MENUITEM
MENUITEM
MENUITEM
MENUITEM

"&",
"&",
"&",
"&",

END
POPUP "&?"
BEGIN
MENUITEM "& ",
MENUITEM SEPARATOR
MENUITEM "& ",
END

ID_WINDOW_NEW
ID_WINDOW_CASCADE
ID_WINDOW_TILE_HORZ
ID WINDOW ARRANGE

ID HELP FINDER
ID APP ABOUT

END

11 Accelerator
IDR_MAINFRAME ACCELERATORS
BEGIN
"N",
ID_FILE_NEW,
"0",
ID_FILE_OPEN,
"S",
ID_FILE_SAVE,
"P",
ID_FILE_PRINT,
"Z",
ID_EDIT_UNDO,
"X",
ID_EDIT_CUT,
"C",
ID__EDIT_COPY,
"V",
ID EDIT PASTE,

VIRTKEY,CONTROL
VIRTKEY,CONTROL
VIRTKEY,CONTROL
VIRTKEY,CONTROL
VIRTKEY,CONTROL
VIRTKEY,CONTROL
VIRTKEY,CONTROL
VIRTKEY,CONTROL

13.
VK__BACK,
VK_J3ELETE,
VK INSERT,
VK__INSERT,
VK__F6,
VK__F6,
VK_-Fl'
VK Fl,
END

423

ID__EDIT UNDO,
ID__EDIT_CUT,
ID EDIT COPY,
ID__EDIT_PASTE,
ID NEXT PANE,

VIRTKEY,ALT
VIRTKEY,SHIFT
VIRTKEY,CONTROL
VIRTKEY,SHIFT
VIRTKEY

ID__PREV_PANE,
ID_ CONTEXT HELP,
ID HELP,

VIRTKEY,SHIFT
VIRTKEY,SHIFT
VIRTKEY

//
AFX_IDR_PREVIEW_ACCEL ACCELERATORS LOADONCALL MOVEABLE
BEGIN
VK_NEXT,
AFX_ID_PREVIEW_NEXT,
VIRTKEY, NOINVERT
VK_PRIOR,
AFX_ID_PREVIEW_PREV,
VIRTKEY, NOINVERT
VK_ESCAPE, AFX_ID_PREVIEW_CLOSE, VIRTKEY, NOINVERT
END

// Dialog
IDD_ABOUTBOX DIALOG 0, 0, 235, 55
CAPTION " "
STYLE DS_MODALFRAME | WS_POPUP I WS_CAPTION

I WS_SYSMENU

FONT 8, "MS Sans Serif"


BEGIN
ICON
IDR_MAINFRAME,IDC_STATIC, 11, 17, 20, 20
LTEXT
"Help 1.0",IDC_STATIC,40,10,119, 8,
SS_NOPREFIX
LTEXT
"Copyright (C) 2001",IDCJ3TATIC,40,25,119,8
DEFPUSHBUTTON
"OK",IDOK,178,7,50,14,WS_GROUP
END

// Standard Dialogs
#ifndef _AFX_NO_NEWTYPEDLG_RESOURCES
AFX_IDD_NEWTYPEDLG DIALOG DISCARDABLE 9, 26, 183, 70
STYLE DS MODALFRAME | WS POPUP I WS CAPTION | WS SYSMENU

0x04

424

III. Visual C++

CAPTION "New"
FONT 8, "MS Shell Dig"
BEGIN
LTEXT
"& ",IDC_STATIC,6,5,123,8,NOT
WS_GROUP
LISTBOX
AFX_IDC_LISTBOX,6,15,125,49,WS_VSCROLL I WSJTABSTOP
DEFPUSHBUTTON
"OK",IDOK,137,6,40,14
PUSHBUTTON
".", IDCANCEL,137, 23, 40,14
PUSHBUTTON
"& . . . ", IDJffiLP, 137, 43, 40,14
END
#endif // !_AFX_NO_NEWTYPEDLG_RESOURCES
/
AFX_IDD_PRINTDLG DIALOG DISCARDABLE 6, 18, 133, 95
STYLE DS_MODALFRAME | WS_POPUP I WS_CAPTION I 0x04
FONT 8, "MS Shell Dig"
BEGIN
CTEXT
"",IDC_STATIC,0,9,133,8
CTEXT
"Ha",IDC_STATIC,0,19,133,8
CTEXT
"",AFX_IDC_PRINT_PRINTERNAME,0,29,133,8
CTEXT
"",AFX_IDC_PRINT_PORTNAME,0,39,133,8
CTEXT
"",AFX_IDC_PRINT_DOCNAME,0,49,133,8
CTEXT
"",AFX_IDC_PRINT_PAGENUM,0,59,133,8
PUSHBUTTON
"",IDCANCEL,46,74,40,14
END
//
AFX_IDD_PREVIEW_TOOLBAR DIALOG PRELOAD DISCARDABLE 0, 0, 330, 16
STYLE WS_CHILD I 0x04
FONT 8, "MS Shell Dig"
BEGIN
PUSHBUTTON
"...",AFX_ID_PREVIEW_PRINT, 2, 2, 44,12
PUSHBUTTON
"C&neflyramaH",AFX_ID_PREVIEW_NEXT,48,2,44,12
PUSHBUTTON
"&",AFX_ID_PREVIEW_PREV,94,2,44,12
PUSHBUTTON
"",AFX_ID_PREVIEW_NUMPAGE,140,2,44,12
PUSHBUTTON
"." ,AFX_ID_PREVIEW_ZOOMIN,186,2,44,12
PUSHBUTTON
"&",AFX_ID_PREVIEW_ZOOMOUT, 232,2,44,12
PUSHBUTTON
"&3",AFX_ID_PREVIEW_CLOSE,278,2,44,12
END

13.

425

II Version
//
VS__VERSION_INFO
VERSIONINFO
FILEVERSION
1,0,0,1
PRODUCTVERSION
1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS OxlL
#else
FILEFLAGS OxOL
lendif
FILEOS 0x4L
FILETYPE OxlL
FILESUBTYPE OxOL
BEGIN
BLOCK "StringFilelnfo"
BEGIN
BLOCK "040904BO"
BEGIN
"\0"
VALUE "CompanyName",
VALDE "FileDescription" "Help Application\0"
"1".0.0.1\0"
VALUE "FileVersion",
"HelpXO"
VALUE "InternalName",
VALUE "LegalCopyright", "Copyright (C) 2001X0"
VALUE "LegalTrademarks" "\0"
VALUE "OriginalFilename","Help.EXEXO"
VALUE "ProductName",
"Help ApplicationXO"
VALUE "ProductVersion", "1.0.0.1X0"
END
END
BLOCK "VarFilelnfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

I! 1111111111111111111111111111111111111111111'l 1111111111111111111
11 DESIGNINFO

426

III. Visual C++

II
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
END
#endif
// APSTUDIO_INVOKED

11 III 11 III I III 111 III III 11 III I III III III/11 III III III III III 11 III III 111 III
II String Table
//
STRINGTABLE DISCARDABLE
BEGIN
#ifndef _AFX_NO_APPMENU_RESOURCES
AFX_IDS_OPENFILE
" "
AFX_IDS_SAVEFILE
" "
AFX_IDS_ALLFILTER
" (*.*)"
AFX_IDS_UNTITLED
""
AFX_IDS_HIDE,
"&"
#endif // !_AFX_NO_APPMENUSTRING_RESOURCES
END
// ,
STRINGTABLE DISCARDABLE
BEGIN
//
AFX_IDS_PRINTONPORT
" %1"
AFX_IDS_ONEPAGE
"& ." //
//
//
AFX_IDS_TWOPAGE
"& ." //
//
//
AFX_IDS_PRINTPAGENUM ". %"
AFX_IDS_PREVIEWPAGEDESC " %\ %u-%u\n"

13. .

427

//
AFX_IDS_PRINTDEF\ULTEXT

"prn"

// ,
//
AFX_IDS_PRINTDEF\ULT "Output.prn" // ,
//
AFX_IDS_PRlNTFILrER
" (*.) I *. I (*.*) |
*.* I I "
AFX_IDS_PRINTCAPriON " "
AFX_IDS_PRINTTOFILE
" %1"
END
STRINGTABLE
BEGIN
// , MAC,
IDR_MAINFRAME
"Help"
IDR_HelpTYPE
"\nHelp\nHelp\n\n\nHelp.Document\nHelp.Document"
END
STRINGTABLE
BEGIN
AFX_IDS_APP_TITLi;
"Help"
AFX_IDS_IDLEME5SAGE
" F1"
AFX_IDS_HELPMO3EMESSAGE " ,
"
END
STRINGTABLE
BEGIN
ID_INDICATOR_EXT
ID_INDICATOR_CAP3
ID_INDICATOR_NUM
ID_INDICATOR_SCRJ

"EXT"
"CAP"
"NUM"
"SCRL"

ID_INDICATOR_OVR

"OVR"

ID_INDICATOR_REC

"REC"

END
STRINGTABLE
BEGIN
ID_FILE_NEW

" \"

ID__FILE_OPEN

" \"

ID FILE_CLOSE

" \"

III. Visual C++

428
ID_FILE_SAVE

" \"

ID_FILE_SAVE_AS

"
\ "

ID_FILE_PAGE_SETUP

"
"

ID_FILE_PRINT_SETUP

"
\ "

ID_FILE_PRINT

" \"

ID FILE PRINT PREVIEW

"
\ "

ID_APP_ABOUT

" ,
\ "

ID_APP_EXIT

" ;
\"

ID_CONTEXT_HELP

" ,
\"

ID_HELP_INDEX

" \
"

ID_HELP_FINDER

" \ "

ID_HELP_USING

"
\"

ID HELP

"
\"

ID_FILE _MRU_FILE1

" "

ID_FILE MRU_FILE2

" "

ID_FILE _MRU_FILE3

" "

ID_FILE _MRU_FILE4

" "

ID_FILE _MRU_FILE5

" "

ID_FILE _MRU_FILE6

" "

ID_FILE _MRU_FILE7

" "

ID_FILE _MRU_FILE8

" "

ID_FILE _MRU_FILE9

" "

ID_FILE _MRU_FILE10

" "

ID_FILE _MRU_FILE11

" "

ID_FILE _MRO_FILE12

" "

ID_FILE _MRU_FILE13

" "

ID_FILE _MRU_FILE14

" "

ID_FILE _MRU_FILE15

" "

ID_FILE _MRU_FILE16

" "

ID NEXT PANE

" \
"

ID PREV PANE

"
"

13.

429

ID_WINDOW_NEW

" \ "

ID_WINDOW_ARRANGE

"
\ "

ID_WINDOW_CASCADE

" ,
\ "

I D_WINDOW_TILE_HORZ

"
\ "

ID_WINDOW_TILE__VERT

"
\ "

ID WINDOW SPLIT

" \"

ID_EDIT_CLEAR

" "

I D_EDIT_CLEAR_ALL

" \ "

ID_EDIT_COPY

"
\ "

ID_EDIT_CUT

"
"

ID_EDIT_FIND

" \"

ID_EDIT_PASTE

" \"

ID_EDIT_REPEAT

" "

ID__EDIT_REPLACE

" \"

SELECT ALL

" \
"

ID_EDIT_UNDO

"
\"

ID_EDIT_REDO

"
\"

ID_VIEW_T0OLBAR

" \
"

ID VIEW STATUS BAR

" \
"

END
STRINGTABLE
BEGIN
AFX_IDS_SCSIZE

" "

AFX_IDS_SCMOVE

" "

AFX_IDS_SCMINIMIZE

" "

AFX_IDS_SCMAXIMI ZE

" "

AFX_IDS_SCNEXTWINDOW

" "

AFX_IDS_SCPREVWINDOW

" "

AFX IDS SCCLOSE

" "

430 III. Visual C++


AFX_IDS_SCRESTORE
AFX_IDS_SCTASKLIST
AFX_IDS_MDICHILD
AFX_IDS_PREVIEW_CLOSE

" "
" "
" "
"
\ "

END
tendif
iifndef APSTUDIO_INVOKED

111111/111!1111111111/1 111 11 III I/111111111111111111/I I!1111111


II TEXTINCLUDE 3
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
tdefine _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) I I defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32
linclude "res\\Help.rc2" '// , Microsoft Visual C++
#endif
#endif // not APSTUDIO_INVOKED
7. /res , afxrec.rc afxprint.rc, /res
Help.
, Visual C++
.
# include , . ,
, . #include
,
. .
:
, , ;

13.

431

T E X T I N C L U D E
"LANGUAGE 9,

l\r\n"

"ttpragma code_page(1252)\r\n"
"#endif

//_WIN32\r\n"

"#include ""res\\Help.rc2""

// non-Microsoft Visual C++ edited


resources\r\n"

"#include

""afxres.rc""

// Standard components\r\n"

"iinclude

""afxprint.re""

// printing/print preview resources\r\n"


"LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT\r\n"
"tpragma code_page(1251)\r\n"
"tendif //_WIN32\r\n"
"#include ""res\\Help.rc2"" // non-Microsoft Visual C++ edited
resources\r\n"
icon
LANGUAGE 9,

Ipragma code_page(1252)


LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251);

Bitmap afxres.rc
///////////////////////////////////////////////////////////////////
I/ CMiniFrameWnd Bitmap
AFX_IDB_MINIFRAME_MENU

BITMAP DISCARDABLE

"res\\minifwnd.bmp"

I/I////II//IIIIIIIIIIII/IIIII/IIIIIIIIIIIIIIIIIIHIIIIIIIIIIIIIIIII
// CCheckListBox Bitmaps

AFX_IDB_CHECKLISTBOX_95
BITMAP DISCARDABLE
"res\\95check.bmp"
//////inilll/ll/lll/ll/ll/llllllllllllllllll/ll/lll/lllllllllll/ll
cursors
afxres.rc afxprint.rc;
Menu
LANGUAGE 9,

#pragma code_page(1252)


LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
ipragma code_page(1251)

432

III. Visual C++

Menu ;
A c c e l e r a t o r afxprint.rc ;
Accelerator Cursors,
afxres.rc
afxprint.rc;
Dialog afxres.rc
afxprint.rc;
s t r i n g Table
afxres.rc, , afxprint.rc, ;
s t r i n g Table
;
TEXTINCLUDE 3
LANGUAGE

9,

tpragma code_page(1252)
#endif //_WIN32
#include "res\\Help.rc2"

// non-Microsoft Visual C++ edited resources

tinclude "afxres.rc"

// Standard components

#include "afxprint.rc"

// printing/print preview resources


LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
tpragma code_page(1251)
#endif //_WIN32
#include "res\\Help.rc2" // non Microsoft Visual C++ edited resources
Windows,
, , :
STRINGTABLE
BEGIN
AFX_IDS_SCSIZE
AFX_IDS_SCMOVE
AFX_IDS_SCMINIMIZE
AFX_IDS_SCMAXIMIZE
AFX_IDS_SCNEXTWINDOW
AFX_IDS_SCPREVWINDOW

" "
" "
" "
" "
" "
" "

13.
AFX_IDS_SCCLOSE
AFX_IDS_SCRESTORE
AFX_IDS_SCTASKLIST
AFX_IDS_MDICHILD
AFX IDS PREVIEW CLOSE

433
" "
" "
" "
" "
"
\ "

END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_MEMORY_EXCEPTION
AFX_IDS_NOT_SUPPORTED_EXCEPTION

" ."
"
."
" ."

AFX_IDS_RESOURCEJEXCEPTION
AFX IDS USER EXCEPTION

" ."

//
#ifndef _AFX_NO_FILECMD_RESOURCES
AFX_IDP_INVALID_FILENAME
AFX_IDP_FAILED_TO_OPEN_DOC
AFX_IDP_FAILED_TO_SAVE_DOC
AFX_IDP_ASK_TO_SAVE

" ."
" ."
" ."
" %1?"

AFX_IDP_FAILED_TO_CREATE_DOC

"
."

AFX_IDP_FILE_TOO_LARGE

"
."
"
."

AFX IDP FAILED TO START PRINT


#endif // !_AFX_NO_FILECMD_RESOURCES
AFX_IDP_FAILED_TO_LAUNCH_HELP

"
."

AFX_IDP_INTERNAL_FAILURE
AFX_IDP_COMMAND_FAILURE

" ."
" ."

AFX_IDP_FAILED_MEMORY_ALLOC

"
."

AFX_IDP_GET_NOT_SUPPORTED,
AFX_IDP_SET_NOT_SUPPORTED,
AFX IDP UNREG DONE

"

"

.
."
.
."

"
, INI (
) ."

III. Visual C++

434

"He
(
INI file)."
"
%s,

."
"
%s
%s.

% "

AFX IDP UNREG FAILURE

AFX IDP DLL LOAD FAILED

AFX IDP DLL BAD VERSION

// CFile/CArchive,
#ifndef AFX NO CFILE RESOURCES

AFXIDPFAILEDIOERRORREAD

" ."
"%1\
.\
."
"
."
" %1,
."
" %1,

."
"

AFX_IDP_FAILED_IO_ERROR_WRITE

"

AFX_IDP_FAILED_INVALID_FORMAT
AFX_IDP_FAILED_INVALID_PATH
AFX_IDP_FAILED_DISK_FULL
AFX_IDP_FAILED_ACCES S_READ
AFX_IDP_FAILED_ACCESS_WRITE

#endif // ! AFX NO CFILE RESOURCES


//
AFX_IDP_PARSE_INT
" ."
AFX_IDP_PARSE_REAL
" ."
AFX IDP PARSE INT RANGE
" %1
AFX_IDP_PARSE_REAL_RANGE
AFX_IDP_PARSE_STRING_SIZE
AFX_IDP_PARSE_RADIO_BUTTON
AFX_IDP_PARSE_BYTE
AFX_IDP_PARSE_UINT
AFX_IDP_PARSE_DATETIME
AFX_IDP_PARSE_CURRENCY
AFX IDP PARSE GUID,

" %1 %2."
" %1 ."
" ."
" 0
255."
" ."
" / ."
" ."
" GUID."

13.
AFX_IDPJPARSE_TIME,
AFX__IDP_PARSE_DATE,

435

" ."
" ."

#ifndef _AFX_NO_OLE_RESOURCES
// , OLE
AFX_IDS_PASTELINKEDTYPE
" %s"
AFX_IDS_UNKNOWNTYPE
" "
AFX_IDP_FAILED_TO_NOTIFY
AFX_IDS_NOT_DOCOBJECT

"%1\
., ,
."
"
."

#endif /7!_AFX_N0_0LE_RES0URCES
AFX_IDP_NO_ERROR_AVAILABLE

" ."

#ifndef _AFX_NO_CFILE_RESOURCES
AFX_IDP_FILE_NONE
AFX_IDP_FILE_GENERIC

" ."
"
%1."
AFX_IDP_FILE_NOT_FOUND
" %1 ."
AFX_IDP_FILE_BAD_PATH
" %1 ."
AFX_IDP_FILE_TOO_MANY_OPEN " %1 ,
."
AFX_IDP_FILE_ACCESS_DENIED " %1."
AFX_IDP_FILE_INVALID_FILE
" %1 ."
AFX_IDP_FILE_REMOVE_CURREN'T " %1 ,
."
AFX_IDP_FILE_DIR_FULL
" %1 ,
."
AFX_IDP_FILE_BAD_SEEK
" %1 "
AFX_IDP_FILE_HARD_IO
" %1
/."
AFX_IDP_FILE_SHARING
" %1
."
AFX_IDP_FILE_LOCKING
" %1
."
AFX_IDP_FILE_DISKFULL
" %1
'."
AFX_IDP_FILE_EOF
"
%1,
."
AFX_IDS_UNNAMED_FILE
" "
#endif // ! AFX NO CFILE RESOURCES

III. Visual C++

436

AFX_IDP_ARCH_NONE
AFX_IDP_ARCH_GENERIC
AFX_IDP_ARCH_READONLY
AFX_IDP_ARCH_ENDOFFILE
AFX_IDP_ARCH_WRITEONLY
AFX_IDP_ARCH_BADINDEX
AFX_IDP_ARCH_BADCLASS
AFX IDP ARCH BADSCHEMA

" ."
"
%1."
" %1,
."
"
%1, ."
" %1,
."
" %1 ."
" %1 ."
" %1 ."

tifndef _AFX_NO_MAPI_RESOURCES
// MAPI
AFX IDP FAILED MAPI LOAD

"
."
"
DLL
AFX IDP INVALID MAPI DLL
."
AFX_IDP_FAILED_MAPI_SEND
" Send Mail
'
."
#endif //! AFX NO MAPI RESOURCES
#ifndef _AFX_NO_OCC_RESOURCES
AFX_IDS_OCC_SCALEUNITS_PIXELS
#endif /7 !_AFX_NO_OCC_RESOURCES

" "

ftifndef _AFX_NO_SCRIPT_RESOURCES
AFX_IDP_SCRIPT_ERROR
"%1: %2\ ?"
AFX_IDP_SCRIPT_DISPATCH_EXCEPTION " : %1"
#endif //!_AFX_NO_SCRIPT_RESOURCES
AFX_IDS_CHECKLISTBOX_UNCHECK "He "
AFX_IDS_CHECKLISTB'OX_CHECK
""
AFX_IDS_CHECKLISTBOX_MIXED
""
END


,
, .

,

13.

437

.
, . Help , :
IDR_HELPTYPE "\1\1\
(.txt)\n.txt\nHelp.Document\nHelp Document"


, MFC, , , ,
. ,
Open ().


Visual C++
, , . ?,
.
? Help:
1. File | Open Solution ( | ) Open Solution ( )
Help ().
2. Help () Open
().
3. Resource View - Help ( ) Workspace
( ). , , Help.rc , . 13.18.
4. Help.rc
"" Help.rc.
Resource View - Help ( ) .
5. Help.rc, Menu ()
iDRHeipTYPE. .
6. ?.
" ", "& "
<Enter>.
7. , .

438

III. Visual C++


[Resource View - Help
- D Help.rc
;
Open In another editor

. 13.18. Resource View - Help


8.
.
9. Properties ().
Properties ().
10. ID ( ) ID_NEW_HELP Save All
( ) Standard (). , , .
11. Prompt () " \".
12. Class View ( ), Help
() CHelpView.
13. Properties () Events ().
, .
14. ID_NEW_HELP, COMMAND
OnNewHelp.
15. Class View ( ) CHelpView
OnNewHelp. HelpView.cpp
OnNewHelp.
16. OnNewHelp 13.2.
i 13.2. CHelpView: :OnNewHelp
// CHelpView
//
void CHelpView::OnNewHelp(void)

13.

439

WinHelp(HID_NEW_HELP);

17.
#pragma once

HelpView.h

#define HID_NEW_HELP 0x01


18. File | New | File. ( | | ). New File ( ), . 13.19.

Categories:

Templates:

C++ File
()

Header File Midi File (.idl)


(.h)

I
Resource File
(.re)

Bitmap File
(.bmp)

Cursor File
(.cur)

j \
Icon File (.ico)

Resource
Template ...

zl

I Creates a C++ source file.


Open

Cancel

Help

. 13.19. New File


19. General ( ), Templates
() Text File ( )
Open ().
.
20.
HID NEW HELP

0x01

21. . Microsoft Development Environment, . 13.20 .


22. Yes (). Save File As ( ), . 13.21.
15 3. 629

III. Visual C++

440

IMicrosoft Development fnv


gave changes to the following items?

No

Yes

Cancel

Help

. 13.20.
Microsoft Development Environment

ISaveFileAs
Save in:

History

j _J Visual Studio Projects


U Brush
I Console
_1|DDB
li Dialog

C-J ' Tools'

DSheet
_J Text
QlTool
Cj VSMacros

ZJDIB

My Projects

Desktop

Favorites

JjEditApp
JjHelp
JjLme
_llList
JjMDI
JMuIti
JjPimt
_LjProgress
* 1 RichApp

File name:
Save as type:TextFtes

Save

. 13.21. Save File As

23. /Help, /hip,


Save as type ( ) All Files ( ), File name ( ) NewHelp.hm Save ().

13.

441

24. Solution Explorer ( ),


Source Files ( )
Help.hpj. .
25.

# include <NewHelp. hm>


.
ID_NEW_HELP cwinApp: :WinHelp HID_NEW_HELP.

, :
.
HelpAppView.h NewHelp.hm.
-
HelpApp.hm NewHelp.hm . NewHelp.hm
, HelpApp.hpj.
,
, .


, ,
. , , , .
Help ,
:
1. Help Resource View ( ).
2. Help.rc, Menu ().
3. iDRHeipTYPE.
.
4. " ",
,
"&"
<Enter>.
5. ,
.

442

III. Visual C++

6. "
", .
7. "&"
<Enter>.
8.
Properties ().
9. Properties () ID ( )
ID_DEMO_DIALOG <Enter>.
10. Prompt () " \".
11. Class View ( )
Dialog () Insert Dialog ( ).
12. .
13. .
14. Properties () ID ( ) IDDDEMO, Caption () " ".
15. Context help ( ), , ID ( ), True ().
16. Toolbox () Button
() Cancel
().
17. Properties ()
ID ( ) IDCCONTEXT, Caption () "&".
18. Cancel () Caption () Properties () "&".
19.
Add Class ( ).
Add Class - Help ( ), . 13.22.
20. Templates () MFC Class ( MFC)
Open (). MFC Class
Wizard - Help ( MFC), . 13.23.
21. Class name ( ) CDemoDig, Base class ( )
coiaiog,
Dialog ID
( ) IDD_DEMO
Finish (). MFC Class Wizard - Help (
MFC) .

13.

443

I Add Class - Help


Templates:
Add ATL ATL Active ATL Control
Support... Server Pa..,
ffmm

ATL Dialog

ATL MMC
Snapln

ATL MS
Transacti...

ATL OLEDB ATL OLEDB


ATL
Consumer
Provider Performanc.
I Add ATL support to an MFC project.
Open

Help

Cancel

. 13.22. Add Class - Help


|MFC Class Wizard - Help

">

.^, , v :0

iii

Welcome to the MFC Class Wizard


This wizard adds a class that inherits from MFC to your project. 0D
o
tins may change
depending on the base class selected.
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ " Class name:

secalss:

CWnd

^^^^^^^^^^|.Hhe
j:
^^^^^^^^^^^^|.CPPelfi:

A
J

^^^^^^H

D
.HTMLresourceID:
1
H
.TMfile:
1
Automato
in:
None

Automation
Creatable by type ID
'

^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ~ Active accessibility

Finish

.,

,,.<....>,

Cancel

. 13.23. MFC Class Wizard - Help

Help

444

III. Visual C++

22. Class View ( ), Help


() CHelpView.
23. Properties () Events ().
, .
24. ID_DEMO_DIALOG,
COMMAND
.
HelpView.cpp .
25. OnDemoDialog 13.3.
I 13.3. CHelpView: :OnDemoDialog
i

j
i

//
void CHelpView::OnDemoDialog(void)
{
CDemoDlg dig(this);
dig.DoModal();

26. #include "Heipview.h"


iinclude "DemoDlg.h"
27. DemoDlg.h
CDemoDlg .
afx_msg

BOOL OnHelpInfo(HELPINFO*);

afx_msg

v o i d OnContextMenu(CWnd*, C P o i n t ) ;

DECLARE_MESSAGE_MAP()

28. #pragma once :


#define HIDD_CONTEXT
2
idefine HIDD_CONTEXT_OK
3
#define HIDD_CONTEXT_CANCEL

29. DemoDlg.cpp CDemoDlg .


BEGIN_MESSAGE_MAP(CDemoDlg, CDialog)
ON_WM_HELPINFO ()
ON_WM_CONTEXTMENU()
END_MESSAGE_MAP()
30. :
s t a t i c DWORD aHelpIDs[] =

13.

445

IDC_CONTEXT, HIDD_CONTEXT,
IDOK, HIDD_CONTEXT_OK,
IDCANCEL, HIDD_CONTEXT_CANCEL,
0, 0
};

31. // CDemoDlg message handlers 13.4.


j 13.4. CDemoDlg: :OnHelpInfo

// CDemoDlg
//
BOOL CDemoDlg::OnHelpInf(HELPINFO* lpHelpInfo)
{

if(lpHelpInfo->iContextType == HELPINFO_WINDOW)
: :WinHelp ({HWND) lpHelpInfo->hItemHandle,
AfxGetApp()->m_pszHelpFilePath,

HELP_WM_HELP,

(DWORD)

aHelpIDs);

r e t u r n TRUE;

void CDemoDlg::OnContextMenu(CWnd* pWnd, CPoint /*point*/)


{
::WinHelp((HWND) *pWnd, AfxGetApp()->m_pszHelpFilePath,
HELP__CONTEXTMENU, (DWORD) aHelpIDs);

32. NewHelp.hm
HIDD_CONTEXT
0x02
HIDD_CONTEXT_OK
0x03
HIDD_CONTEXT_CANCEL 0x04

.
DemoDlg.cpp aHelpIDs,
.
.
NewHelp.hm.
, HelpApp.hm.
Properties () HelpID ( ) (

446

III. Visual C++

True (),
,
,
.
WinHelp. cwnd: :OnHelpinfo
<F1>.
, ,
, , ,
winHeip. WinHelp
, cwinApp: : winHeip .
cwnd: :OnContextMenu
. - , winHeip>


Visual C++
, rtf,
.



:
1. Microsoft Word,
Start () .
2. | (File | Open) .
3.
RTF, , . 13.24,
.
4. | (View | Footnotes).
, . 13.25.
5. | (Tools | Options),
.

13.

447

Qafxcore
Qafxprn
it

hip

...

, :
: I

/:

_] : |

: :

[ : 2,
. 13.24.
W Microsoft Word - afxiore.rtf
'Q " >
, D * , ' <?4 <(?

I 13

<$

IT

(3

, footnote referen-

#YourApp-Help-lndexu
I

HowTo-..
- add you rapplicati on-speoif io"how to" topics here>>H
1
Commands^
* RIB mBnumsn filnil
-
-
-
-
-

Frtit- BilitH
-
ViBw-menumBnii viswT
Wlntlnwmennmsnii wirnlowffl
HBln hBlnil
-

FilemenircommandsH
The File menu offers thefollowinq commands:!!

files: managingl
*Filemenucommandslf

i . 1

1(65

. 13.25.

III. Visual C++

448

6. (View) , . 13.26.

| ] |

[| I | | |

"

"

"

f?

F?

"
"
"

"
"
J7

* [

| ,

"

. 13.26.
. .
,
:
#,
winHelp ;
$, - ;
, Index ( )
Help Topics ( );
,
, Index ( )
Help Topics ( );
+, ;

13.

449

!, ,
;
*,
;
>, , .
, , .
, , .
, , ,
.
, .
MFC Application Wizard
,
,
. , : .
, ,
. MFC Application Wizard
.
, , MFC Application Wizard.
, ,
:
<< >>;
, , , , ,
;
<<YourApp>>, , ;
Record menu,
.

450

III. Visual C++


afxcore.rtf :
# YourApp
...

file
edit
view
window
help


# $
:
FILE NEW
FILE OPEN
FILE CLOSE
FILE SAVE

.
.
.

.
FILE SAVE AS '
.
FILE PRINT
.
FILE PRINT PREVIEW

.
FILE PRINT SETUP
.
...HID FILE SEND MAIL
.
EXIT
YourApp.

"

:
EDIT UNDO

13.

451

EDIT CUT



.
EDIT COPY

.
EDIT PASTE

.
EDIT PASTE LINK
.
OLE INSERT NEW
,
.
OLE EDIT LINKS

.

'
:
VIEW TOOLBAR


.
HID VIEW STATUS BAR
.

"
, :
WINDOW NEW
WINDOW CASCADE
WINDOW TILE


.
.
.

WINDOW ARRANGE
.
WINDOW SPLIT
.
1, 2, ...HID WINDOW ALL

.

"

452 III. Visual C++


, :
HELP INDEX
.
ABOUT
.

* * ( )

YourApp.
1 HIPP NEWTYPEDLG. ,
.

FILE OPEN.

:

{bmc filenew.bmp}

CTRL+N


"
,
.
>
, :
,

*

* ( )

. .
. .
1, 2, ... HID WINDOW ALL.
1 FILE NEW.

13.

453


: {bmc fileopen.bmp}
:
CTRL+O

"

:

, .

.

, .
:
, .

, .

* ' ( )
,
. , YourApp , . , 1 HIPP FILESAVE,
.
.


:
{bml scmenu.bmp}

# 5 ( )
.
YourApp TaAFX_HIDD_FILESAVE, .

454

III. Visual C++


, FILE SAVE AS.

:
:

{bmc filesave.bmp}
CTRL+S

" * ( )

.
HIPP FILESAVE .

FILE SAVE.

'' ( )
. , . ,
, , .

"

, :

, ,
.
,
.
.

, .
:
, .

,
.

13.

455

,
OFN_ OPENFILENAME, CFileDialog.

# $ 1, 2, 3, 4 ( )
, , , .
Shift .

* $ ( )

YourApp. YourApp , ..

:
,
.
{bmc appexit.bmp}
: ALT+F4

" ( )
. , .
, , .

: {bmc editundo.bmp}
:
CTRL+Z
ALT+BACKSPACE

'' ( )
.

456

III. Visual C++


^ ( )

. , .
.

:

{bmc editcut.bmp}

CTRL+X

<< >>
" ( )
.
, .
.

:

{bmc editcopy.bmp}

CTRL+C


'' ( )
.
, .

:

{bmc editpast.bmp}

CTRL+V


* * ( )
,
Y o u r A p p , . .

13.

457

. HIDW TOOLBAR.

" *
{bml hlptbar.bmp}
.
.
YourApp.
, ,
.

. >>

{bmc filenew.bmp} .
{bmc fileopen.bmp} .
YourApp
, .
{bmc filesave.bmp}


. ,
YourApp
.

{bmc fileprnt.bmp}

{bmc editcut.bmp}

{bmc editcopy.bmp}

{bmc editpast.bmp}

{bmc editundo.bmp}

.
: .

{bmc recfirst.bmp)

458

III. Visual C++

{bmc recprev.bmp}

{bmc recnext.bmp}

{bmc reclast.bmp}

* ( )

,
, .

.
. 1 HIDW STATUS BAR.

* '
{bml hlpsbar.bmp}

Y o u r A p p . , ,
.

.
, .

, :

Caps Lock.

NUM

Num Lock.

SCRL

Scroll Lock.


* ( )
.
. ,

13.

459

, . .

' ( )
.
<<
' ( )

.

" ( )
,
( ).

^ ( )
,
( ).

^ ( )

. , ,
.

* ( )
. .
Enter. Esc
.

460

III. Visual C++

.

^ 1,2,... ( )
<<YourApp>>
. .
.

' ( )

.
.

.

' ( )

.

' ( )

YourApp.

**
{bml curhelp.bmp}
YourApp.
.
YourApp window.

13.

461

SHIFT+F1


"
.

.
.
.
: .
:
{bmc bullet.bmp}

{bmc bullet.bmp}

{bmc bullet.bmp}

{bmc bullet.bmp}

{bmc bullet.bmp}

{bmc bullet.bmp}

{bmc bullet.bmp}


*
. ,
,
. .

,
.

* ( )
, ,
. .
{bml curarw4.bmp}

462 III. Visual C++


:
1. (, ,
) ,
.
2. .
3. ENTER, .
: ,
.

:

,
, , .

<< >>
* ( )
, ,
. .
{bmc curarw4.bmp}
: ,
.

:

CTRL+F7

>>
"' ( )
YourApp .

:

{bmc scmin.bmp}
.

ALT+F9


" ( )

13.

463

,
.

:

{bmc scmax.bmp}

.

CTRL+F10 .


' ( )
.
Y o u r A p p .

CTRL+F6

<<
' ( )
.
<<YourApp>> .

SHIFT+CTRL+F6

<<
' ( )

.
.
(bml appexit.bmp}
: ,
I .

464

III. Visual C++

CTRL+F4
ALT+F4 YourType


" ( )
.

' ( )
Windows.

:

CTRL+ESC


'^ ( )
. >>

**
.

**
<< .

*' ( )
.

13.

465

>>
"'
.

*^ ( )
.

"*
.

*' ( )
.

:

F4


"' ( )

.
!
"' ( )
.

'''
<< .

466

III. Visual C++


^
.
>>
*

, .

'
.

*
.
,
, AFX_HIDP_xxx [ALIAS] HPJ,
AFX_HIDP_xxx. ,
AFX_HIDP_INVALID_FILENAME
.


.

.

:
# AFX HIDW DOCKBAR
,
5

13.
* menu_edit
* menu_view
menu_window
* menu_help
* HID_FILE_NEW

$
#


I
HID_FILE_SAVE_AS

AFX_HIDD_FILESAVE
* HID_FILE_MRU_FILE1

, 1, 2, 3, 4
* HID_APP_EXIT


5
I
HID EDIT REDO

* HID_VIEW_TOOLBAR

$
I

467

468

III. Visual C++

HID_WINDOW_TILE .
# HID_WINDOW_TILE_HORZ
#
HID_WINDOW_TILE_VERT
#
HID WINDOW ARRANGE


* HID_HT_CAPTION
1
scrollbars

|
* AFX_HIDD_FONT
5

$

13.
$

469

HID_EDIT_CLEAR

* HID_EDIT_CLEAR_ALL
I
?

HID_PREV_PANE

AFX_HIDP_default
#

AFX_HIDW_DOCKBAR_TOP

afxprint.rtf.
:

# $
( )
.
1 HIPP PRINT, , , ,
, .

:

{bmc fileprnt.bmp}

CTRL+P

470 III. Visual C++


, :

.
.
.

AFX HIPP PRINTSETUP,'
.

,
"" "".

,
,
.
<< >>

YourApp
. , , .
{ ).

ttK S
( )
, .
, ,
. HIDW PREVIEW BAR. , , ,
.

13.

471


# $ _


:

/
.


.
>>
# $
( )
.
npnHTepaAFX HIPP PRINTSETUP.


:

,
, .


( ).


, .

16 . 629

472

III. Visual C++


( ,
).

,
, .

t$

( )

<< .

:
* HID_FILE_PRINT

* AFX_HIDD_PRINT
* AFX_HIDD_PRINTDLG
* HID_FILE_PRINT_PREVIEW

*
* HID_FILE_PRINT_SETUP

AFX_HIDD_PRINTSETUP

HID__FILE_PAGE_SETUP

cnt hpj.
, . Help.cnt, hip , :
:Base Help.hip
1
2 = file

13.
2
2
2
2

473

ripaBKa=menu_edit
Bi4fl=menu_view
= window
=_1

1 >>
2 cnpaBKM=main_index
Help.hpj, ,
TITLE=Help A p p l i c a t i o n Help
1= HELP
, ,
.
, ,
( , ). - (,
( ) , ).
- Y o u r A p p ,
.
. , MFC Application Wizard. ,
Microsoft. . ,
.


RTF. Visual C++ , .

"" .
. afxpriv.h.
TN028 Context-Sensitive Help Support
( ) Visual C + + .

(hm), Visual C++. resource.h , Visual C++ MakeHm. MakeHm resource.h -

474

III. Visual C++

hm, [MAP] hpj. ,


resource.h :
#define IDD_ABOUTBOX
100
define IDR_MAINFRAME
128
#define IDR_DEMOAPP
129
ttdefine IDM_FIRST
0X9000
#define IDM_SECOND
0X9001
#define IDM_THIRD
0X9002
hm :
// (ID_* and IDM_*)
HIDM_FIRST
0X19000
HIDM_SECOND
HIDM_THIRD

0X19001
0X19002

// (IDP_*)
// (IDR_*)
HIDR_MAINFRAME
0x20080
HIDR_DEMOAPP
0x20081
// Dialogs (IDD_*)
HIDD_ABOUTBOX
0x20064
// (IDW_*)

, AppWizard. .
[FILES] (
hpj).
, :
1. Help.
2. Solution Explorer ( ), Help (), Source Files ( ).
3. HelpApp.hpj. .
4. [FILES] HelpApp.hpj
help.rtf

5. Visual C++ MS Word.

13.

475

6. afxcore.rtf help.rtf.
7. , ,
.
8. afxcore.rtf
help.rtf .
* *
:
1 DEMO DIALOG

# $ ( )
,
.

'' ( )
,
.

'' ( )

.

'' ( )

.

# $
.
.

476

III. Visual C++


DEMO.

"

.
9.

help.rtf .

* menu_demo

HID_DEMO_DIALOG

* HIDD CONTEXT CANCEL

* HIDD_DEMO
10.

<F5> Help.

. | .
.
12. ( , ).
.
13. .
, . 13.27.
14.
? | . HELP, . 13.28.
15. .

13.

477
'JPlxJ
"

^!^^^^^^^^^^^'^?^:-^:.-^'' '.'".

"

-|p.l.xjj

i v
lfei,:^i^V;.t:>;.A:
. /'. " ' .' -XI-=J
OK j

(
)

, .

Fl

. 13.27.

File Edit Bookmark Options Help


Contents] jndex [ ;

Print

.
.
.

. 13.28. HELP


, . , -

III. Visual C++

478

, MS Word.
:
1. , ,
, .
2. | .
3. , . 13.29, ( ) .

-f [_6 ]

-
- <
I, 2, 3, ...

... 1

| ... |

. 13.29.
4. ( ).
5.

footnote reference ( ).
6. . 5 .
, <Ctrl>+<Shift>+<D> :
1. | . , . 13.30.
2.

. .

,
<Ctrl>+<Shift>+<H>
:
1. | . .

13.

479

2. .
.

| ) ]
:

:
|

Pragmatica
Symbol
Tahoma
Thames

|(^)

;
"
~
" "
"
"

"
:
s
~^
~* '
'

3
"
"
"
"~ ' "

"~~*~

Times New Roman

TrueType. , .
...

. 13.30.

^|

,
.
, ,
.
<Ctrl>+<Enter>
:
1. | . , . 13.31.
2. . .

III. Visual C++

480

" ;

* !


*
f~"

. 13.31.



RTF
.
, .
, .
, . hip. :
{ }


. BMROOT [OPTION] hpj.
. . 13.3.
13.3.

bmc

bml

bmr

Visual C + + 6.0 (SHEb.EXE). bmp,


dib wmf, . (SHG).
Visual C++ 7.0 .

13.

481

,
RTF
().
. ,
, .


,
WinHelp . 50
WinHelp, . :
;
;
;
WinHelp.
hpj, rtf . [CONFIG],
WinHelp. - ,
. (!). , .
:
char macroName[] = "HelpMacroO";
WinHelp(hWnd, "DemoApp.hlp", HELP_COMMAND,
reinterpret_cast<DWORD>(macroName));



Help Workshop. Visual C++ 6.0
, .
Visual Studio.NET .

Help Workshop:
1. Visual C++
Start | Run ( | ).
Run (), . 13.32.

482

III. Visual C++

. 13.32. Run
2. Browse (). Browse
(), . 13.33.

. 13.33. Browse
3. hcw.exe ( C:\Program Files\Microsoft Visual Studio.NE1\Common7\Tools),
Open (). Open () Run ().
4. . Help Workshop.
5. File | Open ( | )
Open () .
6. hip , Help Contents

13.

483

(*.cnt) ( )
HelpApp.
7. , . 13.34.

UJ Ete * w ffindow lest

1
[?'
,..,
;?

Remove
;

[?
j?
,,'
UJ
[?' >>

Add ...
.
Add Below...
- ____ - ____
Move Bight
MoveLefl

Ready

. 13.34.
8. Add Above ( )
( Add Below ( )). Edit Contents Tab Entry (
), . 13.35.
9. Title () ,
Topic ID ( ) menu_demo. .
10. Add Below ( ).
11. Edit Contents Tab Entry (
)
Heading () Title ()
" " ( ). .

III. Visual C++

484

<"* Heading

( Jopio

< yacro

" Include

Title:
Topic ID:
Help file:
Window type:
|

Cancel

. 13.35. Edit Contents Tab Entry


12. Add Below ( )
Edit Contents Tab Entry ( ) Title () "
", Topic ID ( )
HID_NEW_HELP. .
13. Remove ().
- .
14. .
15. .
Microsoft Help Workshop ( Microsoft) .
16. Yes () Microsoft Help Workshop
( Microsoft) Help Workshop.
17. Visual C++. Microsoft Development Environment ( Microsoft) , Help.cnt ,
, , . 13.36.
Microsoft Development

J<J

E:\Documents and 5ettings\Nick\My Documents\Visual 5tudio Projects\Help\hlp\Help.cnt

This file has been modified outside of the source editor,


Do you want to reload it?
f
i

v,
Yes
lies

i;,

Yes to 11

No

No to All

. 13.36. Microsoft Development Environment

13.

485

18. Yes () Help.


19. ,
.

HTML
HTML
. , ActiveX, HTML (DHTML).
Microsoft HTML
. WinHelp,
HTML Help , ,
.
, .
HTML , Internet . . 13.4
HTML.
13.4. HTML

,
, .

,
HTML

,
(), ,

JPEG,

HTML

GIF, PNG

ALI




,
.
Internet
Explorer

WinHelp, HTML Help . -

486

III. Visual C++

, ,
HTML Help Workshop. ,
WinHelp.
WinHelp HTML
Help
HTML, , , . HTML HTML Help Workshop ,
, , , , , Web. htm. ,
HTML .
chm , Web-. ,
, . ,
, . chm , Web- .



, HTML Help Workshop WinHelp .
,
, , .
WinHelp HTML, .
, , , . ,
, HTML
cwinApp: :EnabieHtmiHeip. ,
(
makehelp.bat, HTML
makehtmlhelp.bat).

13.

487

HTML , .
:
1. , 1
HTML, MFC Application Wizard
( MFC) Finish ().
2. Advanced Features (
), Context-sensitive Help (
), HTML Help format ( HTML) Finish ().
3. HTML.rc , ,
Help.rc .

^j]

, .
4. res Help HTML.
5. , Help.
6.
, Help.
7. DemoDlg.cpp DemoDlg.h Help
.
8. Solution Explorer ( ) Class View (
) Project | Add Existing Item ( ). Add
Existing Item - HTML ( ),
. 13.37.
9. DemoDlgxpp DemoDlg.h
Open ().
Solution Explorer ( ).
HTML .
Help
HTML Help:
1. Start | Run ( | ).
Run ().
2. Browse (). Browse
().

III. Visual C++

488

xj

(Add Existing It en1 - HTML


Look in:
!LJ HTML

.4
*** {
My Projects

Desktop
1
_ )
Favorites

^ x H, H '

:r>] MainFrm.h
ih] Resource, h
|e3 stdafx.cpp
|K]stdafx.h

HTML.cpp
^ HTML.h
99HTML.rc
S3 HTMLDoc.cpp
[K] HTMLDoc.h
i] HTML View, cpp
Ih] HTMLView.h
3 MainFrm.cpp
Filename:

Li

M
History

I Debug
JJhlp
_Jres
^3 ChildFrm.cpp
J*} ChildFrm.h
J53 DemoDlg.cpp
ih] DemoDlg.h

Files of type: jvisual C++ Files

Open i' |
Cancel |^

. 13.37. Add Existing Item - HTML


3. hhw.exe ( C:\Program Files\Microsoft Visual Studio. NET\Visual Studio
SDKs\HTML Help 1.3 SDK\workshop), Open
(). Open ()
Run ().
4. . . HTML Help Workshop.
5.. File | New ( | )
New () . New
(), . 13.38.

Specify what to create:


Text

HTML File
Table of Contents
Index
Cancel

. 13.38. New

13.

489

6. Specify what to create ( ) Project () . New Project ( ) HTML Help Workshop


, . 13.39.

1
ai*

**

' ''1
*i'

i
i
i
!

W e l c o m e to the n e w protect wizard


will

T U b

h e l p y o u to

wizard

n e w

c a n convert

I hp|] proiect
H T M L files

create

This wizai J
Help

proi

existing W i n H e l p

It w i l l c o n v e i i t h e R T F f i l e s t o

the

h p | tile t o a n

an

H T M L

c n t file t o a n

h h p trie

Select

h h c file, a n d t b *
the c h e c k boy

b e l o w if y o u a r e c o n v e r t i n g a n e x i s t i n g p r o i e c t

Convert WinHelp proiect

j|_

Next>

i =41.-1

i
\

- *"*
--.'-

. , . "' ft

. 13.39. New Project


7. Convert WinHelp project ( WinHelp)
Next (). New Project ( ) , . 13.40.
8.

Browse (),
Specify where your WinHelp project file is located ( WinHelp). Open (),
. 13.41.

9. hip Help,
Help () Open ().
.
10. Browse (),
Specify the name of the project (.hhp) file and where you would like to be created

III. Visual C++

490

( ).
Open ().
New Project Source and Destination PicAitl
Specify where your WinHelp project file is located:
firowse...

Specify the name of the project (.hhp) file and


where you would like it to be created.
Biowse...

<Back

Next>

Cancel

. 13.40. New Project

Look in: | <2j My Documents

ZJ

;*JMy Pictures
I ] Visual Studio Projects

File name:
Files of Jype:

flpen
] Project Files (",hpj)

Cancel

. 13.41. Open

11. hip HTML, Help


() Open ().
.

13.

491

12. Next () New Project ( ). , ,


.
13. Yes (). New Project ( )
, . 13.42.
New Project Finish
The wizard wn
i now create a new HTML Hep
l
project. If you need to make any changes, click
Back. Otherwise, click Finish to create your project.

< gack If finish ]j

Cancel

. 13.42. New Project

14. Finish (). HTML


, HTML Help Workshop
, . 13.43.
15. html\afxcO8.htm. , . 13.44.
16. "Windows-1252" "Windows-1251".

^ 7

^|


HTML, , ,
Visual Studio.NET, , .

17. HTML.
<Title> (untitled) ,
rtf .

^7

,
.
Context .

III. Visual C++

492
li?HTMt Help Workshop
Fe Vmt Test Toosl Hep
l
| Contents! Index |
IOPTIONS)
CompaUyi.iorWei
Compe
lid He-HTMLcnm
Default lopc
i -hlmlWxcClwcurtim
Dsipa
l y compe
li progress-No
Index lie.Help.hhk
LanguaQe*0x419 Russa
in
IFILES]
htm\lafxc0wc9.htm
htrdWxc0c4.lht.m
htmW
l xcO853.htm
hrm\lafxc9ck.htm
htm\lafnc181c.htm
hlml\alc72d3.Nn
i
htm\laxlc14vb.htm
htm\laJxc8rhq.htm
htm1Wxc31tn.htm
html\afxc459.htin
htm\lafxc9yO5.htm
htm\lafxc30M.htm
htrdSafxcOqss-Mm

"!'.. - -./ '"-'.''

ntm\laf*c7b4k.htm
E:\Doam
i ensi and SetlHgs\l*k\My oocuments\VslualStucfo Prae
js\HTML\hp
l \HTML.hhp
. 13.43. HTML Help Workshop

1 * lags Selw Tjst Toosl Mndow Hepl


D|cSj 4f|v| jg|]

<IDOCTYPE HTML PUBLIC "-/AV3C//DTD HTML 3 Fmal//EN">


<HTML>
<HEAD>
<META HTTP-EQUIV-"Content-Type" Content-"text/html.
charsel-Wmdows-1252">
<TITLE>(Untitled)<fl"ITLE>
</HEAD>

PO
'e
i clj Contents | Index j
l!?l [||>1
OPTIONS] 1 or later
1Comptedlile-HTMLchm
"1.
IS
_;
Jj
Hi
"ftl
'

Defaull 1-1\(:8 him


Display compile progress-No
Index fte-Help hhk
Language-0419 Russian

<BODY BGCOLOB>"#FFFFFF" TEKT-"#0000[)0">


<PxA NAME-"main_index"x/AxB>&lt8,ltYourApp&gt&gt </B>
<Bx(ontface-"HelvCyr">npeflMeTHbiCiyKa3eTenri</FONTx/B>

htmJWxc0c4lhtm
htmKa>xc49xO.ritm
htrrftafxcOS53.hrm
html\alxc9ctz.htm
htm^al!(cl81c.htm
hlml\alxc?2d3.htm
htrd\alxcl4vb.htm
htmlVal xc8rhq.htm
htmlWxc9yO5>*ti
hlmlWnc3(M.htm
hlmlSalxcC^ss.rilm
hr.mlWKc48h1.Nm

-Iffl x|

<P><Bxfon(face""HelvCyr">4T0 3TOTaKoe</FONTx/BxB>...
</Bx/P>
<P>8.lt*8.lt<(ontfaceB"HelvCyr">flo6aBbTe
</>&1&1</>
<PxBxfontface-llHelvCyr">KoMaHfibi MeHH)</FONTx/Bx/P>
<><-"(041."><1-"1">
</FONTx/Ax/P>
_J

<PxAHREF="afxc49x0.htm"xfontface-"HelvCyr">MeHro

. 13.44. HTML Help Workshop.

13.

493

,
. .
18. Change project options ( )
, Project ().
Options (), . 13.45.

General ] Files ) Compe


lir | Merge Files |
Title:
f
~
Default file: |htmS
l afxc0wc8.htm
Default wn
i dow: j
International settings
!
Language:
: [Russian
i Font::

zl

Cancel
. 13.45. Options
19. Compiler (), . 13.46, Compile full-text search information (
) . Options () .
20. Contents ().
Table of Contents Not Specified ( ),
. 13.47 .
21. .
Save As ( ), . 13.48.

494

III. Visual C++

21*1
General | Files Compe
lir j Merge Files |
r While compilng, display
! P

Erogiess

Compatibilty: 11.1 or later 3


~ Qon'l include folders in compiled file
Support enhanced decompHation
" Compile full-text search information
17 Create a binary Index
T~ Create a binary IOC (check this for a very large TOC)

OK

Cancel

. 13.46. Options, Compiler


I Table of Contents Not 5
You have not yet associated a table of contents (.hhc) fJe
with this project. You can either create a new contents file,
or specify an existing file.
f* { a new contents file
Open an Existing contents file
OK

Cancel

. 13.47.
Table of Contents Not Specified

22. HTML Save (). , . Yes


(). Contents (),
. 13.49.
23. Insert a page ( ) ,
( ).
Table of Contents Entry ( ), . 13.50.

13.

495

zl * IS *

Save in:

Save {
Cancel I

zi

Fe
li name
Save as type: | Tabe
l of Contents Files (".hhc)
. 13.48. Save As
|/?HTML Help Workshop - {help2sa7]
E2 Ete Edit lags w Tjst Tools dow tje|P

Project Contents 1 indeK |


'
f-j
a
.:

tiff1 x l

< HTML PUBLIC "-/AV3C//DTD HTML 3 2 Final//EN">


<HTML>
<HEAD>
<META HTTP-EQUIV>"Content-Type" Content="texVhtml.
charset-Windows-1251 ">
<-> cnpaBKa</TITLE>
</HEAD>
<BODY BGCOLOR-"#FFFFFF" TEXT-"#000000">
<PxANAME-"hidd demo"x/AxBxfont)ace-"HelvCyr">
cnpaBKa</FONTx/Bx/P>
<(1(-"/>

K H . < / F O N T X / P >

</BODY>
</HTML>

Jll
Ml

. .

' '

.
'

'

"
.

. 13.49. Contents

.
.
'
.
.

^
.'

- '
'
.

. . :;

'..

"

III. Visual C++

496

.- :
Table of Contents Entry -v.:-- :
General j Advanced |
Available information types:
Entry title:
1
Add...

Edit... ]

j?J x 1

Remove |

ilesAJRLs and their information types:

Alternate URL:
Add/Edit... |
OK 1 Cancel
. 13.50. Table of Contents Entry

HTML
,
, .
24. Entry title ( ) "<<Your App>> " Add | Edit
( | ). Path or URL (
URL), . 13.51.
25. HTML titles ( HTML) ( , )
. Files/URLs and their information types
(/URL ) Table of Contents Entry (
) HTML.
26. . .
27. Contents ()
Insert a heading ( ). .
, ,
.
28. No (). Table of Contents Entry ( ).

13.

497

Project file:
fidd...
HTML titles:
(Untitledj
(Untitled)
(Untitledj
(Untitled)
(Untitled)

file or URL:
Browse...

OK

Cancel

. 13.51. Path or URL


29. Entry title ( ) ""
. Contents ()
.
30. .. 2124 "
" ( HTML).
31. .. 2124 "
" ( HTML).
32. .. 2124 "
" ( HTML).
33. .. 2124 " " ( HTML).
34. .. 2124 " " ( HTML).
35. .. 2124 "
" ( HTML).
36. .. 2124 "
" ( HTML).
37. Contents ()
Move selection left ( ).

III. Visual C++

498

. .
38. .. 2124 "
" ( HTML).
HTML Help Workshop
, . 13.52.

File

Edit

Tags

View

Proe
j ct Contents J Index j
?\

Test Tools

Window

UL _.

Youi App>>
^
!j3




|

51

.JflJiSi

Help

<IDOCTYPE HTML PUBLIC '-//W3C//DTD H T M L 3.2 Final//EN">


<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content "text/html;
charsetWindows-12S1">

<-> cnpaBKa<^ITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT-"#000000">
<PxA NAME="hidd_demo"x/AxBxfont face-"Hs|v Cyr">
cnpaBKa</FONTx/Bx/P>
<Pxfontface-"Helv ">

K H . < / F O N T X / P >
</BODY>
</HTML>

E:\Documents and Settin9s\M*\MyDoai^\Vi5ual5tutfraProiects\HTML\Np\HTML.hhp

. 13.52.

39. HTML Help Workshop,


.
HTML
. :
1. Visual Studio.NET.
2. Class View ( ) CHTMLView
onNewHeip. HelpView.cpp
OnNewHeip.

13.

499

3. onNewHelp 13.5.

;
\

j 13.5.
I/ CHTMLView
//
void CHTMLView::OnNewHelp(void)
{
HWND hWnd = AfxGetApp()->m_pMainWnd->GetSafeHwnd();
::HtralHelp(hWnd,
"E:\\Documents and Settings\\Nick\\My DocumentsWVisual Studio P r o j ects\\HTML\\hlp\\HTML.chm::/html\\help7f5c.htm",
HH_DISPLAY_TOPIC, NULL);
}

4. onDemoDialog 13.6.
13.6.

.-. .

//
void CHelpView::OnDemoDialog(void)
{
CDemoDlg dig(this);
dig.DoModal();

5. #include

"HTMLView.h"

#include "DemoDlg.h"
6. DemoDlg.h
# d e f i n e HIDD_CONTEXT
# d e f i n e HIDD_CONTEXT_OK

2
3

# d e f i n e HIDD_CONTEXT_CANCEL

7. DemoDlg.cpp
#include "Help.h"
#include "HTML.h"
8.
13.7.

500

III.

Visual C++

1 13.7.
II CDemoDlg
//
BOOL CDemoDlg::OnHelpInf(HELPINFO* lpHelpInfo)
{
if(lpHelpInfo->iContextType == HELPINFO_WINDOW)
{
return ::HtmlHelp((HWND)lpHelpInfo->hItemHandle,
"E:\\Documents and Settings\\Nick\\My DocumentsWVisual Studio Proj
ects\\HTML\\hlp\\HTML.chm::/ContextHelp.txt",
HH_TP_HELP_WM_HELP, (DWORD)(LPVOID)aHelpIDs) != NOLL;

return TRUE;

void CDemoDlg::OnContextMenu(CWnd* pWnd, CPoint /*point*/)


'{
::HtmlHelp(pWnd->GetSafeHwnd() ,
"E:WDocuments and Settings\\Nick\\My DocumentsWVisual Studio Project s\XHTML\\hlp\XHTML.chm::/ContextHelp.txt",
HH TP_HELP_CONTEXTMENU, (DWORD)(LPVOID)aHelpIDs);

9. File | New | File ( | | ) <Ctrl>+<N>, New File


( ), . 13.53.
10. Templates () Text File (
) Open (). .
11.

.topic 1
,

.topic 2

.topic 3

13.

Categories:

501

flii

Templates:
Text Rle

HTML Page

Frameset

Style Sheet

XML File

XML Schema

jAiih
XSLT Rle

L&2I fish
Bitmap Rle

Icon File

A blank text file.


Open

'|

Cancel

Help

. 13.53. New File


12. File | Save TextFilel As ( |
TextFilel ) , Save File
As ( ), ContextHelp.txt hip .
13. Solution Explorer ( ) HTML Help
Files ( HTML)
HTML.hhp. .
14. , '13.8.
| 13.8. HTML.hhp
ContextHelp.txt
[ALIAS]
HIDR_MAINFRAME = html\afxc0wc8.htm
HIDR_HTML_newTYPE = html\afxc31id.htm
main index
= html\afxc0wc8.htm
= html\afxc4 65u.htm
afx_hidd_color
= html\afxc31ym.htm
afx_hidd_fileopen
= html\afxc48hl.htm
afx_hidd_filesave
= html\afxc2nac.htm
afx_hidd_find
= html\afxc369g.htm
afx hidd font

502

III. Visual C++


= html\afxcl4vb.htm

a fx_hi dd_newtypedlg
afx_hidd_replace

- html\afxc8asl.htm

AFX_HIDP_DEFAULT

= html\afxc9b3o.htm

afx_hidw_dockbar_top
afx_hidw_status_bar
afx_hidw_toolbar
hid_app_about
hid_app_exit
hid_cont ext_help
hid_edit_clear

= html\afxc78sO.htm
= html\afxc72ya.htm
= html\afxc9jci.htm
= html\afxc9vpO.htm
= html\afxc7d4k.htm
= html\afxc9ysw.htm
= html\afxc214i.htm

hid_edit_clear_all

= html\afxc2fsc.htm

hid_edit_copy

= html\afxc7yt5.htm .

hid_edit_cut
hid_edit_find
hid_edit_j?aste

= html\afxc3ewk.htm
= html\afxc4ajo.htm
= html\afxc67ad.htm

hid_edit_redo

= html\afxclcof.htm

hid_edit_repeat

= html\afxc561w.htm

hid_edit_replace
hid_edit_undo
hid_file_close
hid_file_mru_filel
hid_file_new

= html\afxcl21x.htm
= html\afxc8zxr.htm
= html\afxc45r9.htm
= html\afxc590x.htm
= html\afxc72d3.htm

hid__file_open

= html\afxc8rhq.htm

hid_file_save

= html\afxc9yO5.htm

hid_file_save_as
hid__file_send_mail

= html\afxc30hf.htm
= html\afxcOqss.htm

hid_help_index

= html\afxc85dk.htm

hid_help_using

= html\afxcltk7.htm

hid_ht_caption

= htral\afxc4r72.htm

h i d_ht_nowhe re

= html\afxc5zol.htm

hid_next_pane
hid_prev_pane
hid_sc_close

= html\afxcO17p.htm
= html\afxc48o5.htm
= htral\afxc0085.htm

hid_sc_maximi ze

= html\afxc6ztx.htm

hid_sc_minimize

= html\afxclvqd.htm

hid_sc_move

htmlXafxc57j9.htm

hid_sc_nextwindow

= html\afxc33uf.htm

hid_sc_prevwindow

= html\afxc6t2v.htm

hid_sc_restore
hid sc size

= html\afxc5tr9.htm
= html\afxc8 eed.htm

13.
hid_sc_tasklist
= htral\afxclsj8.htm
hid_view_ruler
= html\afxc71o2.htm
hid_view_status_bar
= html\afxc6tv6.htm
hid_view_toolbar
= html\afxc8ble.htm
hid_window_all
= html\afxc9szO.htm
hid_window_arrange
= html\afxc4mn9.htm
hid_window_cascade
= html\afxc9u5h.htm
hid_window_new
= html\afxcOxpz.htm
hid_window_split
= html\afxc5phO.htm
hid_window_tile
= html\afxc3zz9.htm
hid_window_tile_horz
= html\afxc3at6.htm
hid_window_tile_vert
= html\afxcl304.htm
hidr_docltype
= html\afxc31id.htm
menu_edit
= html\afxc4 9xO.htm
menu_file
= html\afxcOc41.htm
menu_help
= html\afxcl81c.htm
menu_view
= html\afxcO853.htm
menu_window
= html\afxc9ctz.htm
scrollbars
= html\afxclg4z.htm
afx_hidd_print
= html\afxp5hf8.htm
afx_hidd_printdlg
= html\afxp86av.htm
afx_hidd_printsetup
= html\afxpOvjk.htm
afx_hidw_preview_bar
= html\afxp3i9e.htm
hid_file_page_setup
= html\afxp42b4.htm
hid_file_print
= html\afxp225w.htm
hid_file_print_preview
= html\afxp7q2f.htm
hid file_print_setup
= html\afxpO434.htm
HIDD_ABOUTBOX
= html\afxc9vpO.htm
HID_HT_SIZE
= html\afxc8eed.htm
HID_HT_HSCROLL
= html\afxclg4z.htm
HID_HT_VSCROLL
= html\afxclg4z.htm
HID_HT_MINBUTTON
= html\afxclvqd.htm
HID_HT_MAXBUTTON
= html\afxc6ztx.htm
AFX__HIDP_INVALID_FILENAME
= html\afxc0wc8.htm
AFX_HIDP__FAILED_TO_OPEN_DOC
= html\afxc0wc8.htm
AFX_HIDP_FAILED_TO_SAVE_DOC
= html\afxc0wc8.htm
AFX_HIDP_ASK_TO_SAVE
= html\afxc0wc8.htm
AFX_HIDP_FAILED_TO_CREATE_DOC = html\afxc0wc8.htm
AFX_HIDP_FILE_TOO_LARGE
= html\afxc0wc8.htm
AFX_HIDP_FAILED_TO_START_PRINT = html\afxc0wc8.htm
17 . 629

503

504

III. Visual C++

AFX_HIDP_FAILED_TO_LAUNCH_HELP = html\afxcOwc8.htm
AFX_HIDP_INTERNAL_FAILURE
- html\afxc0wc8.htm
AFX_HIDP_COMMAND_FAILURE
= html\afxc0wc8.htm
AFX_HIDP_PARSE_INT
= html\afxcOwc8.htm
AFX_HIDP_PARSE_REAL
= html\afxc0wc8.htm
AFX_HIDP_PARSE_INT_RANGE
= html\afxcOwc8.htm
AFX_HIDP_PARSE_REAL_RANGE
= html\afxcOwc8.htm
AFX_HIDP_PARSE_STRING_SIZE
= html\afxcOwc8.htm
AFX_HIDP_FAILED_INVALT.D_ FORMAT = html\afxc0wc8.htm
AFX_HIDP_FAILED_INVALID_PATH = html\afxc0wc8.htm
AFX_HIDP_FAILED_DJ.SK_FULL
= html\afxc0wc8.htm
AFX_HIDP_FAILED_ACCESS_READ
= html\afxc0wc8.htm
AFX_HIDP_FAILED_ACCESS_WRITE = html\afxc0wc8.htm
AFX__HIDP_FAILED_IO_ERROR_READ = html\afxc0wc8.htm
AFX_HIDP_FAILED_IO_ERROR_WRITE = html\afxc0wc8.htm
AFX_HIDP_STATIC_OBJECT
= html\afxc0wc8.htm
AFX_HIDP_FAILED_TO_CONNECT
= html\afxc0wc8.htm
AFX_HIDP_SERVER_BUSY
= html\afxc0wc8.htm
AFX_HIDP_BAD_VERB

= html\afxc0wc8.htm

AFX_HIDP__FAILED_MEMORY_ALLOC = html\afxc0wc8.htm
AFX_HIDP_FAILED_TO_NOTIFY
= html\afxc0wc8.htm
AFX_HIDP_FAILED_TO_LAUNCH
= html\afxc0wc8.htm
AFX_HIDP_ASK_TOJJPDATE
= html\afxc0wc8.htm
AFX_HIDP_FAILED_TO_UPDATE
= html\afxc0wc8.htm
n
AFX_HIDP_E AILED_TO_REGISTER
= html\afxc0wc8.htm
AFX_HIDP_FAILED_TO_AUTO_REGISTER - html\afxc0wc8.htm
AFX_HIDW_DOCKBAR_BOTTOM
= html\afxc78sO.htm
AFX_HIDW_DOCKBAR_LEFT
= html\afxc78sO.htm
AFX_HIDW_DOCKBAR_RIGHT
= html\afxc78sO.htm
[MAP]
#include HTMLDefines.h
[INFOTYPES]


HTML , . , afxcore.htm afxprint.htm, ,
HTML Help Workshop.

13.

505

15. <F5> .
, . 13.54.

F1

. 13.54.
16. ? | . , . 13.55. .
17. .
18. ? | . , , . 13.56.
19. .
. .
,
. 13.57.

506

III. Visual C++

'^?$^~-

Print

Qplions

Contents | Inde | Search |

YourApp

...

j

:i]

<<
>>

. 1 3 . 5 5 . Help

Hide

Print

Options

Contents | Index ] Search j


+ _ J
[ i ]
![

1
j .

.

. 1 3 . 5 6 .

13.

Hide

Print

507

Qptions

Contents j |Qdex j Search |


Your App*
Qj
+

]
;=]



. >>

.
.

. :

.

:

.

. 13.57.
20. | . .
21. Help ().
.
. , . 13.58.
22. .
, HTML . , (
) . , HTML
,
( ). -, ,
. -,
, ,
. , -, ,

III. Visual C++

508

, .

:-...-..
U '

" >

OK

Aaffay ettiea
erieeb^eoaeuf? aeii dial,
auaanoe yoio oaerio

i
i i [^
f

i
F1

. 13.58.
, ,
MFC Application Wizard HTML.
,
. ,
, , .
, , [ALIAS] (hhp)
.
HTML .
:
I. Solution "Explorer ( ) HTML Help Topics ( HTML)

13.

509

Add | Add Existing Item ( | ). Add Existing Item HTML ( ), . 13.59.

Add Existing Item - WML ;?'?


Look jn:

_ J

HTML

'1 Debug
_ | h l p

} History

I j r e s
|

ChlldFrm.cpp

hlMainFrm.h
'h] Resource.h
jctj stdafx.cpp
ih]5tdafx,h

_hi] C h i l d F r m . h

'

_li

' My Projects

^ D e m o D l g . c p p
:

Ji]DemoDlg,h
cjHTML.cpp

'

*" f\

jV]HTML.h
a

> Desktop

,
_U

i Favorites

HTML.re

HTMLDoc.cpp
i| HTMLView.cpp
JhTJHTMLView.h
G*\ MainFrm.cpp
=

lle name:

Files of type:

Open

Visual C++ Files


...

i" 1

Cancel
,.,',..-.j^

. 13.59. Add Existing Item - HTML


2. \hlp, \html.
3. Files of type ( ) Native Web Files ( Web). HTML.
4. Open ().
.
Edit | Find and Replace | Find in Files ( | |
).
(, ) afxcore.htm
afxprint.htm .
, HTML.
Help, ,
, .

winHelp, HTML HtmiHelp. .

510

III. Visual C++

, : :HtmlHeip . ? |
,

CHTMLView: :OnNewHeip.
( , , ),
::HtmiHeip,
GetSafeHwnd.
: :HtmiHelp HTML, . ( Microsoft).
, Microsoft,
.
,

. HTML .
: :HtmiHeip , . . .
::HtmiHeip . ,
.
cwnd: :OnContextMenu
.
What's This? (
?), - .
OnContextMenu
::HtmiHeip. ::HtmiHelp OnContextMenu.
,
, , OnNewHelp ( ), . , ,
, , , , . 13.58, . , . : :HtmiHelp , .
.
, Microsoft , .
, - 1 .

13.

511

. t o p i c , , .

cwnd: :0nHeipinfo.
HELPINFO. , , iContextType, ,
, . ,
"HtmlHelp, HELPINFO.
, OnContextMenu.
,
.


MFC Application Wizard
User Interface Features ( )
About box ( " "), , ,
.
MFC Application Wizard - New
Specify User Interface Features
Specify options that control the look and feel of your application.

Overview
Application Type
Compound Document Support
Document Template Strings
Database Support
Jser Interface Features
Advanced Features
Generated Classes

* Sboutboii

Dalog title:

Fn
is
ih

Cancel

Help

. 1 3 . 6 0 . MFC Application Wizard - New_Dialog

III. Visual C++

512

MFC Application Wizard User Interface Features ( ) . 13.60.


: ( ).
About ( ) , . 13.61.

Jj

Version 1.0

; '

;|

Copyright () 2001

. 13.61. About
HelpApp
, . J 3.62.

Help 1.0
Copyright () 2001

. 13.62.
, , , , , , ,
.
MFC.

14


. Windows,
,
.
, Visual C + + , , , . 2.

,

, . ,
, Visual C++. :

,
. <F5>
Debug | Continue ( | ). ( Debug
() .
. 14.1);
. <Ctrl>+<Shift>+<F5> Debug | Restart ( | );.
.
<Shift>+<F5> Debug | Stop Debugging
( | );
.
<F10> Debug | Step Over
( | );
, , ,

III. Visual C++

514

(). <FU> Debug | Step Into ( | ). ,


. , , , , . ,
;
-Itflxl

'.. Help - Microsoft Visual C + + { ^


fjle

Edit

Bw

Eroiect

Suild "! Iools

Sffindow

HA

Windows
., i r 1^1

* Continue

i p DemoDlg.cpp

Stop Debugging
IMPLEMENT DYNAMIC (":;
CDemoDlg::CDernoDlg(d

Restart

Shft+F5

CDemoDlg::-CDemoDlgi
(
Step Into
)
Step Over

Ctrl+Alt+E

FU
F10

Value
Type
0x0012fl0c CDataExchange
ux0012r7eC4 CDemoDlg const

0 n j

J MainFrm.cpp
J makehelp.bat
J stdafx.cpp
_ j Header Files

_ J H ='P- h
J HelpDoc h

^j
H

^ 9 Solutio

| jj3 m r i

x"Ouf(tLt

Ijbebug

'Help .cxe ' . Lo a d e i ' ^ : \ " I H _ 0 0 0 ^ s y s t l e 3 2 \ l I l d l c d l l d l l j l


'Help .Be': to aded ' K : \ W I W _ 2 0 0 0 \ s y s t e m 3 2 \ i t t a 3 2 . d l l ' , I
'Help .exe 1 : loaded 'B:\WIH_2000\systeiu32\cottctl32.dll
l.-l

_^

_ J ChildFrm.h
_ J DemoDlg.h

Save Dump As...


l

Autos

Bftutoslq

4- X

_ P Help
_ ^ Souice Files
J*] ChildFrm.cpp
J DemoDlg.cpp
J Help.cpp
J Help.hp)
J Help.rc
J HelpDoc.cpp
J HelpViev.:pp

Disable AH Brea^oints

<|

"Ready"'

3 Solution 'Help' (1 project)

j d

Ctrl+ShiFt+F5

Shift+FH
v o i d CDemoDlg: :DoDatj -" Step Out
Ctrl+Alt+Q
(
W QuickWatch...
C D i a l o g : : DoDataEj
New breakpoint...
Ctrl+B
}
# i Clear All Breakpoints Ctrl+5hift+F9

Name
pDX
thus

^J, pf #

Solution Explorer - Help

_J

: CDialog(CDemon
j
Processes...
Exceptions...

1 1

j'CDemuDlg

English
....

F5

- 3 1 4lt

Ln 23

mi,
Col 1

ii

Output | j j - j 1 L.-I
Ch 1

" INS

. 14.1. Debug

<Shift>+<Fll>
Debug | Step Out ( | )
;

, .
<Ctrl>+<F10>.

14.

515


,
<Ctrl>+<F10>.
. :
;
,
,
;
,

, , , .

<F9>. , <F9>. , ,
.
, .
Debug | Windows | Breakpoints ( | | ). Breakpoints ( ). , , . 14.2 .

4
Name

!--,

11

olumns

Condition

When 'SomeVariabte' changes[ (no condition)


(no condition)
DemoDlg.cpp; line 23

Hit Count

break always 1
break always t

;
J

^J

. 1 4 . 2 . Breakpoints

, , -

516

III. Visual C++

. <F9>
, .
,
Breakpoints ( )
Properties (). Breakpoint Properties
( ), . 14.3.
Breakpoint ProperWe;Si:e3ftii
Function File j Address ]
Break execution when the program reaches this location in a file.
File: | -^Documents and 5etings\Nick\My Documents\Vs
iual 5tudio Proje
Line: 145
Character: 11

Condition.., (no condition)


Hit Count... break always

OK

Cancel

Hep
l

. 14.3. Breakpoint Properties


, . Condition () Hit Count
( ).
Condition () Breakpoint Condition ( ), . 14.4.
, , .
is true ()
, .
has changed ()

14.

517

, . Condition ()
,
.

breakpoint

Condition

'^^

When the breakpoint location is reached, the expression is evaluated and the
breakpoint is hit only if the expression is either true or has changed,
pf? Condition

~"

"" ~ -

""

j!
I (* is true
j f has changed

i
OK

Cancel

Help

. 14.4. Breakpoint Condition



, .
,
, .
Hit Count ( ),
Breakpoint Hit Count (
), . 14.5.

I Breakpoint Hit Count


A breakpoint is hit when the breakpoint location is reached and the condition is
satisified, The hit count is the number of times the breakpoint has been hit.
When the breakpoint is hit:
Jbreak always

Reset Hit Count

jj

!|

Current hit count:

OK

Cancel

He|p

. 14.5. Breakpoint Hit Count

III. Visual C++

518

When the breakpoint is hit (


) .
:
break always ( );
break when the hit count is equal to ;
0 break when the hit count is multiple of , ;
break when the hit count is greater then or equal to
.
Reset hit
count ( ) .
ill

iNew Breakpoint

Function J File | Address Data |


Evaluate the variable while the program is running, and break execution when
the value of the variable changes.
Variable:
Context:

Language:

C++

Condition... 1 C condition)
Hit Count... break always

OK

Cancel

Help

. 14.6. New Breakpoint


, Breakpoints ( ), .
, , . , New () Breakpoints
( ). New Breakpoint ( -

14.

519

). Breakpoint Properties
( ) ,
, , , .
Data (). New Breakpoint
( ) , . 14.6.
, , Variable
(), Items () , . Items () , Variable () .
, , , , , .
. 14.7.

The following breatpomt was hit:


When 'SorneVariable' changes in program '[888] Help.exe: Native
OK
. 14.7.
Microsoft Development Environment
Breakpoints ( ) .
,
.



, ,
, -
.
, .
Visual C++
. 14.8. ( ) , ,

III. Visual C++

520

. . Autos (), Locals ()


Watch (). , Autos () Visual C++
, Locals () , Watch () .

Hep
l - Microsoft Visual C++ foreak] - Hep
l Ve
l wxpp
File Edti Veiw Proe
j ct Bud
li Debug Idols wnidow Hep
l
Program [1248JHep
l .exe: Natvie - Thread [1252] Wni32 Thread
_] & S 4 4i 33
3 Debug
h Hep
l Ve
i w cpp L r -, I- L

^JCHelpView

j j

' a l rHelpView

OnNewHelp (vnid)

/ / TOt'O:

U i n H e l p ( HID NEW_HELP );

I OnDemoDialoq

Act.:', your cotra^:arid liauciier code h e t e

void CHelpView::OnDemoDialog(void)

Name
dig
this

CDemoPlg

IDC_EUTTONi

si
- -~J

1 C
Co
eigan
Tiu
eexstFan
rtio
od
d
n
Td
echn
q
drPo
rga
rmm
ng
i Pracctit
Pe
b
uoo
nig

vsiualSu
tdoi Documeno
a
titnStartPage
Vsn
iutearp
lsrie
C++Sam
Sa
m
es
l
E
p
e
s
lp

dig( t h i s ) ;

Name
:Va
ule
IC
T
ye
p
eo
D
m
O
k._
0x0027
f70
f KHe
plV
eiwhWnd
O
-xOuObO37eCHeplVeit
KDemoDIg hWnd-

Help.e/eiCHelpView::OnDemoDialogO L m e l i e "
C++ _
mfc70d.dl'_AfxDispatchCmdMsg(CCmdTarget pTarget-0x002r77fn + +
mfc70d.dI!CCmdTargeti:OnCmdMsg(unsignedint nID=131, mt nCode C++
mf{:70d.dH!CView::OnCmdMsg(unsigned int nID=131, int n C o d e ^ v( C++
mfc70d dUCFrameWnd'-OnCmdMsgtuhsigned int =131, int nCode C++ T

7] Command..
118 Col 1

'P"
Ch 1

21 T ( L

. 14.8. Visual C++


, Autos () , . ,
.
, . ,
.
Watch ()
.
Name () Watch (), ,

14.

521

, , , Watch ().
,
.
Watch ()
, . . , . ,
r e s u l t HRESULT:
result, hr

S O K ,
Windows OXOOOF WM_PAINT.
:
d, i ;
;
;
, ;
1, h long s h o r t d, i, , , , XJ

[ ;
;
g
, ;
;
s ;
su Unicode;
st ANSI Unicode Unicode
s t r i n g s autoexp.dat;
hr HRESULT Win32;
we Windows;
wm Windows.
. . ,
.
.
Watch () Debug | QquickWatch ( |
), <Shift>+<Alt>+<Q>

III. Visual C++

522

QuickWatch ( ), Debug ().


QuickWatch ( ), . 14.9.
Add Watch ( ) Watch ().

QuickWatch

Expression:

Recalculate

Add Wai
Close
Help

Current value:
Name
E] dig

Value
{CDemoDIg hWnd=uxOOOOOOOO}

: Type
_J
CDemoDb

- CDialog
{CDialog hWnd=Ox0OOOO0OO>
const CDi
dassCDemot {"CDernoDIg"}
const CRi
>
- _rnessageEnl 0x00424598 struct AFX_MSGMAP_EfJTR const AF>
H33 messageMap {...}
const AF>

. 14.9. QuickWatch
, . 14.8, Call Stack
( ), ,
.
, . , , , .

.
.

,
. ,
, . Call Stack ( ), ,
.

14.

523


, .
, Autos (), ,
, .
, , .
, " . .
Data Tip (), .
,

Data Tip ().
.
, .
Registers () . .

. , , . , Watch () Memory
() .
E I P ( ).
, ,
( ).
Memory ()
. , .
,
.
,
, , .
,
, 32- 64 .
ASCII Unicode.

524

III. Visual C++

Disassembly () .
, , . , ,
C/C++.
Call Stack ( ) , , . ,
.
, Call Stack ( )
, .




, ,
.
:
1. Solution Explorer ( ) Class View
( )
Properties () ( Vview |
Property Pages ( | )
<Shift>+<F4>). Help Property Pages (
), . 14.10.
2.

Configuration ()
Debug () ( ).

3. C/C++ General ( ) ( ).
4. Warning level (
). .
5. Level 4.
Property Pages ( ) , . 14.11.
6. .
) .

Help

Property

Pages

14.

525

11111111!&
1 Help Property Pages
, 3
f

<l o n f i g u r a t i o n ;

/jj

xj

jActivei.Debug)

Configuration Properties

J ^ j Platform:

Debug
_J

C/C++

_|

Linker

_ j

Resources

_j
!

MIDL
| Browse Information

_ J

Build E v e n t s

_J

C u s t o m Build S t e p

SDL

Import

_^j

|Active(Wm32^

Configuration Manager

'
!
Intermediate Directory
Debug
i
Extensions to Delete on Clean *.obj;*.ilk;*,pdb;*.tlb;*.tli;'".tlh;t(TargetName) :
Output Dnectory
Debug

Whole Program Optimization


Build Browser Information
Configuration Type
Use of ATL
Minimize CRT Use in ATL
Use of MFC
Use Managed Extensions
Character Set

\
:

No
No
Application (.exe)
Not Using ATL
No
Use MFC in a Shared DLL
No
Use Multi-Byte Character Set

i
;
\
;
,

Whole Program Optimization


Specifies that the program will be optimized across .obj boundaries; works best if
C/C++ optimizations are turned on.

OK

Cancel

Help

. 14.10. Help Property Pages


I Help Property Panes
Configuration: (Active(Debug)
General
Debugging
C/C++
v General
Optimization
Preprocessor
Code Generatio
Language
Precompiled He;
Output Files
Browse Informs
Advanced
Command Line
_J Linker
_J Resources
_JMIDL
1 Browse Information

ZJ Platform: JActive(Win32)

Configuration Manager..

Additional Include Directories


Resolve #using References
Debug Information Format
Compile As Managed
Suppress Startup Banner

Program Database for Edit & Continue (


Not using managed extensions
Yes (/nologo)
| Level 4 (/W4)
Detect 64-bit Portability Issues No
No
Treat Warnings As Errors

Warning Level
Select how strict you want the compiler to be about checking for potentialy
suspect constructs. (/WO - /W4)
Cancel

Apply

Help

. 14.11. Help Property Pages, C/C++

i
:
j

526

III. Visual C++



, .

, . , .
.
, ,
. ,
, . , " ". Visual C++ : Debug
() Release ()
, .

:
;
#def ine _DEBUG;
/
MFC;
.
Visual C++ _DEBUG .

ASSERTw TRACE
ASSERT () , . , lpObject. ,
, . ASSERT, :
ASSERT(lpObject)
, , ASSERT, FALSE,
,

14.

527

. 14.12. , , . Retry () . ASSERT.

Microsoft Visual C++ Debug Lite


Debug Assertion Failed!
Program: .. .\Nick\My Documerits\Visual Studio Projects\Help\debug\Help.exe
File: e:\documents and settings\nick\my documents\visual studio projects\help\helpview.cpp
Line: 9S
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
?0.^

il

Retry

Ignore

. 14.12.
TRACE .
, . , ,
, , , . , ,
, , , .
,
,
,
, , .
TRACE. - TRACE , TRACE, TRACEO, TRACEI, TRACE2 TRACE3. -


.
,
. TRACE
p r i n t f . TRACE
afxDump.

TRACE
. TRACEO, TRACEI, TRACE2 TRACE3

528

III. Visual C++

. TRACE0 CMainFrame: :OnCreate.


if (!m_wndStatusBar.Create(this)

!ra_wndStatusBar.Setlndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{

TRACEO("Failed to create status bar\n");


return - 1 ;

//


:
TRACE2(" %d %s\n", nError, szFileName);
, DEBUG , ASSERT TRACE .
,

.


,
,
.
c o b j e c t : :AssertValid cobject: :Dump,
MFC cobject.
AssertValid
. .
Dump CDumpContext.
:
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
v i r t u a l , , const ,
.
, AssertValid Dump . , .
#ifdef _DEBUG
virtual void AssertValid() const;

14.

529

virtual void Dump(CDumpContext& dc) const;


#endif
. , cobject,
, . , ,
MFC Application Wizard. ,
CMainFrame.
II CMainFrame diagnostics
#ifdef J3EBUG
void CMainFrame::AssertValid()

const

CMDIFrameWnd::AssertValid();

void CMainFrame::Dump(CDumpContext& dc) const


{
CMDIFrameWnd::Dump(dc);
}
#endif //__DEBUG
,
.


, . .
AfxCheckError. ,
SCODE, OLE
MFC .
AfxCheckMemory. , Output ().
.
, .
AfxEnabieMemoryTracking. MFC.
, .

530

III. Visual C++

AfxisMemoryBiock.
,
new.
AfxisVaiidAddress.
. , .
A f x i s v a i i d s t r i n g . , . ,
, - 1 , ,
.
AfxSetAllocHook. ,
. AFX_ALLOC_HOOK.



, ,
, ,
.
: , .
Visual C + + 6.0 AfxDumpStack, , . ,
. :
void AFXAPI AfxDumpStack(DWORD dwTarget = AFX_STACK_DUMP_TARGET_DEFAULT);
dwTarget ,
.
AFX_STACK__DUMP_TARGET__DEFAULT. .
,
.
TRACE, .
AFX_STACK_DUMP_TARGET_TRACE.

, TRACE. ,
, TRACE .
AFX_STACK_DUMP_TARGET_CLIPBOARD. ,
. CF TEXT.

14.

531

AFX_STACK_DUMP_TARGET_BOTH.
TRACE.

AFX_STACK_DUMP_TARGET_ODS. ODS
Win32 outputoebugstring. , , , "" .
, ,
:
;
, ;
;
.
, , Call Stack ( ), ,
. , , imagehlp.dll. .



.
, .


( ),
.
.



, : -
, . ,
,
.

532

III. Visual C++

,
:
new
d e l e t e ;
new [ ]
d e l e t e . (
d e l e t e []);

, ,
, ;
,
.
, . ,
, , , .
, , , .
class SomeClass
{
public:
int* p;
SomeClass()

{ p = new i n t [ 1 0 ] ; } ;

};

SomeClass SomeFunction()
{

SomeClass

A;

SomeClass

B;

= A;
return

B;

void

OtherFunction()

{
SomeClass

A = SomeFunction();

OtherFunction SomeFunction.
SomeClass,
.
,

14.

533

.
,
. .
r e t u r n ,
.
O t h e r F u n c t i o n .

, ,
, someFunction ,
,
OtherFunction .
someciass :
class SomeClass
{
public:
int* p;
SomeClass()
{p = new int [10];};
SomeClass(SomeClassS);
-SomeClass()
{if(p) delete p;};
void operator =(SomeClass&) ;

SomeClass:: SomeClass(SomeClasss Input)


{
p = new int[10];

for(int i=0; i < 10;


p[i] = Input.p[i] ;

void SomeClass:: operator =(SomeClassS Input)


{
if(this == sInput) return;
delete p;
p = Input.p;
Input.p = NULL;

534

III. Visual C++

d e l e t e , d e i e t e [ ] .
, ,
d e l e t e [], . " ".
, , .

, , , ,
. ,
, .
, .

, .
,
. . .
. , ,
.
, ,
.
, , , .
.
:
(
new),
;
,
, , ,

14.

535

, , ;
, , , ,
, ;
, ;
, new;
, .


new delete
, , ( ,
). , MFC.
new
d e l e t e ,
,
.
delete new , ,
Output () , . 14.13.
,
: .
.
C++ _CRTDBG_MAP_ALLOC
.
(debug heap).
. ,
, . "" "", OxFD. ,
, , . OXCD, OXDD.
18 . 629

III. Visual C++

536


:
, , , ,
, .
Visual C++ , . ,
, _CrtDumpMemoryLeaks.
, MFC,
, . 14.14.
. HTML - Microsoft Visual C++ [design] - HtHt-fiBOl
File Edti Ve
iw Project guild Ce
ioug Toosl fn
i dovi Hep
l
<& * I -' ' -' <P Debug

public:
int*
p;
SorneCIass ()

{ p = new i n t [ 1 0 ] ; > ;

SomeClass SonneFunction ()
SoirreClass
A;
SomeClass
B;
= A;
ret-urn B; '
v o i d OcherFunction()
SorneCIass

Look for:
| memory leaks, detectn
ig
3 Filtered by
|AI Vs
i ual C++In MSDN
memory e
l aks
caused by excepto
in
detectn
ig
g
j lroecgautina
l r DLLs
when excepto
i n object si not dee
l ted
memory management
CStrn
i gT
extenso
i n DLLs
memory management [RPC]
alocating and dealocatn
ig
<

A = SomeFunct ion () ;

(Debug
Dumping objects ->
e:\docijments and settings\nick\my documents\visual studio projects\html\html,cpp(52): {62}- normal block at Oxi"
Data: <
> CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
e:\docurnents and setting;\nick\my doruments\visual studio projects\html\html cpp(52) -{61} normal block at Qxr-1
Data: <
> CD CD CD CD CD CD CD CD CD CD CD CD CD CO CD CD
Object dump complete

Repa
lcement Tag (ATL Server)
Code and Text Edtior
Codn
ig Technq
i ues and Programmn
ig
Weclome to the Vs
i ual C++.NET BetaVs
i ual Studo
i Documentato
i n Start Pai
IpF'op. ft.' 9 Dynamci Hep
l|
Col 1 Ch 1
N
IS

. 14.13. Output


, CrtcheckMemory.
,
crtSetDbgFiag. , , DumpAHObjectsSince.

14.

537

Fte Edit View Project Build p_ebug Tools Wn


i dow Help
afxcore
'

HT L r ,.
PfCHTMUpp

tr f rfn
SorneClass [)

i
i
i
\
|

Name
H

-I -IL

'

HTML cpp

lUHelp
The if
e Statement fC-+-+)

{ = new i n t [ 10] ;} ;

Repalcement Tag (ATL Server)

SomeClass SoroeFunccion(J
SoweClass
SomeClass
= A;
return

A;
;

_J

J ^ Samples
Visual C++ Samples
Enterprise Samples

void OtherFunction()
SomeClass

Vatje

Code and Text Editor


Coding Techniques and Programming Practice
Defauciginq
Visual 5tuJip Documentation Start; Page

A * SorneFuncxion() ;

Type

this 0x00428528 class CHTMLAp


cmdli {CCommandUneln CCommar
pDoc Oxcccccccc KMuIti CMultiDoc
pMair Oxcccccccc {CMain CMainFra

_J f^"ug

zl

Detected memory leals'


Dumping obiects ->
e.\donjment5 and 5ettings\nick\my documents\vl5ual studio projects^ ;
Data: <
> CD CD CD CD CD CD CD CD CD CD CD CD CD Cl i
e:\documents and settings\nick\my documents\visual studio projects^ ]
Data: <
> CD CD CD CD CD CD CD CD CD CD CD CD CD G [
' -155} dient block at ux002F4650, subtype cO, 64 bytes long.
_J|
! Object dump complete.

. 1 4 . 1 4 . Output

, CMemoryState Checkpoint Difference.


" " .

15

, ,
.
,
, .
, , , . (DLL), , , , , , ( ). ,
:
,
;

.

,

. :
.
Visual C++ : , MFC, , . Application Wizard.
,
MFC Visual C++,
.

15.

539



MFC ,
.
,
Win32 .
, ,
, . .
, .
. , ,
.



, ', .
_DHMainCRTStartup. Windows
C/C++, C++ ,
.
C / C + + _DllMainCRTStartup DllMain.

DllMain
. , Application Wizard:
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID
lpReserved )
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS__DETACH:
break;

540

III. Visual C++

r e t u r n TRUE;
)

, hModuie,
.
,
. hModuie
.
, ul_reason_for_call,
DiiMain. , DilMain ,
. ui_reason_for_call
DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH. , DiiMain .
ui_reason_for__caii DLL_THREAD_ATTACH,
DLL_THREAD_DETACH.

, lpReserved,
.



, . , ,
: , , , . ' , . (exports table)
(name table). ,
. , .

, .
.
,
, ( ) . .
, (DEF).
, DLL.
, -

15.

541

Visual C++ Programmer Guide, . , ,


. :
declspec(dllexport) int Some_Func(int i);
, . :
declspec(dllimport)

int Some_Func(int i ) ;


. :
// DemoDLL.H
#pragma once
#if !defined(_DEMODLLJ
#define DEMODLL_LIB
declspec(dllimport)
#else
#define DEMODLL_LIB
declspec (dllimport),
#endif // !defined(_DEMODLL_)
DEMODLL__LIB int Some_Func (int i) ;
,
some_Func, _DEMODLL_. .
, , _DEMODLL_
include, ,
.
// DemoDLL.CPP
#define __DEMODLL_
#include "DemoDLL.h"
^

, , DEF, , . DEF ,
.

542

III. Visual C++


(LIB), . LIB
.


, : .
. ,
. ,
LIB
. ( ) LIB,
.
, Windows
, .
Windows .
1. .
2. .
3. Windows.
4. , PATH.
, . , :

;
,
.
JT^

^|

, dll,
, (/). .


Windows,
. , -

15.

543

.
, :
1. : : LoadLibrary, . ,
.
LoadLibrary
, .
.
2. : :GetProcAddress, , : : LoadLibrary,
.
.
: :GetProcAddress . : :GetLastError.
3. . 2 , .
4. : : FreeLibrary .

, ,
.

MFC , , , MFC. :
MFC, , MFC?
, MFC?

, Visual Basic PowerBuilder?
( ) MFC?

III. Visual C++

544


MFC
MFC (Regular MFC DLL)
, MFC
. , extern "". Visual Basic, Delphi
, .
MFC , MFC .
MFC.

MFC MFC DLL Wizard.
MFC DLL Wizard ( , )
Application Settings ( )
MFC DLL Wizard - MyDH (
MFC), . 15.1,
DLL type ( ) MFC.

MFC DLL Wizard - MyDU


Specify Application Settings
Specfiy the type and features of the DLL.
DLL type:
Regular DLL with MFC statically linked
MFC extension DLL
Additional features:
I Automation
afindows sockets

Finish

Cancel

Help

. 15.1. MFC DLL Wizard - My DM, Application Settings

15.

545

-, MFC DLL Wizard, DiiMain , .


, ,
, cwinApp
( ), .
cwinApp ,

, , cwinApp. , CWinApp::Initlnstance CWinApp::Exitlnstance.
DiiMain initlnstance Exitlnstance
.

C++, MFC.
. ,
MFC MFC, .
MFC
. , MFC,
AFX_MANAGE_STATE . :
extern "" int OnDlg(HWND hwParent)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CWnd *

lpParent = CWnd::FromHandle(hwParent);

CDialog myDlg(IDD_MY_DIALOG, pParent);


return

myDlg.DoModal();

MFC . OnDig
, , ,
.


MFC
MFC
, MFC, MFC (MFC extension DLL's)

546

III. Visual C++

, MFC. , , cperson, MFC


cobject.
. , MFC
MFC DLL Wizard. . ,
MFC DLL Wizard MFC ( ):
// Extension. : DLL.

#include "stdafx.h"
ftinclude <afxdllx.h>
#ifdef _DEBUG
#define new DEB0G_NEW
#undef THIS_FILE
static char THIS_FILE[] =

FILE ;

#endif
Static AFX_EXTENSION_MODULE ExtensionDLL = { NULL, NULL };
extern "C" int APIENTRY
DllMain(HINSTANCE hlnstance, DWORD dwReason, LPVOID lpReserved)
{
// , lpReserved
UNREFERENCED_PARAMETER(lpReserved);
if (dwReason == DLL_PROCESS_ATTACH)
{
TRACEO(" Extension.DLL!\n");

//
// MFC
if (!AfxInitExtensionModule(ExtensionDLL, hlnstance))
return 0;

15.

547

II DLL
// :
// MFC
//
// MFC (, ActiveX),
// MFC,
// DllMain
// ,
// MFC.
// ,
//
// MFC
//
//. MFC.
// CDynLinkLibrary
// ,
// .
new CDynLinkLibrary{ExtensionDLL);

else if (dwReason == DLL_PROCESS_DETACH)


{
TRACEOCExtension.DLL !\");
//
AfxTermExtensionModule(ExtensionDLL);
}
return 1;

//

, MFC, MFC , cwinApp. , , DllMain.

DllMain

DllMain

UNREFERENCED_PARAMETER. ; Visual C + + 7.0 .

548

III. Visual C++

, ,
( ). . AfxinitExtensionModuie :
AFX_EXTENSION_MODULE .
AFX_EXTENSION_MODULE , MFC.
AfxinitExtensionModuie FALSE, TO - , DllMain. AfxinitExtensionModuie
TRUE, , CDynLinkLibrary.
CRuntimeCiass .

CDynLinkLibrary.
, , .
AfxTermExtensionModule.

DllMain
,
AfxinitExtensionModuie,
AfxTermExtensionModule.


, MFC , MFC.
, C++
AFXEXTCLASS, :
class AFX_EXT_CLASS CPerson : public CObject
. . AFX_EXT_CLASS :
.
.
AFX_EXT__CLASS, ,
, :
class CPerson : public CObject

15.

549

public:
AFX_EXT_CLASS CPerson(LPCTSTR name, UINT id, double salary);
CPerson ();
CPerson(CPerson & aPerson);

, ,
. ,
CPerson ( ),
, .
CPerson , .


, .
. MFC
AfxGetResourceHandle,
. MFC ;
.
LoadResource FindResource.

AfxGetResourceHandle, , MFC .
:
.
MFC , MFC . , MFC
CDynLinkLibrary . , , , , ,
. , ,
, , . ,
. ,
.
:
//
HINSTANCE hlnstance = AfxGetResourceHandle();

550

III. Visual C++

II
//
AfxSetResourceHandle(::GetModuleHandle("MyLib.dll")};
CString szString;
szString.LoadString(IDS_SOME_RESOURCE);
//
AfxSetResourceHandle(::GetModuleHandle(hlnstance) ) ;

MFC , MFC, , MFC .

DEF
(def), ,
,
, .
. ,
,
.
, , .
.
, ,
.
,
(;) (")
,
, . (;)
(=), , , ,
.
NAME LIBRARY,
.

15.

551

SECTIONS EXPORTS .
,
, .
.
.

(;).
, ,
( SECTIONS EXPORTS).
.
, (").
:
DESCRIPTION DESCRIPTION " t e x t " .
. rdata.
(') (") .
.
EXETYPE EXETYPE:dynamic i dev386.

(VxD).
EXETYPE
/EXETYPE, (dev386).
EXPORTS
EXPORTS
definitions
EXPORTS ,
, . . EXPORTS , , .
EXPORTS.
, , :
entryname[=internalname] [@ordinal [NONAME]] [PRIVATE] [DATA],

entryname . ;

internainame . ,

552

III. Visual C++


.
someFunc, other_Func, :
.

EXPORTS
Other_Func = Some_Func

@ordinai ,

. . lib , ,

NONAME , , .
GetProcAddress
, .
PRIVATE ; entryname
, .
, .
DATA , ,
, . , :
EXPORTS
i DATA
PRIVATE
DATA, PRIVATE
DATA.

. :

decispec(diiexport) ;

EXPORTS ;
/EXPORTS LINK.
. , .

15.

553

EXPORTS.
EXPORTS
DllCanUnloadNow @1 PRIVATE DATA
DllWindowName = Name
DATA
DllGetClassObject @4 NONAME PRIVATE
DllRegisterServer @7
DllUnregisterServer

d e c i s p e c ( d l i e x p o r t ) . ,

declspec(dllimport) .
LIBRARY LIBRARY [library] [BASE=address].
. , , .
l i b r a r y .
/.
BASE=address , .

0x10000000. /BASE.
NAME NAME [application] [BASE=address].
. /. /,
NAME, . NAME
.

SECTIONS

SECTIONS
definitions

SECTIONS , .
.
SECTIONS , , . SECTIONS.
SECTIONS SEGMENTS.

SECTIONS . ,
.

554

III. Visual C++

:
.section_name specifier ,

.section_name ;
s p e c i f i e r
:

EXECUTE

READ

SHARED

WRITE

. :
SECTIONS
.rdata READ WRITE
Visual C++ :
section [CLASS ' classname' ] specifier
CLASS , .

/SECTION.

STACKSIZE STACKSIZE reserve [, commit].


. /STACK. .
STUB STUB:filename. , (VxD),
STUB ,
IMAGE_DOS_HEADER ( winnt.h), VxD, a
, .
/STUB.
VERSION VERSION major [ .minor].

.
major minor
0 65 535. 0.0.
/VERSION.
VXD VXD filename. (VxD). VxD ,

15.

555

.
/VXD
/ .



, . ,
. MFC, .
, .
, .



Library , .

Visual C++:
1. File | New | Project ( | | ), <Ctrl>+<Shift>+<N> New Project
( ) Standard ().
New Project ( ), . 15.2.
2. Templates () MFC DLL ( MFC), Name () "Library" . MFC DLL
Wizard - Library (
MFC), . 15.3.
3. Finish (). MFC DLL Wizard (
MFC) .
4. Class View ( )
Library ().
5. Add | Add Class
( | ). Add Class - Library
( ), . 15.4.

III. Visual C++

556
INew Project

Project Types:
I Visual Basic Projects
_J Visual C# Projects
_j Visual C++ Projects
| Setup and Deployment Projects
_J Other Projects
_) Visual Studio Solutions

Templates:
Application Class Library Empty Project ]
Managed C++ MFC ActiveX
Web Service Control

MFC DLL
1 An application that uses the Microsoft Foundation Class Library.
Name:

J
MFC ISAPI Win32 Project *}

| <Enter name>

Location:

| E:\Documents and Settings\Administrator\My Documen [

<~ Add to Solution

Browse...

f Close Solution

Project will be created at E:\, ,.\Administrator\My Documents\Visual Studio Projects\<Enter name>.


TMore

OK

Help

Cancel

. 15.2. New Project

MFC DLL Wizard - Library


Welcome to the MFC DLL Wizard
This wizard generates an MFC Dynamic Link Library application project with the properties you
specify.
These are the current project settings;
Create a regular DU. (MFC shared)
Click Finish from any window to accept the current settings.
After you create the project, see the project's readme.txt for information about
the project features and files generated,

| ( Qnjsh jj

Cancel

. 15.3. MFC DLL Wizard - Library

Help

15.

557

Add Class-- Library.


Templates

Categories:

^t
^+
Ge
n
e
c
i
r
C
+
C
alss
fitFJCj
:

F
CTC
als
F
6
rM
m
yp
esb
Li
ci

MFC ODBC W
M
ntP
M
Ivie
nIs
tn-w
ce
Consumer P
rod
viIerEveW
rod
ra

ifi -~ Visual C++

' ATL Sm
i pe
l
Obe
j ct
M^
Fife
MFC Ca
lss
From Activ...

ATL Server
Web Service

'Addsan MFC class.

Cancel

Open

Help

. 1 5 . 4 . Add Class - Library

ili

Generic C++ Class Wizard - Library

Welcome to the Generic C++ Class Wizard


This wizard adds a C++ class that does not inherit from ATL or MFC to your project.
C|ass name:
Base class:

.hfe
li :
A
e
(pc
ucb
c
is
ls:

" Tj

file:

" Virtual destructor


Inline

Fn
isih Cancel

Help

. 1 5 . 5 . Generic C + + Class Wizard - Library

558

III. Visual C++

6. Templates () Generic C++ Class


( ) Open (). Generic C++ Class Wizard - Library (
), . 15.5.
7. Class name ( ) Median, Virtual destructor ( ) Finish (). .
8. Class View ( ) Library ()
Median.
Median.h.
9.

15.1.

i 15.1. Median.h
#pragma once
//
tifndef DEMO__LIB
#ifndef MY_LIBRARY
tdefine
DEMO_LIB
declspec(dllimport)
#else
tdefine
DEMO_LIB
declspec(dllexport)
#endif
#endif
//
template<class Type>
DEMO_LIB void Sort( Type*, int, int );
template<class Type>
void Sort( Type* Buffer, int n) { Sort( Buffer, 0, n-1 );};
//
template<class Type>
class
DEMOLIB Median
int
int
double
double
double
double*

ah;
m;
mcu;
mcl;
mv;
x;

15.

559

public :
Median ( int );
virtual -Median(void);
Type Get ( Type );

10. Median<Type>
. Median..
11. 15.2.
I 15.2. Median.
#include "StdAfx.h"
#ifndef MY_LIBRARY
#define _MY_LIBRARY
#endif
tinclude "median.h"
template
template
template
template

void Sort<int>( int*, int, int );


declspec(dllexport) void Sort<double>( double*, int, int
class
Median<int>;
class
declspec(dllexport) Median<double>;

// ( )
template<class Type>
void Sort( Type* Buffer, int lo, int hi )
{
int i = lo;
int j = hi;
Type x = Buffer! (lo+hi) 1 ];
while( i < j )
(
while! Buffer[i] > x- )
i++;
while( Buffer[j] < x )
j ;

560

III. Visual C++


if( i < j

{
Type = Buffer[i],
Buffer[i++] = Buffer[j];
Buffer[j] = y;
}
}
iff lo < hi - 1 )
{
if ( lo < j )
Sort( Buffer, lo, j ) ;
if ( i < hi )
Sort( Buffer, i, hi );

/III 11II II111111111II1111 /I l/ll/ /II III II Illllll/ll/


11
I/1111/1Illlll//nil/ll/llIII/III I/I/11/1///I/I IIIII111////////!/
teraplate<class Type>
Median<Type>:: Median ( int a )
{
ah = (a 1) + 1;
x

= new double[ah];

m = 0;
mcu = 0.0;
mcl = 0.0;
mv =0.0;
for(int i=0; i < ah;
x[i] = 0.0;

template<class Type>
Median<Type>:: ~Median ( void
{
delete x;

15. .
immmm

iii/1/nmm/i

in

in

mi/mi

in mi//mi

mi

561
mm

11
/ll/ll/ll/lII III III III/III/1 III II11 III 11/II1111 III III III11IIII III/111/
template<class Type>
Type Median<Type>:: Get ( Type is )
{
int
i;
double lv;
m
= (m + 1) % ah;
lv
= x [m] ;
x[m] = is;
if( is > mcu )
mcu = is;
if( is < mcl )
mcl = is;
if( lv >= mcu )
{
mcu = x [ 0 ] ;
fort i=l; i < ah; i++ )
{
if( x[i] > mcu )
mcu = x[i];

if( lv <= mcl )


{
mcl = x[0];
for( i=l; i < ah;
{
if( x[i] < mcl
mcl = x[i];

562

III. Visual C++

if( mv > mcu )


mv = mcu;
if( mv < mcl )
mv = mcl;
return (Type) mv;

12. Library.def,
.
13. 15.3.
| 15.3. Library.def

; Library.def : Declares the module parameters for the DLL.


LIBRARY
"Library"
EXPORTS
; Explicit exports can go here
?Sort@@YAXPAHHH@Z
?Get@?$Median@H@@QAEHH@Z
14. Build | Build Solution ( | ) <Ctrl>+<Shift>+<B>.
.


MFC
MFC Extension ,
. MFC:
1. File | New | Project ( | | ), <Ctrl>+<Shift>+<N> New Project
( ) Standard ().
New Project ( ).
2.

Templates () MFC DLL (


MFC), Name ()
"Extension" . MFC
DLL Wizard - Library ( MFC).

15.
3.

563

Application Settings ( ),
DLL Type ( )
MFC extension DLL (
MFC) Finish ().

4. Resource View ( ), Extension.rc


Add Resource ( ).
Add Resource ( ), . 15.6.

lAdd Resource
Resource type:
MlBitmaP
+ & Cursor
ti pi Dialog
JS HTML
Icon
2| Menu
SS String Tabe
l
.=!S Toob
l ar

Import...

Custom...

Cancel
Hep
l

Version

. 15.6. Add Resource


5. Resource type ( ) Dialog
( ) New (). Resource View
( ) Extension.rc Dialog IDD_DIALOGI. ,
.
6. Resource View ( )
IDD_DIALOGI Properties ().
Properties ().
7. ID ( ) Properties () IDD_MEDIAN.
8.
Caption () Properties ()
"".
9. 200x300
Cancel () .
10. Cancel () Caption
() Properties () "".

564

III. Visual C++

11. Toolbox (),


Static Text ( ) .
12. Caption () Properties ()
"".
13. Toolbox () Edit
Control ( ) .
14. .
15. ID ( )
Properties () IDCARRAY.
16. MultiLine ( ),
Behavior (), True.
17. ReadOnly (
), ,
VerticalScroll ( ), StaticEdge (
), Number () RightAlignText ( ),
Appearance ( ).
18. .. 11 12 "",
.
19. Toolbox () Edit
Control ( ) .
20. ID ( )
Properties () IDC_APERTURE.
21. MultiLine ( ),
Behavior (), True.
22. .. 1821 IDC_VALUE
"".
23. .. 1821
IDC_RECURSIVE
"".
24. ReadOnly ( ),
True.
25. .. 23 24
IDCJSIMPLE "".
26. Toolbox () Button
() ,
.

15.

565

27. ID ( ) IDCADD,
Caption () "".
28. Add Class
( ). Add Class - Library (
), . 15.4.
29. Templates () MFC Class ( MFC)
Open (). MFC Class
Wizard - Extension ( MFC), . 15.7.
.*'

MFC Class Wizard - Extension

Welcome to the MFC Class Wizard


This wizard adds a class that inherits from MFC to your project, Options may change
depending on the base class selected.
C[assname:

.DHTML resource ID:

Base class:

.HTM file:

jCWnd

~Z3
.H file:
(

Automation;
r
None
Automation
Creatable by type ID

.CPPfile:

V Active accessibility.

Finish

Cancel

Help

. 1 5 . 7 . MFC Class Wizard - Extension

30. Class name ( )


CMedianDig, Base class ( )
CDialog,
Dialog ID ( ) IDD_MEDIAN Finish (). .
31. Class View ( ), Extension, CMedianDig

III. Visual C++

566

Properties ().
Properties ().
32. Properties () Overrides (
).
, .
33. OninitDialog. .
34. .
CMedianDig .
35. Properties () Events ().
, .
36. IDC_ADD,
BNCLICKED,
. CMedianDig .
37. Class View ( )
CMedianDig
Add | Add Variable ( | ).
Add Member Variable Wizard - Extension (
), . 15.8.

I field Member Variable Wizard - Extension


Welcome to the Add Member Variable Wizard
This wizard adds a member variable to your class, struct^ or union.

Access:

* Control variable

Variable type:
I bool

13

Variable name:

Comment (// notation not required):

Finish

Cancel

Help

. 15.8. Add Member Variable Wizard - Extension

15.

567

38. Control variable ( ), Control ID


( )
IDC_ARRAY, Variable name ( ) mArray Finish (). CMedianDig
.
39.

..

37

38

41. .. 37 38
IDC_APERTURE m_Aperture.

IDC_RECURSIVE m_Recursive.

40.

..

37

38

IDC_SIMPLE m_Simple.

42. .. 37 38
IDC__APERTURE m_nAperture, ,
Finish (), Category ()
Value () Variable
type ( ) i n t .
43. . 42 IDC_VALUE m_Value.
44. Class View ( )
CMedianDig Add | Add
Variable ( | ). Add
Member Variable Wizard - Extension ( ).
45. Variable type ( ) Median<int>*, Variable
name ( ) m_Median Finish
(). CMedianDig .
46. .. 44 45 mlpArray i n t * .
47. .. 44 45 Aperture i n t .
48. CMedianDig.
MedianDlg.h.
49. ttpragma once
#include <Median.h>
#include "Resource.h"
50. MedianDlg.cpp.
51. 15.4.

19 *. 629

568

III. Visual C++


\

| 15.4. CMedianDlg
II CMedianDlg

mmmimminmiiimm

II

IMPLEMENT_DYNAMIC(CMedianDlg, CDialog)
CMedianDlg::CMedianDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMedianDlg::IDD, pParent)
, m_lpArray( new int[3])
, Aperture(3)
{
m_Value
= 0;
m nAperture = Aperture;
m Median = new Median<int>( Aperture );

CMedianDlg::-CMedianDlg()
{
delete m_lpArray;
delete m_Median;

52. OnlnitDialog onBnClickedAdd


15.5.
| 15.5. OnlnitDialog OnBnClickedAdd
// CMedianDlg
//
BOOL CMedianDlg::OnlnitDialog(void)
CDialog::OnlnitDialog();
//
SetDlgltemText( IDC_RECURSIVE, "0" );
SetDlgltemText( IDC_SIMPLE, "0" );

15.
II
CString szText = "0\r\n";
m_lpArray[0] = 0;
for(int i=l; i < Aperture;
{
m_lpArray[i] = 0;
szText += "0\r\n";

//
SetDlgltemText( IDC ARRAY, szText );
return TRUE;

// TRUE ,
//
// : OCX
// FALSE

//
void CMedianDlg::OnBnClickedAdd(void)
{
CString szText;
int
i;
UpdateData() ;
if( m_nAperture != Aperture )

//

{
//
m_nAperture
m_Value

I = 1;

= 0;

UpdateData( FALSE );
SetDlgltemText( IDC_RECURSIVE, "0" );
SetDlgltemText( IDC_SIMPLE, "0" );
Aperture = m_nAperture;

569

570

III. Visual C++


delete

m_lpArray;

delete

m_Median;

m_lpArray
m_Median
szText

= new int[Aperture];
= new Median<int>( Aperture );
= "O\r\n";

m_lpArray[O]

= 0;

f o r ( i = l ; i < Aperture; i++)


{

m_lpArray[i]
szText

=0;
+= "0\r\n";

SetDlgltemText( IDC_ARRAY, szText );


}
else
{

//
int* lpTemp = new int[Aperture];
for(i=l; i < Aperture; i++)
{
m_lpArray[i-1] = m_lpArray[i] ;
lpTemp[i-l]
= m_lpArray[i];

m_lpArray[Aperture-1] = m_Value;
lpTemp[Aperture-1]
= m_Value;
Sort( lpTemp, Aperture );
//
szText.Format("%d", m_Median-> Get( m_Value));
SetDlgltemText( IDC_RECURSIVE, szText );
szText.Format("%d", lpTemp[ Aperture >> 1 ]);
SetDlgltemText( IDC_SIMPLE, szText );
//
m_Array.SetSel( 0, m_Array.LineLength(0) + 2 );

15.

571

m_Array.ReplaceSel ( "" );
m_Array.SetSel( 10000000,

10000000);

szText.Format("%d\r\n", m_Value);
m_Array.ReplaceSel( szText );

delete

lpTemp;

53. #include "Extension.h"


54. Class View ( ),
Extension () Properties (). Extension Property Pages ( ).
55. Configuration () All Configurations ( ),
C/C++. Extension Property Pages
( ) , . 15.9.
I Extension Property Panes
_^J Platform JAchve(V'iri32)
^ Configuration Properties
General
Debugging
^ CJC++

Additional Include Directories


Resolve #using References
Debug Information Format
Compe
li As Managed
Suppress Startup Banner
Warning Level
Detect 64-bit Portability Issues
Treat Warnings As Errors

_]

Configuration Manager..

Not using managed extensions


Yes (/nologo)
Level 3 (/W3)
No
No

Optimization
Preprocessor
Code Generatio
Language
Precompiled He;
Output Files
Browse Informa
Advanced
Command Line
i_j Linker
"'
!_3 Resources
Additional Include Directories
LJMIDL
t j Browse Information w j \ Specifies one or more directories to add to the include path; use semi-colon
; delimited list if more than one. (/I[path])
OK

-pply

Help

. 15.9. Extension Property Pages, C/C++

III. Visual C++

572

56. Additional Include Directories ( ) Library (


"E:\Documents and Settings\Nick\My Documents\Visual Studio
Projects\Library").
57. Linker ( ).
Extension Property Pages ( ) ,
. 15.10.
(Extension Property Pages, '.

J*J

Configuration: (All Configurations


:'_y Configuration Propertie *
General
Debugging
Q C/C++
.inker

Jj Platform: JActive(W<n32)

Output File
Show Progress
Version
Enable Incremental Linking
Suppress Startup Banner
; Ignore Import Library
1 Register Output
i Additional Library Directories

Configuration Manager...

4(0utDir)/Extension.dll
Not Set
yes (/NOLOGO)
No
No

Input
Debug
System
Optimization
EmbeddedIDL
Advanced
Command Line
C".\ Resources
Q MD
IL
LJ Browse Information'
LJ Build Events
Output File
'_J Custom Build Step
Override the default output file name. (/OUT;[file])
JJLJ"
OK

Cancel

Apply J -

Help

. 15.10. Extension Property Pages, Linker


58. Additional Library Directories ( )
Library ( "E:\Documents
and Settings\Nick\My Documents\Visual Studio Projects\Library\Debug").
59. Linker ( )
Extension Property Pages ( ) Input
( ). Extension Property Pages ( )
, . 15.11.
60. Additional Dependencies (
)
Library.lib.

15.

573

JExtensionProperty Page*,'
Configuration: JActive(Debug)
A

^'ij Configuration Propertie*


General
Debugging
D C/C++
.inker
General
Debug
System
Optimijation
EmbeddedIDL
Advanced
Command Line

ill
T J Platform:

Active(Wm32)

_^J

Cgnfiguration Manager..

Additional Dependencies
Ignore All Default Libraries
Ignore Specific Library
Module Definition File
Add Module to Assembly

No
AExtension.def

Embed Managed Resource File


Force Symbol References
Delay Loaded DLLs

' Resources
CJMIDL

(_J Browse InformationQ j Build Events


l_l Custom Build Step

Additional Dependencies
! Specifies additional items to add to the link line (ex: kernel32.lib);
' configuration specific.

OK

Cancel

Apply

Help

. 15.11. Extension Property Pages


61. . Extension Property Pages (
) .
62. Build | Build Solution ( | ) <Ctrl>+<Shift>+<B>.
.
63. Microsoft Visual C + + , .

, . ,
Visual Studio.NET. , , , , , ,
PATH. , (
, ). , : ,
PATH, ,
.

574

III. Visual C++


,
PATH. autoexec.bat .
:. ,
, , . Windows 98 Windows 2000 -.
PATH
Windows 2000:
1. My Computer
( )
Properties (). System Properties (
), . 15.12.

System Properties |
[ Generai Network Identification 1 Hardware I User Profiles j Advanced I
System:
Microsoft Windows 2000
5.00.2195
Service Pack 1
Registered to:
Nick
Home
51873-OEM-0000786-527S4
Computer:
AM D-K6(tm) 3D processor
AT/AT COMPATIBLE
196152 KB RAM

OK

Cancel

. 15.12. System Properties


2.

, Advanced (). System


Properties ( ) , . 15.13.

15.

575

General) Network Identification j Hardware) User Profiles Advanced


Performance
Performance options control how applications use memory.
which affects the speed of your computer.
Performance Options...
Environment Variables Environment variables tell you computer where to find certain
types of information.
Environment Variables...
Startup and Recovery
Startup and recovery options tell your computer how to start
and what to do if an error causes your computer to stop.
Startup and Recovery...

Cancel
. 1 5 . 1 3 . S y s t e m P r o p e r t i e s ,
A d v a n c e d

3. Environment Variables ( ). Environment Variables ( ),


. 15.14.
4. System variables ( )
Path () Edit ().
Edit System Variable ( ),
. 15.15.
5. Variable Value ( )
Extension Library (
"E:\Documents
and
Settings\Nick\My
Documents\Visual
Studio
Projects\Extension\Debug;E:\Documents and Settings\Nick\My Documents\Visual
Studio Projects\Library\Debug") .
6. System Properties ( ). .
7. Windows, (
).

III. Visual C++

576

(Environment Variables

84'

User variables for Nick


Variable

Value

LIB

E:\Program Files\Microsoft.Net\Framew,.
E:\Dccuments and Settings\Nick\Local S..
E:\Documents and Settings\NickV.ocal 5..

TEMP
TMP

Delete

System variables

Variable _
ComSpec
CORPATH
INCLUDE
LIB
netsamplepath

Value
...
_
.._
E: \WIN_200D\systetn32\cmd. exe
E:\WIN_2000\Microsoft.NET\Frarnework..
E:\Program Files\Microsoft.Net\Framew...
E ^Program Files\Microsoft, Net\Framew...
E:P
\ ROGR A~ 1 \MICROS~ 1. NET\FRAME..
Edit...

New,..

Delete

Cancel

OK

. 15.14. Environment Variables


lEdil System Vawaaltllimif"
Variable Name:

j Path

OK

Cancel |

. 15.15. Edit System Variable


PATH
Windows 98:
1. | .
, . 15.16.
2. msconfig .
,
. 15.17.
3. Autoexec.bat. , . 15.18.

15.

577

I
'.: ' " " V ' .
,- ,
. :
. . . .

:
-Jr.,
:

|
.

...

'

. 15.16.

IV--


jConfig.sys| Autoexec.bat j System.ini| Win.iniJ )
:. f - -

- :

j <* [

i
j

.' | - :
I

0^61^"'^|^/^:^^1^'

I j

... j

Hpv'e:-1 ,~ j

. 15.17.

4. PATH C:WIN_98\COMMAND;C:\DRIVER
. .
5. Extension Library ( "E:\Documents and Settings\Nick\My
Documents\ Visual Studio Projects\Extension\Debug;E:\Documents and Settings\Nick\My Documents\Visual Studio Projects\Library\Debug")
. .

578

III. Visual C++

idi

( Config.sys Autoexec bat | System mi | Win.ini j j
Autoexec bat.
""

PATHICAWIN 98.CAWIN 98\COMMAND;C:\DRIVERS


mode con codepage =((866) C:\WIN_98\COMMAND\ega3.cp
mode con codepage select=866

OK

. 15.18. Autoexec.bat

(Extension Property Pages


3

Configuration; JActive(Debug)
:^J Configuration Properties
Debugging
p C/C++
Q Linker
;_j Resources
Cl MIDL
f_] Browse Information
(_3 Build Events
Custom Build Step
L_j Web References
LJ Web Deployment

flatform;

[Active(Win32T

Canfiguration Manager..

Output Directory
,
Intermediate Directory

Debug
Debug

Extensions to Delete on Clean *.obj;*.ilk;*,pdb;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;1


Configuration Type
Build Browser Information
Use of MFC
Use of ATL
Minimize CRT Use in ATL
Character Set
Use Managed Extensions
Whole Program Optimization

Dynamic Library (.dll)


No
Use MFC in a Shared DLL
Not Using ATL
No
Use Multi-Byte Character Set
No
No

I Output Directory
; Specifies a relative path to the output file directory; can include environment
! variables,
Cancel

. 15.19. Extension Property Pages

Help

15.

579

PATH, ,
.

:
1. Class View ( ),
Extension () Properties (). Extension Property Pages ( ).
2.

Configuration () All Configurations ( ). Extension


Property Pages ( ) , . 15.19.

3. Output Directory ( )
( E:\Win_2000) .


, DemoLib, , . :
1. , I, DemoLib.
2. Resource View ( ),
DemoLib.rc, Dialog ().
3. IDD_ABOUTBOX <Del>.
.
4.

. 3 IDD_DEMOLIB_DIALOG.

5. String Table ( ),
String Table <Del>.
.
6. Solution Explorer ( ), DemoLib, Source Files.
7. DemoLibDlg.cpp <Del>. .
8. Header Files ( ) . 6
DemoLibDlg.h.
9. File | Open | File ( | ),
<Ctrl>+<0> Open () Standard (). Open File
( ), . 15.20.

III. Visual C++

580
lOpen File
Lookiv

History

! My Projects

ij m _Jres
K$ DemoUb cpp
Ji] DemoLib h
SiODemolib.rc
0^ DemoUbDIg cpp
W\ DemoUbDIg h
iti] Resource, h
g| stdafx.cpp
jh] stdafx.h

Desktop

Favorites
File name:

Open

Files of type: Ivisual C++Files

Cancel

. 15.20. Open File


10. DemoLibDlg.cpp DemoLibDlg.h (
<Shift> <Ctrl>) .
11. Delete ().
Confirm Multiple File Delete (
), . 15.21.

41 Are you sure you want to send these 2 tiems to the Recyce
l Bn
i

. 15.21.
Confirm Multiple File Delete
12. Yes (), . .
13. Cancel () Open File (
). .

15.

581

14. Solution Explorer ( )


DemoLib
Properties (). Property Pages
( ).
15. Configuration () All Configurations ( ),
C/C++.
16. Additional Include Directories ( )
Library Extension (
"E:\Documents and Settings\Nick\My Documents\Visual Studio Projects\Extension;E:\Documents and Settings\Nick\My Documents\Visual Studio
Projects\Library").
17. Linker ( ).
18. Additional Library Directories ( ) Extension (
"E:\Documents and Settings\Nick\My Documents\Visual Studio Projects\
Extension\Debug").
19. Linker ( )
Property Pages ( ) Input ( ).
20. Additional Dependencies (
)
Extension.lib.
21. . Property Pages ( )
.
22. Source Files ( ) Solution Explorer (
)
DemoLib.. .
23. #inciude "DemoLibDig.h"
#include "MedianDlg.h"

24. i n i t i n s t a n c e 15.6.
; 15.6. I n i t i n s t a n c e

// CDemoLibApp
BOOL CDemoLibApp::Initinstance()
{

//
CWinApp::Initinstance();

582

III. Visual C++

AfxEnableControlContainer() ;
//
CMedianDlg dig;
mjpMainWnd = Sdlg;
int nResponse = dlg.DoModal();
//
if (nResponse == IDOK)
{
// OK
}
else if (nResponse == IDCANCEL)
{
//

// , FALSE,
// ,
//
r e t u r n FALSE;

25. <F5>
(,
). , . 15.22.
26.
. . , .
,
.
27. . 25 .
28. .
, .
.
,
, .
29. .. 2527 .
30. .

15.

583

zl

'

II9EI

. 15.22.



, .
Library . . , ,
.
,

decispec(diiexport)
declspec(dllimport) .
Median.h ,
DEMOLIB.
MY_LIBRARY , Median..

, ,

.

MYLIBRARY

,
, , -

584

III. Visual C++

, StdAfx.h, .
11, , , , ,
. template,
.
,
d e c l s p e c ( d l l e x p o r t ) , . ,

d e c i s p e c ( d i i e x p o r t ) .
(. 11).
,
, .. , Median::Get
.
. , 0.5 ( ). ,
. , . .
,
, .
.
, ,
.
,
.
Library
Extension .
3. .
CMedianDlg .
.

15.

585

.
.
oninitDialog DoModal . . SetoigitemText
, . , ,
. .
onCiickedAdd
. ,
,
. ,
. , , OninitDialog.

,
.
, , .
. s o r t
.
,
Median: :Get.
CString::Format.
CEdit:: SetSei
CEdit: :ReplaceSei,
. ,
CEdit: : S e t s e i , , CEdit: :LineLength. ,
,
. CEdit: :RepiaceSei
, ,
CEdit: : c l e a r CEdit: :Cut, . Visual C++ 7.0, Visual C + + 6.0.
CEdit: : S e t s e i
.
CEdit: :RepiaceSei .

. ,

DoModal .

586

III. Visual C++

DemoLib ,
Extension, , .

CDemoLibApp:: i n i t i n s t a n c e
.
, , .
Property Pages ( ) ,
. , ,
, , . ,
,
lib-.

16


Internet
Microsoft Visual Studio.NET, ,
Internet. , , , ,
Internet-.
Microsoft Internet
.
, Microsoft
Internet . ,
.
Internet Microsoft Winlnet, MFC.

Winlnet
Winlnet Internet ,
. , Internet-
MFC.
Winlnet , : . Winlnet . 16.1;
16.1. Winlnet

CInternetSession

CInternetConnection

Internet . , Winlnet ,
Winlnet,
CInternetSession

Internet .

CFtpConnection,
CGopherConnection CHttpConnection

588

III. Visual C++

16.1 ()

CFtpConnection

FTP

CGopherConnection

gopher

CHttpConnection

HTTP

CInternetFile

Internet.
C G o p h e r F i l e
CHttpFile

CGopherFile


gopher

CHttpFile

HTTP

CFileFind

.
C F t p F i l e F i n d
CGopherFileFind

CFtpFileFind


FTP

CGopherFileFind


gopher

CGopherLocator

gopher

InternetException

,
Winlnet

Web-
WebRead,
Winlnet , Web- HTML.
, . :
1. File | New | Project ( | | )
<Ctrl>+<Shift>+<N>.
New Project ( ).
2. Templates () MFC Application
( MFC), Name ()
WebRead . MFC Application
Wizard ( MFC).

16. Internet

589

3. Application Type ( ). Select application type ( )


Single document ( ).
4. Generated Classes ( ),
Generated classes ( ) cwebReadview,
Base class ( )
CEditView.
5. Finish (). MFC Application Wizard
.
6. Resource View ( )
WebRead.rc
7. Dialog ()
Insert Dialog (
). ,
.
8.
Properties ().
Properties ().
9. Properties () ID ( )
IDDJJRLDLG.
10. Properties () Caption ()
"Connect".
11. Toolbox () Static Text
( )
.
12. Properties () Caption ()
"Enter
URL:11.
13. Toolbox () Edit Control
( ) .
14. Properties () ID ( )
IDC_URL.
15. ,
.
16. ,
. , . 16.1.

III. Visual C++

590

WebRead - Microsoft Visual C++ (desiflnl - Wcbfteadj


He | Edit ew Erolect guild Eebug Format Iools Mndcm Hep
l
.J ' j ' ^ S I S
'<-*
V Debug

&J WebRead.rc (ID...LDLG - Dialog)*|


.

P .

-JJ5J.XJ

ID_CONNECT_MAKECONNECTIOt*
!

Resource View - W e b B e a d
-

3 1 W e b R e a d
~
j WebPead.rc*

j Accelerator

-*J

j Sample edit b o x

>

_ J dialog
"2] IDD_ABOUTBOX [Er
3 IC'D_URLDLi
J Icon
_ J Menu
I PT MANIFEST
_ J Sting Table
I Tnr.lh*r

J i -

Properties

I IDD_URLDLG (Dialog)

|] [ra] -S ns .

jDebug

IDIgEditot _

Centei Mouse Fasl e


Context Hep
l Fasl e
(Name)

Ready

. 1 6 . 1 .
17. Resource View ( ) Menu ()

IDR_MAINFRAME. .
18. "
", , "&Connect".
.
19. "
", , "&
Connection".
20. Connect
(), , ,
, View () Help ().
21. Edit ()
<Del>. .
22. Save All ( ) Standard
() . -

16. Internet

591

,
. 16.2.

Bte

i?
j

"lew

Proiect

Build

: U " f - ^ L 3 U$

jp -

File

i<

Edit

i| t'

Yw

'

Debug

'*
ii,

Connect

S"(

Tools

ffindow

<
Debug

WebRead.rc (I...NFRAME - Menu) j

Help

rojroiJNECTJWECONWECTION i u " #

Resource View-WebPead

cad
bPead re
Accelerator

Dialog
3 IDD_ABOUTBOX [English (U.S.)]
3 IDDJJRLDLG
Icon
i Menu
; Sj IDR_MAINFRAME [English (U.S.)] _
i : RT_MANIFEST
) String Table

| Menu Editor IMenuEd

False

| Debug

| ID_CONNECT__;J

Separator False
^ 1 Speci
Specifei s the identifier of the menu
ZJ item ot menu resource.
:

7| - Output I g j

Item(s) Saved

. 16.2.
23. Class View ( ),
WebRead
Add | Add Class ( | ).
Add Class - WebRead ( ), . 16.3.
24. Templates () MFC Class (
MFC) Open ().
25. MFC Class Wizard - WebRead (
MFC), . 16.4.
26. Class name ( ) cuRLDig, Base class ( )
coiaiog Finish ().
.
27. Class View ( ) WebRead.

592

III. Visual C++


lAdd Class WebRead
Templates:

>

Add ATL
Support...

ATL Active
Server Pa...

ATL Control

ATL Dialog

ATL MMC
Snapln

ATL MS
Transacti..

ATL OLEDB
Consumer

ATL OLEDB
Provider

ATL
Performanc...

: Add ATL support to an MFC project.

zl

Hep
l

Cancel

Open

. 1 6 . 3 . Add Class - WebRead

MFC Class Wizard - WebRead


Welcome to the MFC Class Wizard
This wizard adds a class that inherits from MFC to your project. Options may change
depending on the base class selected,
C|ass name:

.DHTML resource ID:

Base class:
jcWnd

.HTM file:

i]

Automation:
a

None

Automation

,H file;

C G eatable by type ID

.CPP file:
Active accessibility

Finish

Cancel

. 1 6 . 4 . MFC Class Wizard - WebRead

Help

16. Internet

593

Add Member Variable Wizard - WebRead


Welcome to the Add Member Variable Wizard
This wizard adds a member variable to your class, struct, or union,

Access;
^!
Variable type:

^~*

' variable

Variable name;

Comment(//notato
innotrequried):

r ^ ~ ^ ~ ~ J "

Fn
is
ih | Cancel j Hep
l j
. 16.5. Add Member Variable Wizard
28. cuRLDig Add | Add Variable ( |
). Add Member Variable Wizard WebRead ( ), . 16.5.
29. Control variable ( ), Control ID
( ) IDCURL,
Category () Value
(), Variable name ( )
m_URL Finish ().
cuRLDig .
30. Class View ( )
cwebReadview Properties (). Properties ().
31. Properties () Events
(). , .
32. ID_CONNECT_MAKECONNECTION
COMMAND.
33. . cwebReadview -

594

III. Visual C++


.
WebReadView.cpp .

34. OnConnectMakeconnection
16.1.

! 16.1. CWebReadView: : OnConnectMakeconnection


// CWebReadView
void CWebReadView::OnConnectMakeconnection(void)
{

//
CORLDlg d i g ( t h i s ) ;
// URL,
dlg.m_URL = "http://www.mcp.com";
//
int result = dlg.DoModal();
if (result == IDOK)

// OK

{
//
CInternetSession INetSession;
CString
csTemp;
LPCTSTR
szTemp;
CEdits,
edit = GetEditCtrl () ;
try
{
// HTTP
szTemp = dlg.m_URL.GetBuffer(256) ;
CHttpFile* httpFile =(CHttpFile*)INetSession.OpenORL( szTemp );
dlg.m_URL.ReleaseBuffer() ;
//
httpFile->SetReadBufferSize(4096);
//
while! httpFile->ReadString( csTemp ) )
edit.ReplaceSel( csTemp + "\r\n" );

16. Internet

595

//
httpFile->Close();

//
catch (CInternetException* pException)
{
edit.ReplaceSel( "CInternetException received!'
pException->ReportError();

//
INetSession.Close();
//
Invalidate();

35. WebR.eadView.cpp #include


"WebReadview.h" :
tinclude <afxinet.h>
#include "URLDlg.h"
36. <F5> .
37. Connect | Make Connection ( |
). Connection (), . 16.6.
xj

[Connection ^
Enter URL
[http: //www, mcp.com

OK

;|

Cancel |

. 16.6. Connection
38. Enter URL ( URL) Web-
HTML .
,
. 16.7. ( ,
HTML.)

596

III, Visual C++

WebRead - Untitled
File Ve
i w Connect Help
D ~\B
, El S f
|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.Z Final//EN">
|<HTML>
|<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charse1=Windows-1251">
r

<TITLE>KoMaHAa , <>
!</HEAD>
!
i<BODY BGCOLOR="FFFFFF' TEXT="000000">

j<P><A NAME="hid_edit_cut"X/AXBXfont face="Helv " (


|npaBKa)</FONTX/BX/P>
KPXfont face="HeIv Cyr">
| o6MeHa</FONT>. <font face="Helv " ,
. </FONTX/P>
|<Pxfont face="Helv ">
|.<//>
|<PXBXfont face="Helv "> BuaoBa</FONTX/BX/P>
|
KPXiont face="Helv "> HHCTpyMeHTOB</FONT>:<IMG SRO"../images/editcut.gif' ALT='"'
!BORDER=0X/P>
I
Ready

. 16.7. HTML
, Web-
Winlnet , . , , , ,
HTML, Web-. ,

, ,
.
, MFC Application Wizard, :
Web-
.
,
.
OnConnectMakeconnection, , .
OnConnectMakeconnection, ,
Web-,
.

16. Internet

597

Microsoft, - .
DoModai, , .
,
Web-. :
1. cinternetsession.
2. openURL,
CHttpFile, HTML, URL.
3. CHttpFile Readstring, , .
4. ,
CHttpFile close, .
5.
Cinternetsession.
cinternetsession ,
, . .
CEditview, ,
CEditview: :GetEditctrl, CEdit.

, , ,
try. cinternetsession: :OpenURL
LPCTSTR, URL cstring,

cstring: :GetBuffer.
cstring: :ReieaseBuffer. openURL , URL, CHttpFile, . openURL
cstdioFile, .
CHttpFile cmternetFiie::setReadBuf fersize .
, Winlnet API -

598

III. Visual C++

.
,

C I n t e r n e t F i l e : : ReadString,
SetReadBufferSize.


C I n t e r n e t F i l e : :ReadString.
, .
.
CEdit: :RepiaceSei, . , ,
.

C I n t e r n e t F i l e : :Close, C I n t e r n e t F i l e
.
,

catch,

CEdit: :RepiaceSei ,
CException: : ReportError,
.
onConnectMakeconnection
CInternetSession: : Close, CInternetSession,
cwnd:: invalidate, .

IV

20 . 629

1. -

2. Visual C++
3.

1
-

- Windows. , DOS,
, Turbo Vision, Borland Borland C++,
- , ,
.
Visual C++, , , , . - .
.
,
.

-

, ,
, - . ,
.
, , ,
- .
, .
, , , , ,
.
, - ( ) , , .
- ()
. , , .
.

602

IV.

, , .
,
, . , , , ,
.
, " ".
- .
:
(),
.
.
:
, ,
. . .
:
,
.

.
Modula 2. Turbo Pascal, Borland, 5.5, -. - C++, Bell
Laboratories AT&T
.
.

- .
, , , , ,
.
, ,
( ). , -

1. -

603

, . . . , . ,
, , . ,
, ,
.
, ,
,
,
.
, ,
.
, , , , , ,
.
. , - ,
. -
, .
, (
).
, ' , ,
, ,
, , , .

-
, ,
, , , , . ,
.
, Windows.

Windows , , . , ,
,
, , , -

604

IV.

Windows. He ,
.
Windows,
Windows,
,
.

-
. , , , .
"" ,
. C++ ,
. ,
, .
. ,
. ,
, , .
, : , .
, , :
,
. , :
. , ,
.
, , . ( ,

), ,
, , , , .
,
. -

1. -

605

C++,
.


, .
, . , , i n t . ,
. , , .
. ,
, ,
. , ,
. , , , .


. , .
-, , ,
. , ,
, .
-, , -
, IBM PC 64 ,
,
, - 640
. ,
, .

.
,
, . , ,
, . ,

606

IV.

.
(header files)n (implementation files).
h
, ,
, .
, MFC Application Wizard
Visual C++ 7.0 MDI,
.
.
I 1.1
// MDIDoc.h CMDIDoc
#pragma once
c l a s s CMDIDoc : p u b l i c CDocument
{

protected: //
CMDIDoc();
DECLARE J3YNCREATE (CMDIDoc)
//
public:
//
public:
//
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchiveS ar);
//
public:
virtual -CMDIDoc ();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContexts dc) const;
#endif

'

1. -

607

protected:

//
protected:
DECLARE MESSAGE MAP()

1.1 ,
: cciassDoc.
#pragma once.

. , #include, . #include
, ,
. ,
, .
, , ,
, , , .
c l a s s CMDIDOC : public CDocument ,
CMDIDOC, CDocument. public ,
.

,
.
. protected. .
, - , . . .
.
.
.
. , ,
, p r i v a t e ,
. , ,
, , , .
.
. ,

608

IV.

public .

.
.
,
p r o t e c t e d .

,
.
,
,
. ,
. , . .
.
, ,
. , ,
, .
, , . . , .
C++ , .
CMDIDOC.
, , .
, . , .
, , ~.
-CMDIDOC.
DECLARE_DYNCREATE
(CMDIDOC), DECLARE_DYNCREATE (class__name). class_name,
( ). ,
cobject, . , , , , , .
MFC Application
Wizard : onNewDocument, , S e r i a l i z e , CArchive. AssertValid Dump.

1. -

609

.
i 1.2.
// MDIDoc.cpp CMDIDoc
//
#include "stdafx.h"
jtinclude "MDI.h"
#include "MDIDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
s t a t i c char THIS__FILE[] =

FILE

#endif

// CMDIDoc
IMPLEMENT_DYNCREATE(CMDIDoc, CDocument)
BEGIN_MESSAGE_MAP(CMDIDoc, CDocument)
END_MESSAGE_MAP()
// CMDIDoc
CMDIDoc: :CMDIDoc ()
{
//
//
}
CMDIDoc::-CMDIDoc()
{
}
BOOL CMDIDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// ,
// ( SDI )

610

IV.

r e t u r n TRUE;
}

// CMDIDoc
void CMDIDoc::Serialize(CArchives ar)
if (ar.IsStoringO )
//
)
else
{
//

// CMDIDoc
#ifdef ^DEBUG
void CMDIDoc::AssertValid() const
{

CDocument::AssertValid();

void CMDIDoc::Dump(CDumpContextS dc) const


{
CDocument::Dump(dc);
)
ttendif

//_DEBUG

// CMDIDoc
, , , , . #include , . .
IMPLEMENT_DYNCREATE(CMDIDOC,
CDocument),
IMPLEMENT_DYNCREATE(class_name,base_class_name), class_name , base_class_name
.

1. -

611

DECLARE_DYNACREATE, ,
. .

. ,
,
.
CMDIDOC: :CMDIDOC(), , , CMDIDoc: :CMDIDoc (int par) : CDocument (par) ,
CDocument , .
C++, .
, Turbo Pascal

.

, C++, :
, , , , , , .
, .
. ,
,
, ,
. , :
,
.
,
.
.
, ,
.
. .
, , , .

612

IV.

,

- . , , .
, , MFC,
, .
. , C++ , . , , C++, , .
, . ,
,
.
,
.
. , .
, . ,
.
.
.
, - , ,
,
,
.
, .


C++ .
. , , . C++ , , . .
, .
,
, -

1. -

613

. ,
, , , .
,
, :
SomeClass(int);
SomeClass(int, int) ;
, . . , .

SomeClass(int,int=0)

, . , ,
,
.
, C++, .
,
, . ,
argument l+argument2

SomeClass
argumentl . o p e r a t o r + (argument2),
SomeClass, .
, ? s t r i n g l
+=
string2 str.cat ( s t r i n g l ,
s t r i n g 2 ) ,
+=, C++. , , .
C++
. , ,
+
, . , ,

.

, ,
, , . .
, . ,
, SomeClass,
. operator -()

614

IV.


operator

-(x)

,
, . (friend). , .
, . ,
. , friend
,
. , , SomeClass,
. o p e r a t o r -() operator - ( x , y ) .
=
. , . , .
,
.


. , . ,
, .
, C++
,
, . , , . .
. , .
, , . ?
? ,
. ,
, .
, , -

1. -

615

, ,
.
. ,
: " !"
, ,
. .
, . ,
,
.
, , , . ,
, . , , , .
, , , ,
, , , . .
. .
,
, .
,
. , , , . ,
.
, .


,
. :
;
., ,
;
1-> , lpx ;
SomeClass: : DerivedClass: :, SomeClass
, a DerivedClass ;
, .

616

IV.

, typedef,
, , , , .

. , ,
, :
SomeClass: :.
: :, , : :.
, , , someFunction(. . . ) , ,
,

BaseClass: : SomeFunction ( . . . ) , BaseClass . , , , ,
: : : SomeFunction ( . . . ) .
:
1. .
, .
2. , ,
. .
3. ,
: : , : : . ->,
, .
4. Someident :
SomeClass::Someldent, SomeObj.Someident SomePtr->

Someident,

SomeClass , SomeObj ,
a SomePtr ,
Someident .
5. , ,
, ,
, , .
, , , , . .
6.
.
.
7.
, .

2

Visual C++
Microsoft Visual C++ Visual
Studio.NET, .
Visual Studio
Developer Studio, Visual C++ 5.0 6.0.
Visual Studio ,
, , , , . ,
. , , . Visual Studio
. 2.1.
:. WebRead - Microsoft Vi.ual ++ ] - Wet*

Pmjea Build bebug louU Wn


i dow

File

Build
Crystal Reports - Insert
Crystal Reports - Main

WebReadView.cpp

OnBnClicbedStart

Data Design

4 * fi'

r x ;! Solution Explorer WebRead

Database Diagram
Debug
Debug Location

Sine1 ude "scdafx.h'


frinc
lude "WebRead.h"
finelude "WebP.eadDoc . h"
Sinelude "ebRsadVien.h'

Design
Dialog Editor
Diff-Merge Viewer
Formatting
Full Screen

#include

<afxinet.h>

#melude "URLDlg.h"

ifb Solution VebRead' (1 project)


i g l WebRtad
J Source Files
^ ] MainFrm cpp
^ ] stdafx cpp
_2 URLDIg cpp
J WebRead cpp
; * ] WebReadDoc.cpp
WebReadView.cpp
_ j Header Files
1 MainFrm h

HTML Editor
Image Editor

ftitfet

DEBUG

^ d e f i n e new DEBUG_NEH
#endif

Layout
Query
Source Control
Standard
Style 5heet
Table
Text Editor
View

Web
XM. Data
i ' Find Results 1 j

Ready

. 2 . 1 . Visual Studio

Properties
CWebReadView

VCCodeClass

*
CWebReadV
eiw

618

IV.


, ,
Visual Studio. . Visual C++ .
,
.
, , . ,
,
,
. . .
Visual C++ ', ,
, , , . , Visual C++ , Microsoft Excel Microsoft Word.
ActiveX. , , , ActiveX, ,
.
Visual C++ . ,
. , , , ,
.


Visual C++
, . 2.2 (
, ).
Visual C++, Help | Show Start Page ( | ).
Get Started ( ) , , Visual Studio.NET.
What's New ( )
, Online Community ( ) , Internet, Headlines ( ) MSDN, Internet, a
Search Online ( ) .

2. Visual C++

619

File Edti Veiw Proe


j ct Bud
li Debug Toosl Wnidow Hep
l
v Sou
l to
i n Expo
l rer-WebRead
Solution WebRead1 (1 project) ^
/p WebRead
Source Files
*3 MamFrm cpp
:
2 stdafx.cpp
_3 URLDIg.cpp
W

j CWebReadVe
iw VCCodeCals
(

. 2.2. Visual C++


'

Me

^rew

1 _J L

Prr]"Ct

.191 x|

2fbug Took Wn
i dow Help

Build

Debug

-
.= i default htm
%J

lL

II

& OnBnCkkedSI-att

Headlines

flfll Downloads
I My Profile

! (custom)

*]
1 [Default Settings]

Wincspw Layout:

I Visual Studio Default

Help Filter:

[visual C++ and Related

Show Help:
1
1
At
Startup:
1

"internal Help & xtam*


| Load last loaded Solution

Propertiei
| CWcbReadView VCCDdeClass

|;' | f| | | ^

Find Resulis 1

9X

(Name)

CWebR^adVeiw

C+ +
J
3-'-
Done

ri' 5FndResuJrslj

t*

5oho
tijn Expo
lrer WebPead V x
"S 5oulhonW
' ebPead'(1 proe
jct) _^
- ,jp WebRead
- _J S*o
Fe
liF
Turce
Mam
m
rs cpp
J2 stdafx cpp
^]
RLO
IP
c
p.p
_)UW
eg
b
R
e
ap
d
c
\
e
ad
d
D
op
u
p
J
W
e
b
R
e
a
V
e
c.ppcp
- _J Header Felisiw
_^

i/enf/ that-the follow ing settings ate personalized ot you j*_

HH

~^ C^ ^

;.

Start Page

'

J
d f Properties | Q l> /

. 2.3.

Mi 1'

_^

620

IV.

My Profile ( ), . 2.3. Visual


C++ .
, :
Profile ()
;
Keyboard Scheme ( ) ;
Windows Layout ( )
;
Help Filter ( ) ;
At Startup ( ) ,
.
, Show Help ( ),
.
Internal Help
( ). Visual C++ 5.0, . . .
External Help ( )
Visual C++ 6.0, . . .


Visual C++,
,
. ,
Visual C++. , , .
, ,
. ,
.
.
, :
1. .
2. .
.

2. Visual C++

621

3. .. 1 2 ,

Tools | Customize (, ). Customize ().


4. Toolbars ( ). Customize
() , . 2.4.

Toolbars | Commands Options


Toolbars:
New.,.

Analyzer Windows
Build
Crystal Reports - Insert
Crystal Reports - Man
i
Data Class Design
Database Diagram
Debug
P Debug Location

Reset..

Design
Dialog Editor
Diff-Merge Viewer
I Formatting
* Full Screen
HTML Table
" Image Editor
" Layout

Keyboard...

Close

. 2.4. Customize, Toolbars

5. Toolbars ( ).

.
6. Close ().
:
1. , .
2. Tools | Customize ( | ). Customize ().
3. Commands (). Customize () , . 2.5.
4. , .
5. .

IV.

622

Toolbars Commands j Options |


To add a command to a toolbar: select a category and drag the
command out of this dialog box to a toolbar.
Categories:
Commands:
,7}New Project,..
Edit
Ve
iw
] New File.,,
Project
Open Project...
iuild
Debug
Open Project From Web..,
Database
Schema
Open File...
Data
Styles

Keyboard.,,

Close

. 2.5. Customize, Commands

6. . .
7. , .
8. .
9. .
.
10. Categories () ,
, .
(, , , ,
, ).
11. Commands ().
12. Commands
().
13.
, .
14. . .
15. Close ().

, . 2.6.

2. Visual C++

. HTM- Mc
irosoft Visual t+*t
File

Eit

Project

BuH

DetU3

623
- I S ] X]

* * ! '

Toe s

W n d o

Help
i

Debug

|^ ah* core

HTMLh
;

f*I

_] HTML tr

. J

"

-,
i f let

^include

".h"

' 1

tM].

] > 1

, , ,

, ,

.,.

, ,

,.,t-

J
-

? a . .

a:-"

^ 7

Geneol

Help
# r
J arJI t E&.,
nd PrograrnP-iinq
. t, th- 4 ujl :++.NET6eta

J mJi

un ri-ation Start P*

^J r^:^ - j!;.

S Output

Q Dynamic Help j

Done

! Lnll

" Coll

Chi

;!

'INS

. 2.6.


(wrinkles),
, , , .
, , . . ,
. 2.7 Text Editor ( ). , .

"" . Visual Studio
.
Standard
(). .

Standard
, . , , . . 2.1
Standard () .

IV.

624

2.1. Standard

New Project

File | New I Project

Add New Item

Project | Add New Item

Open File

File | Open

Save

File | Save

Save All

File | Save All

Cut

Edit | Cut

Copy

Edit | Copy

Paste

Edit | Paste

Undo

Edit | Undo

Redo

Edit | Redo

Navigate Backward

View | Navigate Backward

Navigate Forward

View | Navigate Forward

Start

Debug I Start

Find in Files

Edit | Find and Replace | Find in Files

Solution Explorer

View | Solution Explorer

Properties Window

View | Properties Window

Toolbox

View! Toolbox

Class View

View I Class View

, New Project ( ), Add New


Item ( ) Class View ( )
, , .
Navigate Backward ( ) ,
, .

, Navigate Backward ( ) .
Standard () . Solution Configuration (
) ( ), Find () Edit | Find and
Replace | Find ( | | ).

2. Visual C++

625


Visual C++ .
, , .
,
, . Visual
C++ , , , .
Visual C++
, - ,
: "
, ."
Visual C++ ,
:
File () , , , , ;
Edit () , , , , ;
View () ,
Output ( ) Workspace ( );
Project () ;
Build () ;
Debug () ;
Tools () Visual C++
;
Window () ;
Help () Visual C++.

.

File
File (), . 2.7, ,
, , , , .

File / New
:
, , . 2.8.
File | New | Project ( | | )
New Project ( ), . 2.9.

626

IV.
.. WebRead - Microsoft Visual C++ 1 - Wd>Rs*)VlA
View

Protect

Build

Debug

Help

lools

OnBnClickecforart

Solution Explorer - WebRead

* I I WebReadVtew h |

"iJ Scluhcn'WebR*ad (l cm^ct) j ^


- J^ WebRead
- _J Source Files
J MainFrrn.cpp
_*] stdafx.cpp

j Add New. Item... Ctrl+5hift+A t


Add Existffifl Item.., 5htf t+Alt+A
Add Project
|
^ Open Solution...
-* Co
l se Solutbn
^ gave WebReadVe
i w.h Ctrl+S j p u t ) U c
Save WebPeadVe
i w.h As...
Advanced Save Options...
jjP Save A8
" Ctrl+Shift+S (CWebSeadViewl
Source Control
1
gj Page Setup...

Print...

Ctrl+P

Recent Projects

_ UPLDlg.cpp
_+] WebRead.cpp
J WebReadDoccpp
_+] WebP.eadView.cpp
, J Header Files
1 MsinFrm h

Exit

Ready

. 2.7. File
Fi
Edit
-le

Project Build Debug Toosl Wn


idow Hep
l
-
Cpen
,
Prcjea Ctrl+5Nft+N
Cbse
r _J File
Ctrl+N
j Add Ne^ Item...
Ctri+Sbft+A
$, Ba
l nk Solution.

, Add Existing Item...

Shift+Alt+A

DICanUnbadltoH
: I Solution Explorer - HTML
J DemoDIg cpp
J HTML cpp
^ ] HTML re
j^j HTMLDoc ccp
J] HTML View, cpo
J MamFrm rpp
_J makehrnilhelp.bat

j
v ]
1
t
j

Ad.d Project
^
^

Ope_n Solution...
Close Solution

~l Save DemoDlg.cpp

Ctrl+S

Exchange(CDacaEychange*

SaveDemoOlg.cppus...
[change (pDX) ;

Advanced Save Options...

Save A)

Ctrl+Shift+S
moDlg, CDialocj)

Page Setup..,

|* Print...
Recent Files
Recent Projects
Etf
'HTl

jCDemoDIg VCCodeCliSS
[ i T ] zt [ a i j -/ a

Source Control

t
1

Ctrl+P

Z.
4- X

j CWebReadView VCCodKIlay

Recent Files

9... V

j
55",

. 2.8. New

_^_

2. Visual C++

Project Types
- j Visual Basic Projects
-,.""I Visual C# Projects
.'...'j Setup and Deployment Projects
! L__] Other Projects
Ll3 Visual Studio Solutions

627

Templates:

Li

M *
F

Managed C++ Managed C++ Managed C++


Application Class Library Empty. Project

M
dervC
ti*Ap
M
C
WaenbageS
cie++ M
CoFnCtroAlc,e
pFc
ilato
i n j^J
Anappcilato
i nthatusestheMcirosoftFoundao
tinCalssLb
i rary,
Name:
j <Enter name>
Locato
i n: j E\:Documenst and Setnigs\Adrnnisitrator\My Documen j[] Browse. I
f* Add to Sou
lo
tin ( Colse Sou
lo
tin
ProejctwiflbecreatedatE:\.,\Admn
i;itrator\MyOD
ocuments\Vsiual5tudo
i Proejcts\<Entername>.
K
1 Cance
Hepl I
. 2.9. New Project

.
1.
<Ctrl>+<Shift>+<N>.
File | New | File ( | | ). New File ( ), . 2.10.

Templates:

Categories:

C++ File Header File Md


i i File (.idi)
(.cpp)
(.h)

Ius
Res(o
u
c
r
e
F
e
l
i
B
m
t
i
a
p
F
e
l
i
C
li
.re) b
.(mp) (.cur)rorFe

cIonFe
li (,c
iT
oe)mR
r.e
p
ae
ltesou.c
.
[ Creates a C++ source file.

Open

. 2.10. New File

IV.

628

,
.
<Ctrl>+<N>.
File | New | Blank Solution ( | | ) New Project ( ). Project Types ( )
Visual Studio Solutions ( Visual Studio),
Visual Studio.NET.

File / Open
, , , .
File | Open | Project ( | | ), Open Project ( ), . 2.11.
Open Project
Lookjn:

Desko
tp
*
Favorte
is

I Visual Studio Projects

IBrush
'IConsoel
'IDae
tTm
ie
'IDernoLbi
*"lDaio
lg
_J Editftpp
_2j Extension
ZjHelp
_1|HTML
'I Library
_l|Line
_2]List

UMuIti
_JPrn
it
LJProgress
LllRee
flct
CjR
cihApp
CjSDI
LjSheet
_S
Iync
G)Text
J_lTool
vSMacros

,-

ZJMDI

File name:
Files of type: JA|| Project Files

T]
^

Add to Solution
^ Close Solution

. 2 . 1 1 . Open Project

,
Close Solution ( ).
(solution) . , Add to Solution ( ) . <Ctrl>+<Shift>+<0>.
File | Open | Project From Web ( | |
) Open Project From Web ( ),
. 2.12.

2. Visual C++

629

(Open Project Front Wftf#


Enter the URL of the server that you want to open the project from:
OK

Cancel

Help

. 2.12. Open Project From Web

,
, .
File | Open | File ( | | ).
Open File ( ), . 2.13.
2-J
Look in: |_J HTML
(cj stdafx.cpp
__l Debug
jK] stdafx.h
Jjhlp
res
History
t$ ChildFrrn.h
OS) HTML.cpp
.h]HTML.h
My Projects S HTML, re
HTMLDoccpp
_h] HTMLDoc.h
cj\ HTMLVe
i w.cpp
Desktop
_h] HTMLVe
iwh
ex\ Man
i Frm.cpp
_h] Man
i Frm.h
Favorites Vtj Resource.h

X CJ 3 - Tools-

File Qame:

Fe
lis of type:V
|s
iualC++ Fe
lis

zl

Open

. 2.13. Open File

, Windows Open File (), Windows. Files of type ( )


, .
, ,
.
.
Open () . , Open With ( ). Open With - HTML.rc ( ), . 2.14.

IV.

630
With - HTMUrc
Select a program to open:
Resource Editor (Default)
Source Code (Text) Editor
Source Code (Text) Editor With Encoding
HTML/XML Editor
HTML/XML Editor with Encoding
Visual
Binary Editor

Open

Add,..

Set as Default
Close

Help

. 2.14. Open With

, ,
.
Select a program to open ( ) Source Code (Text) Editor ( ).

<Ctrl>+<O>.

File | Open | File From Web ( | | ) Open File From Web ( ), Open Project From Web ( )
. 2.12.

File / Close
,
. ,
. ( ,
).

File / Add New Item File / Add Existing Item


File | Add New Item ( | ) File | Add Existing Item ( | ) Project (), .

File / Add Project


, , . File | Add Project | New Project ( |
| ) File | New |
Project ( | | ), File | Add Project | Existing Project (
| )

2. Visual C++

631

File | Open | Project ( | | ), File | Add Project | Existing


Project From Web ( | | ) File | Open | Project From Web ( |
). .
Add Existing Project ( ),
Open Project ( ), , .

File / Open Solution


.
Open Solution ( ),
. 2.15.

Loot in:

History

_J Wisual Studio Pic ects


_ J Brush
1 Console
_l DateTirr.e
_JDDB
' 1 DernoLib
_ j Dialog
_JDIB
_J EditApp
1 Extension
_llHelp
_ J HTML
r
1 1 iKi-.=<rw

jj

Tools'

_lj Mult!
J j Print
__J Progress
^ J Reflect
*"l RichApp
_JSDI
_ l Sheet
_ll Sync
^ J Text
_ll Tool
' | VSMacros

Favorites
File name:
Files of type:

Solution Files

Cancel

. 2.15. Open Solution

: , , Open ().
,
. Visual C++ .

File / Close Solution


.
, ,
. 2.16.
21 . 629

IV.

632
Microsoft Development fnvir
Save changes to the following items?

I ~fe."." '."1 _ _ _ J L L _ J C a n c e l

Help

. 2.16.

File / Save
,
, . ,
, , File | Save As ( | ).
,
.

File / Save As
, ,
, , , , .
Save File As ( ), .2.17.

,
.

File \ Advanced Save Options


Advanced Save
Options ( ), . 2.18.
Encoding () , , Line endings ( ) , (
).

2. Visual C++
Save File As
Save in;

History

_3

Projects

Desktop

Favorites

_J HTML

633

Si

CJC]' Toosl -

I Debug
Jjhlp
Ires
20 ChildFrm.h
20 HTML.h
20HTMLDoc.h
20 HTMLView.h
20 MainFrm.h
20 Resource.h

Filename:

d
-r j

Save as type: |++Header Files

Save [" 1
Cancel -

. 2.17. Save File As

I Advanced Save o S ^ S

^ ^ ^ ! ! ! !

.,:.:

ill

Encoding:
[ (Windows) - Codepage 1251

Line endings:
Current Setting
[

OK

jj

Cancel

Help

. 2.18.
Advanced Save Options

File I Save All


,
. 10
15 , . .

File \ Source Control


. -

IV.

634

. , .

File \ Page Setup


Page Setup (
), . 2.19.

Paper
Size:

Preview 4

Source: (Default
. Orientation

Margins (millimeters)

Portrait

Left:

flS

Right:

"*5

<" Landscape

Top:

["is

Bottom: jT5~

Fax
K* Page header
" Line numbers

]]

Cancel

. 2.19. Page Setup

, , , . .
Printer () ,
. .

File / Print
, .
,
.

Print (), . 2.20.
Name () ,
( ).
Print range ( ) , .

2. Visual C++

635

() .
Selection ()
.

Printer
Properties

Name
"^^^^^^^
Status: P'eady
Type: Windows NT Fax Driver
; Where: M5FAX:
Comment:
: Print range

Punt to file
Copies

' ' All

. Number of copies

OK

Cancel

. 2.20. Print

Properties () Properties (), .


.

File / Recent Files


, . .

File / Recent Projects


,
(,
, , ). 1
, .
1 . .

File I Exit
Visual C++.

IV.

636

Edit
Edit (), . 2.21, , , , ,
, .
'.. HTML - Microsoft Visual C++Id
File Edti 1 ew Proe
j ct guild D_ebug

-i] . > >


$

ra "i

Undo

cut

Paste

>

delete

Window

Ctrl+Z

Qrl+X

"^1

^ Debug

[ ^ m_Svnc

CHTMLApp

Ctrl+C

, Cfci Copy

_ j g ( xi
lools

I'I

HTKL

~3f Solution 'HTML' (1 project)


- J 3 HTML
J Source Flies

appli.i-ar.ior,

Ctrl+

Cycle Clipboard Ring

_3 ChldFrm cpp

Ctr +Shift+V

J HTML.cpp
J HTML.re
J HTMLDoc cpp

Del

Select All

.h'

Ctrl+A

before

including this

f i l e

f o r VCR

Find and Replace


Go To,,.

Ctrl+G

Insert File As Text...

Advanced
plii[ie,.i,.d.

Bookmarks
Outlining

l(J

r.
"J^i

TmApp

IntelliSense
> :

_^] HTML View cpp " "


*] MainFrm cpp
__] makehtmlheip.bat
J stdafx cpp
_ J Header Files
_ J CMdF*m h
J\ HTML-h
1 HTMLDOC h

1 " p
^*r
*] !<
'

2 * '-'
j CHTMLApp VCCodeClass

General
-'

(Name)

CHTMLApp

Comment

CHTMLApp. DSeeZ.

! C++

1
3 h-

CS1 Properties [ : ,, ,

Output | i f l

"Read/

1:

Ln 19

Col 13

Ch 10

INS

. 2 . 2 1 . Edit

Edit / Undo
,
. , ,
. , ,

, , , ,
.
Standard () Undo () , (
,
). . 2.22.

2. Visual C++

637

( ). ,
,
.
-lolxi
Efe

Edit

Bew

Eroject

1 _J t-"4 &
r 1 it

H*S
r;
fj

Iools

""> !

Bndow

<P

1
> Debug

"

-* > x
*

l,iEnt"
Cut
Delete

i ijr
I e

'

Till

vi'l L

">'i

|
_U

I'

~"
*

JJ
Undo 1 Action

Sifndef
AFXWIN H
Bercor include

~ ^ * - .

M m_Sync

HTMUKcut

'

"
i
i

"4

P_ebug

Faslc
Paste
inn

!f

Euild

i
'3tdafx.h'

before

including

chis

file

for

^J Solution HTML fl project)


- SI HTML
_j Source Files
_3 Chd
li Frm cpp
:

J] HTML.CPP

j ^ ] HTML.
[Q HTMLDoc.cpp
i i ] HTMLView.cpp
J ] MainFrm.cpp
^ makehtmlhelp.bat
J ^ stdafx.cpp

PCH

^enciif
\

^include

" r e s o u r c e , h"

//

r i i ^ i r i "::.:\:

HT'.L.") I > :

_ j Header Files
_ ] ChildFrm h
_) HTML.h
1 HTMLDoc h

c l a s s CHTHLApp

p.il_.lic CWinApp

<l '
._ General

> U "- '

-aJ

| CHTMLApp VCCodeCa
l ss

-*T~
i El
- -- -
(Name)
CHTMLApp

Comment
CHTMLApp; D5ee^
C++

HI
J3 i * i j ,

i
El Output |

.M.i

Ready

^..ij.

-..j

ES* Properties | Dyrarr.ii. help


|!

., Ln 13

Col 49

Ch49

11

IllNS

. 2.22.

Edit / Redo

Undo (), Redo (). Undo (). Redo ()
Standard () ,
, ,
Undo ().

Edit / Cut

(Clipboard) . ,

.

638

IV.

Edit /

(Clipboard).
. , .

Edit / Paste

(Clipboard) , , . , . ,

.

Edit / Delete
Edit | Delete .
,
Undo () Standard ().

Edit \ Select All


, , . .
.
,
<Ctrl>, ,
, Edit | Select All ( | ) , <Ctrl>,
, .

Edit / Find and Replace


, , . . 2.23.
Edit | Find and Replace | Find ( | | ) <Ctrl>+<F> Find
(), . 2.24.
.
:
( Current document ( ));

2. Visual C++

639

( All open documents (


));
( Selection only (
));
, (, . .) ( Only ()).
, HTML - Microtoll Visual C++(

Flli- E it Jm Project Build fr-bug

Debuq

t -

"

p
1

Lut

_
]

Fa*re
< j.\f lipboard Ring

p_elete

Select All

Find and Replace

Go To...

Insert File As Text...

Advanced

'

Bookmarks

Outlining

J.I

Ctll+C

ctri+v

H T M L . r e

I D O _ A B O U T e o /

[ E n g l i s h

( I

J Icon

Ctr +Shift+V

CDia

j Menu
_J String Table

] Toolbar

Ctrl+A

1 Version
F i n d

CWK,

C t r l + F

C t r l + H

R e p l a c e

F i ' n d

i n

R e p l a c e

F i n d

Intelii5ense
".

A c c e l e r a t o r
D i a l o g

F i l e s

C t r l + S h i f t + F

i n

C t r l + 5 h i f > + H

F i l e s

S y m b o l

Q r l + S h i f t + \

'CAboutDIg VCCodeClass

- - I '.' ii tff -/ rif

j General

'

( i
Comment

CAbnutDIg
.

CAboutplq dialog ,'

C++

Output | 1J

fi* Properties [ Q

Item(s) Saved

Ln 101

Cols

Ch8

. 2.23. Find and Replace

Find what:

*] _ J

Match case

S e a r c h

Match whole word

Search hidden text

Replace

Current document

'"" open documents


Close

" Search upi

Help

. 2.24. Find

INS

640

IV.

Find what
(). ,
.
, , .
Find () :
Match case ( ) ,

Find what (). , , , ;
Match whole word ( ) ,
Find what () , ;
Search hidden text ( ) ;
Search up ( ) ;
Use () . Regular expressions ( )
Find what () .
,
, , .
, Find what (),
, . 2.25.
Wildcards ( ) . , , (?) , (*)
.
Find () Find what ()
Find Next ( ). Find ()
.
Find
() Find Next ( ).
.

Mark All (). ,
, . , <F2>.
, Find
(), Find (),

2. Visual C++

641

Standard (), , Find what ().


<Enter>
.

|_5

Find what:

< Search --; -

Match case

' f Current document

" Match whole word

All open documents

Search hidden text


* Search up

Use.: JRegular expressions *[

Beginning of line

$ End of line
< Beginning of word
> End of word
\n Line'break

[ 3 Any one character in the set


[ ] Any one character not in the set
I Or
\ Escape Special Character
{} Tag expression
:i C/C++identifier
;q Quoted string
;b Space or Tab
:z Integer
Help on Pattern Matching
Complete Character List

. 2.25.

Edit | Find and Replace | Replace ( | |


) <Ctrl>+<H>
Replace (), . 2.26.

|
Find what:
Repjace with: |

Bnd Next
Replace
Search
( Current document
1 f" All open documents
<~ flection only

" Match case


" Match whole word
" Search hidden text
" Search up

Use; I . ,

Replace All
Mark All
Close
Help

. 2.26. Replace

, Find (), . -

IV.

642

Find what () Match case ( ),


Match whole word ( ). Search hidden text ( ), Search up ( ), Use () , Search
() Replace () Find (). Replace () Find
() , Find Next ( )
, .
Replace with ( )
, . , Find what (),
, .
, ,
. Replace with (
) .
Find Next ( )
, Replace ().
.
Replace All ( ),
. Replace All (
) ,

, Undo () . - , , , Replace () , .
Edit | Find and Replace | Find in Files ( | | ) <Ctrl>+<Shift>+<F> Find in Files ( ),
. 2.27.
ill
Find what

Find

* Match case

Replace

" Match whole word

Look in:

Current Project
* Look in subfolders

File types:

Close

j*.*

'~ Display in Find 2

Display file names only

. 2.27. Find in Files

Help

^I

2. Visual C++

643

, File types
( ). , Find (), Find what ().
Find
().
Look in ( )
. , ,
.
, .
Look In ( ), . 2.28.

To browse a folder or network share, type the name in the Browse box. belect folders in the Available
items box and click Add to move the items to the Look in box. To move up one directory., press BKSP,
Items to Look in;
Current Project

Available items;
_J Current Project

Remove
Move Up
Move Down
~ 5how files

OK

. 2.28. Look In

Find In Files ( )
Match case ( ), Match whole word ( ) Use
(), Find () Replace (). ,
:
Display in Find 2 ( 2) Find Results 2 ( 2);
Display file names only ( ) Find Results
( ) ,
( , ).

644

IV.

Find ()
Visual C++ Find Results ( ),
. 2.29. ' Find Results ( ) ,
. ,
, Display in Find 2 ( 2).
. HTML - Microsoft Visual C++ [design] - HfML.trai
Ejle Edti Ve
iw Eroe
j ct guild Eebug look a*dov te
i \p
iS E? US "> " <P * Debug
HTML hhp a? or e -hi m HTML. h HTML.cpp*

i * x

- _jHTML.rc
+ ; j Accee
l rator
- ;_j Da
io
lg
^D
I D_ABOUTBOX [Engs
il h (I
J Icon
Menu
_J
1 String Tabe
l
j Toob
l ar
j Verso
in

d
' '

1.. p p

Defines

lie.

Ii

1
f r i n g l u . d e" s t d a f x . h "
((include "HTHL.h"
^include "MainFrm.h"
#include "ChildFrm.h"
^include "HTMLDoc.h"
ffinclude "HTHLViera.h"
i i f d e t _DEBUG
1 Wefine new DEBUG NEW
\ Sundef THIS FILE
:
s t a t i c char THIS FILE[] : audit

FILE

;
r

<(
[ E l H T M L A p p
r i c e " . ' :

--

\Documents a n d 5ettings\Nick\Mv DocumentsWisual Studio Pro]ects\HTMHPeadMe t

\Documents a n d 5ettings\Nick\My Docurnents\Visual Studio Projects(HTMHReadMe

txt(Bl)

hip\HTML

\Documents a n d Settmgs\N:k\My Documents\Visual Studio Projects\HTMHReadMe

txt(85)

hlp\HTHL.hhc

t p 6 )

r e s o u r c e file HTr- J
hhp

E:\Documents a n d 5ettkigs\Nick\My Documents\Visual Studio Proiects\HTMHReadMe,txt(88);hlpiHTML.hhk

E:\Documents a n d Settiigs\Nick\My Documents\Visual Studio ProjectsiHTML\ReadMe,txt(98):makehtmlhe!p.bat

E:\Documentsand5ettrigs\Nick\My Doruments\Visual Studio Pro)ects\HTML\ReadMe.txt(121):


Tola

21

Read/

found

252

VCCodeClass

J U

M a t c h i n g files

14

n a m e d HTML pc

Totdl fitej s e a r c h e d : 22

Find Result' 1 | i-

rI
Ln3

C +

(Name)

CHTMLApp

Comment

CHTMLApp:

q s e e j

. L^ Properties |
Coll'

Chi

. 2.29.

, Find Results ( ). , ,
. , . .
, ,
.
Replace () Find in Files (
) Replace in Files ( ),
. 2.30.

2. Visual C++

645

Edit | Find and Replace | Replace in Files ( | |


) <Ctrl>+<Shift>+<H>.
keplace in Files

"' # ' ^ ^ ^ ^ 1 1

Find what:

Repjace with:

m_nAperture

* Match case

Look in;

Use:

Match whole word

xl

Replace
Replace All j

" Keep modified files open after


Replace All

Current Project

Find Next j

Skip File

Close

Help

^3

~ Look in subfolders
**

File types:

'J

" Display in Fin J2

. 2.30. Replace in Files

Replace (),
,
, , Look in ( ) File types ( ).
Edit | Find and Replace | Find Symbol ( | | ) <Ctrl>+<Shift>+<Y> Find Symbol ( ), . 2.31.

Find Symbol
Find what:
L.ookin:

Find
[Active Project

; Options
;

** Match whole word


f* Match prefix
~ Match substring

Match case

Close
Help

. 2 . 3 1 . Find Symbol

, , , , , ,
, , , .
Find Symbol Results ( ), . 2.32.
:
Find what () , .
, ;

IV.

646

CHTMLApp e:\docufflents arid settingsinickimy document


i CHTMLApp: :(.HTMLApp(void) - e:\documents and settings^:

. 2.32. Find Symbol Results

Look in ( ) , , .
:
Active Project ( )
, ;

Selected Components ( ) , ,
, , :
Browse
(). Selected Components
( ), . 2.33. , , ;

Match whole word ( )


, . , "Demo"
"Demo", "DemoObject" "CDemo";
Match prefix ( ) , . ,
. , "Demo" "Demo" "DemoObject",
"CDemo";
Match substring (He ) , . , "Demo"
"Demo", "DemoObject" "CDemo";

2. Visual C++

647

Selected Components
Select the components to browse:
Other Packages and Libraries

Cancel
Help

Add...

Select the components you wish to see in the Object Browser by checking
the box next to them. Selected components are marked in bold. Use the
"Add" button to view additional components to browse. This list will be
persisted between sessions.
. 2.33. Selected Components

Match case ( )
Find () Replace ().
.

Edit / Go
Go To Line (),
. 2.34.

Line number (1 -136):


OK

Cancel j

. 2.34. Go To Line

*
. ,
.

Edit / Insert File As Text



. -

IV.

648

pa, Insert File


( ), . 2.35.

Look in:

HTML
I Debug
_lhlp
res
History
<$ ChildFrm.cpp
_h] ChildFrm.h
cj] HTML.cpp
Jh]
HTML.h
My Projects
OS HTML.re
JC| HTMLDoc.cpp
|hQHTMLDoc.h
[e||
HTML View.epp
Des<
l J:op
|h]HTMLView,h
*] MainFrrn.cpp
[h]ManFrm.h
Resource.h
Favorites

Q - Tools -

stdafx.cpp
[h]stdafx.h

File name:

Open

Files of type; I Visual C++ Files

Cancel

. 2.35. Insert File

Edit I Advanced
. , ,
. 2.36.
:
Format Selection ( ) ,
;
Tabify Selection ()
;
D Untabify Selection ()
* ;
Make Uppercase ( ) ;
Make Lowercase ( ) ;
Delete Horizontal White Space ( )
.

2. Visual C++

649

.
;
.< WebRead - Microsoft Visual C++ [design!- WetiRe

File Edti y.e


i w Efoject guild Cebug Iools fn
i dw
i Hep
l
j]
!
<P > Debug

- ,4 OnBnClickedStart

WebReadView.h |

*
(

cu.

O * ( Sou
l to
i n Expo
l rer - WebRead

l]*i Cop,-

Qrl+C

13%

Ctrl+V

'" 1 Solution WebRead1 (I project)


' - .33 WebRead
.- -_J Source Files
J MainFrm cpp
J stdafx.cpp
J URLDIg.cpp
i*] WebRead.cpp
WebReodDoccpp
WebReadView.cpp
- _i Header Files
1 MainFrtn.h

Cycle Clipboard Ring Ctrl+Shift+V

P_dete
See
l ct All
Fn
i d and Repa
lce
Lo To
Insert File w Text

Del
Ctr+
lA
CEdicVieu
i

-i* i

Advanced

F j r n at Selection

Bookmarks

l a t i f v S e l e ticn

Outlining

U n t a b i f y Selection

Intelli5ense

Make Uppercase

t ]

Make Lowercase

Find Resufcs 1

D e l e t e [Horizontal W h i t e Space
T!

View W h i t e Space
Word Wrap

"Z

; ). Find Results I [
Ready

"

"

> F

Ctrl+K, Ctrl+F
Properties
I CWebReadVie
Ctrl+Shift+U
Ctrl+U

(Name)

CWebReadView

Ctrl+K, Ctrl+\
Ctrl+R, Ctrl+W
Ctrl+R, Ctrl+R

I n c r e m e n t a l Search

Ccrl+I

C o m m e n t Selection

Ctrl+K, Ctrl+C

U n c o m m e n t Selection

Ctrl+K, Ctrl+U

Increase Line indent

*^ Decrease Line Indent

. 2.36. Advanced

View White Space ( ) -


("." ">>" );
Word Wrap ( )

. ;
Incremental Search ( ) , Find ().
,

.
, , .
;
Comment Selection ( )

650

IV.

(//). , ;
Uncomment Selection ( )
Comment Selection (
);
Increase Line Indent ( )
;
Decrease Line Indent ( )
.
. 2.35,
. ( ) . , Visual Studio.NET
Turbo Pascal .

Edit / Bookmarks
. , ,
. 2.37.
"4. HTML - Microsoft Visual +
File

Edt

View

P ofect

guild

Debug

_J]

Tirl.

" '

Wining

<P

r>lf
[>buq

- _fc^ A -erf nlld

ZJ I Initlnstance

Ctrl+C

i.cfc

lift

ard Ring

r all

^
,
J

4e-^l*unHTMHlpiuVLti
5 HTML

J < hlJFim

; = (u )

Ctrl+G

pr

J HTMLDoi r p p
*1 HTML

:|;

_ ] niakphtmlhelp t t

;
_

Advanced

Bookmarks

^ J .-"&

Outlining

'.ar...F... .1 N..1T

Ctrl-t-K, Ctrl+K

; * |

y e x t Bookmark

Ctrl+K, C t r l + N

Previous Booknark

Ctrl+K, Ctrl+P

* *
^.

<Jr-3t P i 1
H d d T 3 j U l

tf ' t

*1 ="tddf- cpp
, ^ ^ Clar

*5 '"ului'
'
--'

F.UT.LFn'1

loggle Bookmak

"

PW L p p

J MariF ni cpp

> -'" ' "'-'


'

1 HTML r

Insert File A s T e x t . , ,

<4LJ

JHTML.pf

'

CU1+A

Go To...

^ J Task L x t | Q

Del

Find and Replace

Ready

:
i

Orl+SMFt+V

'

trl+t

i r^il+L

r l+r

frl+H

zl
|

Z l

I'

t"

l^
:.

-^jj

Ln 49

. 2.37. Bookmarks

f i

FropeFties J Q

Col 29

Ch 26

r<

,
INS

2. Visual C++

651

:
Toggle Bookmark ( )
, , ,
;
Next Bookmark ( ) ;
Previous Bookmark ( )
;
Clear Bookmarks ( )
;
Add Task List Shortcut ( ) , , Task List ( ) ( Show Tasks | Shortcut ( |
) Show Tasks | All ( | )).
Task List ( ) . , Remove Task List Shortcut
( ).

Edit / Outlining
. , , . 2.38.
#.
Visual C++
.
Outlining ( ) :
Hide Selection ( )
. , . 2.39.
, ;
Toggle Outlining Expansion ( )
,
,
. 2.40. , . ,
;
Toggle All Outlining ( )
,
, . 2.41.
. ,
;

IV.

652
HTML - Microsoft Visual C4+ - *
Froiect

Eir

guild

Debug

Tools

Window

<) -

Ctrl+X
Qrl+C

Help
Debug

z\

I lnitlnstan.ee

SolutionH
' TML'(1 project)
JIHTML
^ Source Files
J Chd
li Frm.cpp
J HTMLC
. pp

3 X Qee
l te
5e!ect Al
Find and Repa
l ce
fipTo...
Insert File A5 Text...
Advanced

3 HTML
HTMLDoccpp
HTMLView.cpp
MamFrm.cpp

OLE_INIT_FAILED);

OutllQing

Hide Selection

Ctrl+M, Ctrl+H

Toggle Outlining Expansion Ctrl+M, Ctrl+M


")
'

Toggle All Outlining

Ctrl+M, Ctrl+L

StQE Outlining

Ctrl+M, Ctrl+P

Stop Hiding Current

Ctrl+M, Ctrl+U

Collapse to Definitions

Ctrl+M, Ctrl+O

. 2 . 3 8 . Outlining
uai c-t+! - &
File E ' View Projecr guild F>bu
v^ndow Help

-aJ&J.*.

i initlnstance

f'XCHTMLApp

, 9 Solotion H
' TML' (1 project)

Tj

CHTHLApp theApp;

/-' CliTHLAyp lnitialication


BOOL CHTHLApp::Iniclnstance()

CDinApp::InitInstance();
B l

JIHTML

- _J Source Files
J ChW
i Frm epp
_+] HTML.Cpp
_^] HTML re
J HTMLDOC CpO
_*] HTML View epp
J ManFrm.cpp
_J makehtrnlrielp bat
_^] stdafx epp

retucn FALSE;
>
AfxEnableContcolContainec(J ;
f ,. ' 1 * ! _'_J ,.4

L*f Properties J Q
* In S5

. 2 . 3 9 .

Ch 1

2. Visual C++

653

.. H T M L - Microsoft Visual + + f & t f ( ^ ^ !


F le

Edit

View

Preset

gu

Cebu
*

Tools

Window

^CAboutDlq

Help
Debug

Q Asset tvabd

CAboutDlq
*.-, ^ a i ^ f t ,

'Hi> )

,
_
~"\ ^Solution'HTML'(1 project)
' - - ! T | - ]PMTML

E ProcessSheilCoitutiandtcrcidlnfo) >
r e t u r n FALSE;

pHainFranie->ShowWindow (iti nCmdShow) ;


pHainFcairie->UpdateWindow () ,
r e t u r n TRUE;

t"^5olutl
'" c l a s s CAlPQUtDlg : p u b l i c CDialog

^_

_ j Source Files
J CMdFrm cpp
J HTML, cpp
J HTML rc
J HTMLDoc.cpp
J HTMLView.cpp
*1 ManFrm cpp
__] makehtmlhelp bat
J stdafx cpp
-|*XQ.s

*
; About Dig VCCodeClass

.|:AboutDlg: :CAboucDlg()

:: 4* 1 ^ a -

: CDialog [CAboutDlg: : IDD)

H,
(Name)
Comment

\ Task List f

CAboutDlg
CAboutDlg dialog -

L^1 Properties \Ql a Ht H-

i l
LnU5

Coll

Chi

INS

. 2.40.
. HTML - Microsoft Visual C+ + [cteslgn] MTMlipp
Fife Ec5t Ve
i w Project Build Debug Toosl Wnidow Hep
l
J5J
?

^ \ ^CAboutDlq

; CAboutDlg

~~\
T]

^ J Solutran 'HTML" (I proiect)


-

_ J Source Files
J ChildFrm.cpp
J HTML.cpp
J HTML.re
J HTMLDoc.cpp
J HTML View, cpp
J MainFrm.cpp
J makehtmlhefe3.bat
J stdafx cpp

CHTMLApp theAppj

; BOOL CHTHLApp: : I n i C l n s t a n c e (

l a s ^ CAboutDlg : p u b l i c CDialog

_*_

.33HTML

';

fTAboutDlg: : About Pig [> : CD l a l o g (CAboutDlg: : IDD)

[CAboutDlg VCCodeCless

-!J . .
2

O\ TaskLM | H
Ready

(Name)
Comment

CAboutDlg
CAboutDlg dalog

^ * Properties | Q I
Ln 115

Coil

. 2.41.

"

Ch 1

IV.

654

Stop Outlining ( )
( ,
);
Stop Hiding Current ( )
Hide Selection ( );
Collapse to Definitions ( ) , Toggle All Outlining ( ), . 2.42
,
.
,
.
Visual C++ , , Hide Selection ( ), . , Hide Selection (
) ,
.

tHp

File Edti \}r Errji-rt buld E>t_g Io Is

'J 1 CHTMLApp

_^] LhildFtm cpp


_*] HTML Lpp
J HTML
_*] HTMLDt i pp
_^] 1L\ lew i pp
J NainFim <pp
_ ) r i3lt-ht-nHhclp.bat
J Maf fpp

Sirndef AFXMIN_H
#ert:ui: include 'stdafx.h' before including this file or PrH
ftendif
^include "resource.h"
'/

'.'' r^iin.ri r^mi:::i:

J
hildFrni h
_J 1 h

CHTKLAf-p:

1 It - r l-

"B
CHTMLApp : p u b l i c CWinAppI

;
j CHTMLApp

H
xj

(FJamet

Ln 16

Col 32

Descrp
ito
in

2] Task List |
Ready

*J- i
:
:

. 2.42.

CHTHLApp

2. Visual C++

655

Edit / IntelliSense
.
, , , . 2.43. , , , .

Fe
li Edti Ve
in Eroe
ict Bu
d
li
J]-Urd
:

L-buo

T LU

+:

_irdo
<

-t,l +

tii+

P -

H^lp
[ 4

| *

M Asserf'^alid

">
Tj
;

-i-lc Jipboard Ring


X

cti

Delete

Select All

Find and Replace

+rhft+/
Del

+ 1

;.h'

before

including

this

file

for

Insert File As Text..


Advanced

Boctaarfa

InteBiSense

H I !

I L D L

c p p

_ j Head-, Files
_ J hildFtrn h
J HTJ1L h
^ ^ luti

JinApp

t--.<

J HTML Vie v.cpp


JlbmFrmcpp
_) mafr-htmlhelp.bat

>

-50'

. ,.}

Outlining

| CHTMLApp VCCDdeClass

<_! _ , ..
I ,, Oescp
io
tir,
:<|
Ready

_ ^ ]

Ctrl+G

J hildFtrn cpp
_3 HTM pp

Ctrl+A

Go To...

v j Task List | E "

"~.

List Members

Farameter Info

.'

tojicklnfo

fi

Complete Word

Ctrl+J
i_trl+Shift+5pace
x j

Ctrl+K, Ctrl+I

i J J a n i e )

C H T M L A p p

Comrn^ril"

CHTMLApp- 5

Alt+Right Arrow

1
( ^ Properties | Q

<**3
: Lnl6

Col 32

Ch32

IMS

. 2.43. IntelliSense

:
List Members ( )
, . 2.44;
Parameter Info ( ) , . 2.45;
Quick Info ( )
, . 2.46;
D Complete Word ( )
,
.

IV.

656
aft Visual + * [dentnn] HIM ipp

Ffc Edit Ve
i w Project |uild Debug lools M i a Heb
'

-in

1. t

. .

HTML.CPP

ft CHTMLApp

Childl rm LPP
HTML cpp
HTML ic
HTMLDo: cpp
HTMLVtew cpp
JJ Man
iFrm cpp
_J maUhtmh
l dp bat
5ee HTML.cpp for the m
i pe
l mentato
i n of this clasJsstdaf* cpp
-^J Header Files
J] ChlidFrm.h
_0 HTML.h

BOOL CHTKLp"p:T"lnicinstance()
'

'jj chSpace
* i CHString
* CHStringArray
$ CHStringData

"' CHtmlContrd5ite
^ij CHTMLDoc
* CHtmlEditarl
<T> CHtmE
l dtiCtrB
l ase
** CHtmlEditarlBase<T>
I

iL

j CHTMLApp VCCodeOass

i
f

&

i j ' ', *
~' *
^
jfj (Name)
CHTMLApp
Comment
CHTMLApp D5ee

. 2.44.
fb
i &dit Ve
i w Project guikt D^bug lools y/mdow Hep
l
HTML.cpp |
J Lhild^-m cpp
J J HTML cpp
_ * ] HTML re
J HTMLDoc cpp
J HTML View.cpp
J MainFrm cpp
_ J malehtrnlrielp bat
J stdafx cpp
J Headei File;
_ J ChildFrm h
J\ HTML.h

BOOL CHTHLApp. . I n i C l n s t a n c e O
<
CUinApp::InitInstance();
IBOOL Initlnstance (")]
if ( ! AfxOlelnit-O )
1

AfxMessage3ox(IDP_0LE_INIT_FAILED);
r e t u r n FALSE;

AfxEnableConttolConta:

Sam. ?"'-

".-

[cHTMLApp WCCodeCa
lss

U U (I -i

Description

(Name)

CHTMLApp

Comment

CHTMLApp; DSee

E* Properties | Q i
Ln 49

Col 25

Ch 22

. 2.45.

2. Visual C++

657

soft Visual C++ [ctesian] Edti ,tfew Proe


j ct guild Qebug Toosl Wnidow Hep
l
.. HTML cpp j

j*; CHTMLApp

i ^fnitlnstance

~3

J CNIdFrm Lfp
J HTM., cpp
J HTML (c
J HTMLDcc rpp
JHTMLVewcpp
J MainFrm cpo
makehtmlhelp bat
i.pc

SetRegiscryKey (_T( "Local AppUizatd-ijenent-ed Applications"} )


F
]
-L e? -> 4
it i L > i-L
CHulciDocTeMplace* pDocTemplate;
pDocTempiate
,te -- new
new CMultiDocTemplace(IDR_HTHLTYPE,
CMultiDocTemplace(IDR_HTHLTYPE,
RUNTIME^
:E_CLAS3(CHTHLDOC),
RUNTIME_>
iE_CLASS(CChildFran>c) , / / c-ufitc-! EDI c h i l d i:t.-s;cie
RUNTIK_CLA33(CHTMLView));
AddDocTemplate(pDocTemplate);
' c'lrsate inain KDI Frame nr.cbi?
CMainFrame* pMaanFuame = new CMainFcame;
i ( ' p H a i n F r a m e - > L o a d ^ c a m e ( I D R MAINFRAME))

[CHTMLApp VCCodeClass

~3

IOQL CMOIfraineWnd::LoadFrame(UlNT,DWORD,CWni< *,C


(Name)
Comment

CHTMLApp
CHTMLApp: DSee

& Properties | Q
77

26

Ch23


::

: INS

. 2.46.

View
View (), . 2.47, ,
,
.

View / Open

>

,
Solution Explorer ( ) Class View
( ).

View I Open With


,
. , .
, .
Open With (
), . 2.14.

View | Solution Explorer


Solution Explorer - HTML ( ),
. , ,
, . 2.48 .

658

IV.

File Edit VSPW Frnjsct: guild Debug Tools


j tut un Exglorer Ctrl+wlt+L
rl^ss View
Ctrl+5hitt+'"
%J
II,
^erver Explorer
Ctrl+Alt+b
Resource View Ctrl+ShtfU-E
FropfrtiesViindow
F4
1.

^ Debug

- . gk

OnErLhc^d'l-d

"^Soiutcn

Ctrl+Alt+X

wctF-ead (1 pr ie b

_*_

^ ) MamFrm rpp

View, CEditView)

W^b Browser

B)

O t h w Windows
Shew Tasks

Full 4re>n

fhifH-A^+Enter

eu, CEditVieu)
, CEditView:lOnFilePrintt
DIRECT, CEditView::OnFilePr
PPEVIEU, CEii cVieij. OnFil^F
bErrflHECTION,

CnCounei-1-

"hft+F4

_J Hft^der

Prc per ties


WebRead
1

(Name)
9X
J

4
!
FindPesub 1

1-* 51Frnd Results 1 |

VCPrrp t

(Name)
Mamecf the project

l^Pruporf

. 2.47. View

T3
5 Solution'HTML'(1 project)

5outce
*]
J

Files

ChildFrm.cpp
HTML

epp

HTML.re

HTMLView.cpp

_ ^ ] MdinFrm.cpp

_J

malahtrrilhelp.b,

^2

stdafx.cpp

_ J H e a d e r Files
_ ]

ChildFrm.h

_ ]

HTML h

_J

HTrlDoc.h

_J HTML .h
J MamFrm.h
_ J Resource.h
_J stdarx.h
+ _ J Resource Files
- _ J HTML Help Files
_] HTML hhc
_J HTML hhk
J HTML hhp
- _J HTML Help Topics
__J ahxcore.htm

. 2.48. Solution Explorer - HTML

File.

] r a

Prop t spender

J
2] 1 'i i
"Ready

* A'ebFcad epp
_^] WebReadDoc Lf p

"-bF^ad

2. Visual C++

659

View | Class View


Class View - HTML ( ),
. , , , . 2.49 .

^ Go
l b 1 Functions and Variables

- *> variables

^ indicators
4 theApp
t THIS_FILE
4 THIS_FILE
THI5_FILE
f THIS_FILE
4 THIS_FILE
- b u o s and Constants
-

^ Classes
J
% CAboutDIg
+ "% Bases and Interfaces
+ ^ Available Overrides
+ = Haps
+ ^r 1 Enums
+ Functions
CChildFrame
* CHTMLApp
CHTMLDoc
. o* CHTIILView
**^ Bases and Interfaces
+ Available Overrides
= Maps
-

,. |

. 2.49. Class View - HTML

View\ Server Explorer


Server Explorer ( ),
. 2.50.
.

View \ Resource View


Resource View - WebRead ( ), . , , , . 2.51 .

View \ Properties Window


Properties (),
. -

IV.

660

. , , ,
. 2.52 .
.. WebRead - Microsoft Visual C++ [design]-WcMt
gfoe
j ct gud
li Bebug lools Wnidow Hep
l
71

4 X

Class View WebRead

d
i Ve
i wxpp [

*% " I
- JlWebRead
Global Functions and Variables
Macros and Constants
* * CAboutDlg
J CMainFrame
> CUPLDlg
CWebPeadApp
CWebReadDoc
\ CWebF eadView

5ervers
JJ
j myo-li>w
: 3Qznww
f
jp Crystal Servcies:

J
|| Event Logs
SUfi Message Queues E(CWebReadView, CEditView)
/J Performance Cour
^ Services
. CTJebReadView, CEditVieu)
n i g t;i:iftEi.rtd..4
J SQL Servers
:
FILE_PRINT, CEditView: : O n F l l e P r m t )
FILE__PRINT_DIRECT, CEditView::OnFllePrint)
FILEJ?RINT__PREVIEH, CEditView: :OnFilePrintPre\
CONMECT_HAKECONNECTION, OnConnectHakeconnectic

Class

|5F

. 2.50. Server Explorer

| IDD_ABOUTBOX (Dialog) IDIgEdil-or


h

::

--
- I WebRead.rc
+ j Accee
l rator
- I Da
io
lg
3]D
ID_ABOUTBOX [Engsilh (U.S.)]
IDD.URLDLG
+ ^ J Icon
- _ J Menu
S j IDR_MAINFRAME [English (U.S.)]
* L j RT_MANIFEST
+ _J Sttmg Table
+
j Toolbar
t
I Version

~/

LayoutRTL

False

Lel-tScrollbar
MaximlseBox

False

MinirnizeBox

False

OverlappedWindow

False

PaletteWindow

False

StaticEdge

False

False
| Popup

SystemMenu

True

ThreeDLock

False

TitleBar

True

ToolWindow

False

Style

. 2.51. Resource View - WebRead

. 2.52. Properties

2. Visual C++

661

View\ Toolbox
Toolbox (),
. 2.53.
. ,
.
. WebRead - Microsoft Visual C++
Fjle Edit Ve
iw Eroe
i ct Bud
li Debug F-jmat Iools

Window

, Debug

OnEnClictodStart
Resource View - WebRead

i WebRead.rc (ID...LDLG - Dialog) I 1

ji

^ Pointer

Q Button

Combo Box

j Acceleiator

_ J Icon

List Box

_ J dialog
3 ] I0D_A60UTBC [Er
3 ] IDD_URLDLG

| ab! Edit Control

>

IS? Check Box

- 5 P WebRead
- _ J WebRead re

Dialog Editor

] Menu

S| IDR_MAINFRAME [E

f " l Group Box

J RT_MANIFE5T

<? Radio Button


An Static Text

Picture Control

BE Horizontal Scroll Bar

' Properties

[TDOURLDLG (Dialog)

Vertical scrol Bar

[jT] *i [] / r j

O-v Slider Control


#

FDIgEditor _

Spin Control
L

Progress Control
Hot Key

' f

2 U* Control
Tree Control

_;

X
Center Mouse

False

Context Help

False

Tab Control
(Name)

Q Animation Control
2 Rich Edit 2.0 Control
General
Ready

"

_
"

. 2.53. Toolbox

View | Web Browser


Web-.
Visual Studio.NET.

View | Other Windows


, . 2.54.
. , , .

IV.

662
F> Edrt Ve
iw Prue
j ct gud
li Debu Toosl

Wir-idow

J&j

Help

OnRnClrckedStart

^ Debug

Open V ith

f
2

Soluticn Explorer

Cla

Server Explorer

Itrl+Alt+S

Resource View

Ctrl+Shft+E

i i 1^'
^

Ctrl+Shft+C

*lj

"

'----

Ctfl+Alt+i

View

Properties Window
Toolboj.

F4

View,

CEditView)

Qrl+Alt+X

ew,

CEdicView)

WebBrowser

Other Windows

Show Tasks

Toolbars

j l l ^ Full Screen

Macr-o Explorer

Ctr!+Alt+J

LT] Document Outline

Ctrl+Alt+T

Ctrl+

_
Fn
i d Res

~\ Task List

Ctrl+Alt+A

Ctrl+Alt+O

Output

irrt)
rintPrev
onneccic

n i-

>~ri'

**

3 ^ J ff^Reso . f
4VCCocteChji

_^_
CWebPeadVrew

(Name)

9 X
J

Ctrl+Alt+F12
Ctrl+Alt+F

(Name)

|
qftFmdResults l|

Ready

Pr oper ties

Firid Results

LTj Favorites

- !

j CWebReadView

T^Si Find Results ;

^3. Find 51 Results

JLJ

Ctrl+Alt+K

" ] Command Window

Alt+F8

""jji Object grosser

Shrt+Alt+Enter

"* Navtgatp Bad-waid

^ f';' J>

Resource View - WebRead


* X
- ^ 3 WebRead

j WebRead re
+ _ J Accelerator
j Diabg
3 j IDD_ABOUTBOX [Er
^ ItP_URLDLG
+ _ J Icon
j Menu
Sj IDP_MAINFRAME[E_
+
_ J RT_MANIFE5T
+ _ J String Table

Sets/returns the name of trre ODject

& Propeities |

: Ln25

Col 56

Ch 53

1 j
INS

. 2.54. Other Windows

View \ Show Tasks


, . 2.55.
, Task List
( ), , .

View\ Toolbars
, , . 2.56.
, , , .

View\ Full Screen


, , Windows, , . 2.57.
Full Screen ( ), Full Screen (
),
.

2. Visual C++

663
_ jflj

v WebRead - Microsoft Visual C+


Fie
J &j

View ; Project Build


Open
_)
OpeQWith...
If l j
Solution Evpjoret
_, Class View
'3 Servei Explorer
iw
'4 Resource Ve
Edit

ebug

Tools

Properties Wn
i dow
Toobo>.

BI

Ctri+Alt+L
Ctrl4-5hift+^

Wn
idow H?k>
&^ D^bog
i
^ [ 4
_J I

i^$ OnBnCkkedStait
<
*

^
I
^J
-H
*

Ctrl+Alt+S
Ctrl+Shift+E

Ctrl+Alt+X

Web Browser
Other Windows
Show Tas&
1
Tootoars

j o Fuji Screen Shift+Alt+Enter


Ctrl+
z Navigate Backward

ew, CEditView)

, CEditVieM;:OnFilePi:int)
Prevo
i us Ve
iw
All

11.1
Hakeconnectic

S V I .
1

-|^ ^

^ - , .

, . |

Properties

* ><

| CWebReadView VCCodeClass

JLl

Comment
[^] Build fcrrors
User
Sho-tcut
Current File
theLked
Uncheded

findResj
L

**
S X_

_ ^ g WebRead
*
- _ J WebRead re
_ J Accelerator
- _ J Dialog
IDD_S6OUTBOX [Er
^ IDD_URLDLG
+
| Icon
- _JMenu
IDR_MBINFRftME [ E _
_| RT.MANIFEST

View, CEditVieu)

Ft

"^ g? *

Resource View-WebRead

'

(Name)

21 i i i I > 3 1 Find Results 1 [


Ready

(Name)
i Sets/returns the name of the object

E g Properties |
Ln25

CWebReadView

jH

Col 56

I T H. Ir

Ch53

INS

. 2.55. Show Tasks


^ ^ ^ - WebRead ~ H

crosoFt V.suolC + [(ii?sigi>]-W

View j Project Build


_" Cpen

Fie E_rjt

Open With
3 Solution Expjorer
Cla^i Ve
iw
"ii Server Explorer

Bebug

Build
Crystal Reports - Insert

Tools

Crystal
i
D
ata DR
eseg
ipnorts - Man
Database Da
igram
Debug
Debug Location
Desg
in
Dialog Editor
Dfi-Merge Ve
i wer
Formating

Ctrl+Alt+l
Ctri+5Nft+C
Ctrl+Alt+S

Ctrl+Shift+E
Rnsoorce V
Prrc>w ties Window
F1

Bl
1
!

Er
'.1
J i 1
Find Res

Toolbo.

Ctrl+Alt+X

Web '

>

Fullscreen

Other Windows

>

HTML Editor

Show Tasks

>

ImageEditor
Layout

Toolbars
Fuji Screen

Shift+Alt+Enter

Navigate Backward

I
J
!.
'

y } i Orfindictedaart
J

3 1 *

"

+ _J Icon
-

1 Menu
3 IDR.MAINFRAME [ E _
* _ l RT.MANIFEST
at)
HePrint)

+ i Sti_ing Tabe
l,

J1

irilCrLlIlLfLCV
tifakeconneccic

. JJ._

1 .

^ J , ( fl

JJ ,J

J J R6S0 . |

Properties

* X

[CWebReadView VCCodeClass

Query

Ctrl+-

x Resource View - WebRead


4 X
^-1
- J j WebRead
_^
^
- _ J WebRead.rc
"H
+ . J Accelerator
'
- _J Dialog
IDD.ABOUTBOXtEr

"

Source Control
0

Standard

(Name)

CWebReadView

Style Sheet
Table
Text Editor
View

(Name)
1 Sets/returns the name of the object

Web
XML Data

Ready

J-i
Eg Properties | ' n i . 1,

1 5 Find Results 1 |
:

; Ln25

Col56

. 2 . 5 6 . Toolbars
22

. 629

Ch53

ijINS

IV.

664

r.-i

View

Project

&M

febug

loots

Hi <4, c- WebBeadVlewcpp I

Khdoa
j

UebReadView,

|*t>

CEditView

HAP (CUebReadView, CEditViev)


C*J_COHKAND(ID_FILE_PRIKT, CEclitView: : O n F i l e P r i n t )
OK_COKMAND(ID_FILE_PRINT_DIRECT/ C E d i c V i e u : : O n F i l e P r i n t )
ON_COHHAND(ID_FILE_PRINT_PREVIEM, C E d i t V i e v : : O n r i l e P t i n t P r e v i e
a*_COHHAND(ID_C0WNECT_HAKECWOTECTIOW, OnConneccRakecormection)
END_HESSAGE_HAP()
r. i c; n
CWebReadView::CWebReadView()
^ode her*!

BOOL CMebReadViev: -.PreCreaceTJindow (CREATESTRUCTs )

. 2.57.

View \ Navigate Backward


Standard
(), ,
.

View \ Navigate Forward


Navigate Backward
( ).

View | Property Pages


WebRead Property Pages
( ), . 2.58.
. , Solution Explorer ( ) Class
View ( ).

Project
Project (), . 2.59, , .

2. Visual C++
I WebRead Property Pages

665
J<j

PL:;
_^J Platform: |Active(Wm32)

_ j Configuration Properties
v General
Debugging
_J C/C++
_J Linker
| Resources
_JMIDL
I Browse Information
CJ Build Events
f_j Custom Build Step
j Web References
_j Web Deployment

JJ

' Configuration Manager...

| Debug
Debug
".obj;*.ilk;*.pdb;*.tlb;*.tli;*

Intermediate Directory
Extensions to Delete on Clean
Configuration Type
Build Browser Information
Use of MFC
Use of ATL
Minimize CRT Use in ATL
Character Set
Use Managed Extensions
Whole Program Optimization

Application (.exe)
No
Use MFC in a Shared DLL
Not Using ATL
No
Use Multi-Byte Character Set
No
No

Output Directory
Specifies a relative path to the output file directory, can include environment
variables.
OK

Cancel

Help

. 2.58. WebRead Property Pages


.. HTMl - Microsoft VisualO
Fie Edit yjew : Eroiea | uld
i

Bebug

(5? i '{ Add Class...


~. ^
^ ^ Resource .,,
hlMl.ihp M: *
~
~~"~" j AddNewItem...

Jods

T l T

< *j

i r>bug
~"
Ctrl+5Nft+A

_.:; Add Easting Item

H'ndow

SI- ft+Alt+A
:

SReJ

UnloadPralKt

-, , n P r c e d

LoadSt^

Add WebRefermcf

5.ta a ,tu p F ,ora

CBultij|a properties
pDocTeiipraoc

New Folder

"1%

AssertValid

"

\i

<

Global Functions and Variab


- VariaHes
V indicators
_
' V theApp
^ THI5_FIIE
t TH15_F1LE
f THI3_FILE
THI5_FILE
* THIS_FILE

'

'n

ne-^nuixi-iis-re,i,jrin:ce(ir

RUWTIE_CLAS3(CHTHLBoo) ,
RJTIME_CLAS3 (CChildFremie) , / : cu:^tatr
RUNTIHE_CLAS5(CHTHLVie) ) ;
AcUiDocTemplate (pDocTemplata) ;
;
:

[i

(vr??.>:e main V' I F'i:^^ onndc.-T


CHamFcame* pHainFraine = new CHainFcartie;
If (!pHainFrame->LoadFrame(IDR_HAINFRAME))

fHTML VCProiect
(

^i

: : 44

cS1

El

J <-,
Jtj ; (Name)
HTML
Project Depend

Project Dependencies
Build dependence
i s on other projects.
* Properties | I

Ul 90

. 2.59. Project

Col I I

Ch 8

IV.

666

Project / Add Class


Add Class - HTML
( ), . 2.60.
.
Open () MFC Class Wizard (
MFC), , (
CDialog ).

Add Class-HTML

II

Templates:

Categories:

Snapln

Consumer

P r o v i d e r

ATL
Po
rpeytr
Page
-

A T L

Transacti...

S i m p l e

G e n e r i c

C l a s s

O b j e c t

- -

A d d

a n

C l a s s

i i i w

C l a s s

c l a s s .

Open

Cancel

Help

. 2.60. Add Class - HTML

Project / Add Function


, Class View ( ) . Add Member Function
Wizard - HTML ( -), . 2.61.

, , , .

Project / Add Variable


, Class View ( )
. Add Member Variable Wizard HTML ( ), . 2.62.
, , , , .

2. Visual C++

667

Add Member Function Wizard - HTML


Welcome to the Add Member Function Wizard
This wizard adds a member function to your class.

Return type:

Function name:

Parameter type:

Parameter name;

Parameter list:

Add

Access:
(public"

Implementation file:

~3

Comment (// notation not required):

Static ~ Virtual Pure

Jhtml.cpp

mime

Finish

Cancel

Help

. 2 . 6 1 . Add Member Function Wizard - HTML


Add Member Variable Wizard - WebRead
Welcome to the Add Member Variable Wizard
This wizard adds a member variable to your class, struct, or union,

Access:

Variable type:
(booi

" Control variable

Variable name:

Comment (// notation not required):

"J
Fn
is
ih

Cancel

Hep
l

. 2.62. Add Member Variable Wizard - WebRead

IV.

668

Project / Add Resource


Add Resource
( ), . 2.63.
, , .
lAdd Resource*
Resource type
I
m

New
Import...
Qjstom...

Cancel

, ,

. 2.63. Add Resource

Project / Add New Item


Add New Item - WebRead
( ), . 2.64. .
*i

Add New Item - WebRead


Categories:

Templates:
C++ File
Dynamc
i HTML Page
h
(.cpp) Discovery.,. (.htm)

1*1
Static
Discovery.

Header File
(,h)

ASP Page
(,asp)

m
M
di Fe
li (.d
i)W
l(R
e
s
o
u
c
r
e
li SRFFe
li(.srf)
re) Fe
Creates a C++ source file,

Name: <Entername>
o
lcao
tin:]e
D
\:ocumen
st andSe
nitgs\Adm
n
sira
to
tr\MyDocumenst\V
su
ialSu
td
oi Browse.
Qpen

Cancel

Hep
l

. 2.64. Add New Item - WebRead

2. Visual C++

669

Project / Add Existing Item


Add Existing Item HTML ( ), . 2.65.
xj

Add Existing en
Lookjn:
_j HTML
j
;

^Jlj
History

;
.4,

_U
I My Projects

: Desktop
I
!
*; 1
[ _LJ
i Favorites

* 1 Debug
Zjres
ei] ChildFrm.cpp
_h] ChildFrm.h
j] HTHL.cpp
^VH
j TML.h
9HTML.rc
^3 HTMLDoccpp
Ji]HTMLDoc.h
if| HTMLVe
i w.cpp
JVJ HTMLVe
i w.h
ci] Man
i Frm.cpp
IV] Man
i Frm.h
cl] MyCa
l ss.cpp

D Q X

CJ

13 ' ols-

itVJ MyClass.h
[h] Resource.h
iCf] Sourcel.cpp
jCi] stdafx.cpp
[h] stdafx.h

Hie name: ||
Files of type: |vi5u<il C++ Files

zj
J

Open !'|
Cancel j

. 2.65, Add Existing Item - HTML

, .
, . ,
, Visual Studio.NET.
,
,
, . Visual Studio.NET , .

Project / New Folder


Class View ( )
Solution Explorer ( ) . Solution Explorer
( ) (
, , . .), Class View
( ) (
).

Project / Unload Project


, Solution Explorer ( ) . .-

IV.

670

, , . ,
.

Reload Project ( ).

Project / Add Web Reference


Add Web Reference
( Web-), . 2.66.

Available references:

Web Service Directories:


5 Micro sort"
UDDI
Mc
i rosoft UDDIDirectory
Query the UDDIBusn
i ess Registry to find compane
is and production Web
Services.
Microsoft

mom
Te
stM
cirosotfUDDIDreico
try

Locae
t testW
e
bSec
rvieso
t usedunrigdeve
olpmen.t
W
e
bRee
fe
rncesonLocalW
e
bServer
He
pl
. 2.66. Add Web Reference

, . Web-,
, Available references
( ).

Project \ Set as StartUp Project


, Visual Studio.NET.

2. Visual C++

671

Project / Properties
View | Property Pages ( | ) , , WebRead
Property Pages ( ), . 2.58.
, Solution Explorer ( ) Class View ( ).

Build
Build (), . 2.67, , .
.. WebRead - Microsoft Visual C++ [design! - URUMnJl
ile Ed* tfew Proe
jct gud
li Qetug Iools dow 1
jp " _1 " iJ? L* P ^ BurfJ Qri+Shift+B | . ^ Debug
rS

,
.

URLDlg-hi
_ .

;
'V I
!
nptragma o n c e .

OnBnCc
ilkedSrat
i

Batch Build...

Solution V'ebRead' (1 ptnjert)

Configuf ation Manager...


Si

c l a s s CURLDlg

_*

_i Source Files
J MamFrm cpp
J ] itdafv cpp
_2 URLDIg cpp
^ ] WebRead.cpp
^ ] WebReadDoccpp
^ | WebReadView.cpp
_ J Headw Files
1 HamFrm.h

Link

I'iti rt!

tT

EeturfdAl
gean

piiblic CDialog

DECLARE_DYNAHIC (CURLD1CJ)
putoLic:
CURLDlgfCWnd* pPatenc = N U L L ) ;
victual - C U R L D l g O ;

~.

Properties
| WebRead VCProject

enuni {

IPD - IDD_UPLDLG } ;

,1

, I

0 3 * 1

J
.

(Name)
Web
Project Depende

(Name)
. Name of the project.

3
Ready

. 2.67. Build

Build / Build
,
. Build () , .

Build / Rebuild All



, .

IV.

672

, ,
. , Visual
Studio.NET (, ,
).

Build / Clean
, ,
. , ,
Rebuild () , .

Build / Batch Build


Batch Build ( ), . 2.68.
H P
| Batch Build
Checb the project configurations to build:
JFroject______ Configuration Platform 1 Solution Config
Win32
Debug
H
i TML
! Debug
Release
HTML
Release
Win32

Build

Bu
d
li
Rebu
d
li
Sean
SeelctAl
DeseelctAl

l
Cojse i Hep
. 2.68. Batch Build

(, ).
Build () Check the project configurations to build ( ).
Build (),
Rebuild (). .

2. Visual C++

673

Build / Configuration Manager


Configuration Manager (), . 2.69.
xJ

(Configuration Manager
Active Solution Configuration;
Project Contexts (check the project configurations to build or deploy):
I Configuration j Platform
Build
HTML

Debug

_LJ

Deploy

win32

Close

Help

. 2.69. Configuration Manager


, .

Build / Compile
,
. .

Build / Deploy
.
, .

Debug
Debug (), . 2.70, , .

Debug \ Windows
, . 2.71. .

IV.

674
.. WebRead - Microsoft Visual + [iteston] - IKJOI^Jt
Fie

Edit

View

P'Oiect

!"< i Bebug j loote

ygndou

OnBnCklrkedStart
4)

I .Ll,...

"j * Start Wttmut Debugging Ctrl+F5

d^

_J Exceptions..,
. 'Z 5*epLnto
U Step Over
class CURLDlg : p ^ New&eat;point

J Sou
l to
i n *WebRead'(1 protect) ^_
_i Source Files
^J ManiFrm.cpp
jji) stdaf^.cpp
J$
I .tpp
: URLDg
\ WebReadc.pp
j|| WebReadCocc.pp
]?\ WebReadVeiwc.pp
j j Header File!
1 MamFrr,h
i

Ctrl+Alt+E
Fll
F10
+

DECLARE DYNAH
public:
Ct!RLDlg(CUnd* p P a r e n t = NULL),
v i r t u a l -CURLDlgO;

Properte
is
I WebRead VCProe
jct

IBD - IDI>_URLOLG );

I
,
(Name)
. Name of the project.

I.?5l"l.i ] :* 5i Fn
i d Results! |
. 2.70. Debug
.. WebRead - Microsoft Visual H- [dttignl URIDIaJ)
Ffc

Edit

View

Project

QuU fi<*

'

URLDlg.h

3? i ? *
cr

Window

'

art W tr-out Debugging

J Processes...
EA.pptions...
_
c

rep Into

=;^ Over
c l a s s CURLDlg

belp

Starr

'

9 once

lool

>

" Widows

j-teHtf

-q

.***...

F5
Ctfl+F5
Ctrl+Alt+E

Fli
F10
Ctrl+6

DECLARE DYNAH
-

_J Source Files
_^] MainFrm.cpp
_J stdafx.cpp
J ] URLDlg cpp
J WebPead cpp
J WebPeadDoc cpp
J WebPeadView cpp
_J Header Ftes
1 ManFrm h

CURLDlg(CHnd* p P a r e n t - NULL);
v i r t u a l ~CURLDlg();

- t IDD - ID URLDLG I ;

(Name)
V
Project Depende

(Name)
Name of the pt oject
i- !' q% Find Results 1 j

. 2 . 7 1 . Windows

2. Visual C++

675

,
.

Debug / Start
. Continue (), ^
,
.

Debug / Break All


. ,
.

Debug \ Stop Debugging


. .

Debug / Detach All


. , .
.

Debug / Restart
. . .

Debug \ Apply Code Changes


, , - .
, ,
, .

Debug / Processes
Processes (), . 2.72.
, ( ).

IV.

676

Close

Transport: Default
| ...1 Properties.,,

Machine: j HOME-D55AFM3AK9
Available Processes

Type I 5, 1 Debugger

Title

Attach...
Refresh

internat.exe
mspaint.exe
sqlmangr.exe
WINWORD.EXE

1012
1072 unfitted - Paint
980
1180 Microsoft Word - VCA4_

Win32
Win32
Win32
Win32

0
0
0
0

I " Show system processes


" Show processes tn all sessioQS
Debugged Processes
Process

Id

HTML.exe

968

| Title
HTML

| Machine
HOME-DS5AF...

| Port
Default

When debugging is stopped:

. 2.72. Processes

Debug I Exceptions
Exceptions
(), . 2.73.
, - ,
.

Debug / Step Into


. . , , , ( ).
, Debug | Step Over ( | ).
, ,
, .

Debug / Step Over


.

, .

2. Visual C++

677

Exceptions;
_com_error
i : ATL::CAtlException
: '- CException
: - std:: exception
;
void
G Common Language Runtime Exceptions
8 Native Run-Time Checks
:
0 Stack pointer corruption
1 Cast to smaller type causing loss of data
;
G 2 Stack memory corruption
:

3 Local variable used before initialization


ffi Win32 Exceptions

End...

Clear All

Add...

I When the exception is thrown:


!

Break into the debugger


< centhue

<

i.

I f t h e e x c e p t i o n is n o t h a n d l e d :
(*

B{_eak i n t o t h e d e b u g g e r

<~ C o n t i n u e

- .. .,

. 2.73. Exceptions

Debug I Step Out


.
, .

Debug / QuickWatch
QuickWatch
( ), . 2.74.
,
Expression (). Add Watch
( ) Watch ().

Debug / New Breakpoint


New Breakpoint
( ), . 2.75.
,
,
.

IV.

678
: QuickWatch

Recalculate
Add Watch
Close
Help

Current value:

^ i

Name
j Value
; Type
H pDocTemplate Oxcccccccc {CMultiDocl CMultiDocTemplate *
~
-
-
-
1

CDocTemplal
m_hMenuSh<
m_hAccelTat
m_docList
m_nUntitled(

{CDocTemplate}
const CDocTemplate
CXX0017: Error: symbc H M E N U _ *
07; Error: symbc HACCEL_*
{cnt=???}
CPtrList
CXX0030: Error: expre: unsigned int

. 2.74. QuickWatch
I New Breakpoint
Function | File j Address j Data |
Break execution when the program reaches this location in a function.
Function: j pDocTemplate
Line:

[T

Language:

C++

Character: 1

Condition,,,

(no condition)

Hit Count... 1 break always

OK

Cancel

Help

. 2.75. New Breakpoint

2. Visual C++

679

Debug / Clear All Breakpoints


.

Debug / Disable Breakpoint


.
Enable Breakpoint (
), . , .

Debug / Save Dump As


Save Dump As
( ), . 2.76.

Save Dump As
Save jn:

xj
Q j WebRead

tn

., - Tools-

_J Debug
res

History

My Projects

Desktop

Favorites

j Myy Network
Places

Save as type: JMinidump

Save

Cancel

I
'-

. 2.76. Save Dump As

,
.

Tools
Tools (), . 2.77,
Visual Studio.NET .

IV.

680
., WebRr.id - Microsoft Visual C + + [doslgn] - URLnbl.tpp
ls I Wn
i dow Help
File E* Mew Proe
j ct BuM Eebu
J _J ' - ',
% URLDIg.cpp |
? pJCUPLDIq ~

< ",
"

CURLDi
CURLDlg::CURLDlg(CMnd* j
: CBialog'CURLDlg: :|
, mJJRL(_T("") ) !
<
f
}
Ij
C U R L D l g : : - C l l R L D l g ()
1

void CURLDlg::DaDacaExcj
CDlftlog: : DoDar.aExch
DIiX Text fDDX. IDC U

Output
[Debug

Debug Processes,.. Ctrl+Alt+P


Connect to database.
Connect to Server...
Customize Toobox...
^dd-tn Manager...
guild Comment Web Pages...
Macros
ActiveX Control Test Container
Create GUID
Error Lookup
MFC/ATL Trace Tool
OLE/COM Object Viewer
Spy+
Create GUID
Spy+
External Tools...
Customize.,.
Options..,

Solution Explorer WebRead _

31

_3 stdafx cpp
J URLDIg.cpp
_J] WebRead.cpp
J$ WebReadDoc.cpp
_^3 WebReadVjew.cpp
_ j Hoader Ftes
J Pesource.h
^ J stdafx ,h
j URIDIg h
1 WebRead h
Properties

jCURLDIg VCCodsClass

ion** s ^ ^ *
I
(Name)

CURLD^j

(Name)
I Sets^returns the name of the object.

. 2.77. Tools

Tools / Debug Processes


Debug |
Processes ( | ).

Tools / Connect to Database


SQL . Server Explorer (
) Data Link Properties ( ),
. 2.78.

Tools / Connect to Server


, , , HTTP IP.
Server Explorer ( )
Add Server ( ), . 2.79.

Tools \ Customize Toolbox


Toolbox ().
Customize Toolbox ( ), . 2.80.

2. Visual C++

681

Data Link Properties

' JSl

Provider Connection Advanced All


Specify the following to connect to SQL Server data:
1. Select or enter a server name:
V| Refresh

2. Enter information to log on to the server:


<"" Use Windows NT Integrated security
(* Use a specific use< name end password:
User name: j
Password: |
" Blank password

" Allow saving password

3. (* Select the database on the server:

'

"

~~

1 Attach a database file as a database name:

OK

Cancel

Help

. 2.78. Data Link Properties

Ldd Server
.^^^
To connect to a new server, enter the computer nam
oe
r;IP
address below:
Computer: j
' Exampe
l : servername
Connect usn
i a a different user name.
OK J

Cancel 1

. 2.79. Add Server

. 2.80 COM Controls Toolbox () .

Tools / Add-in Manager


Visual
Studio.NET . Add-in Manager ( ), . 2.81.

IV.

682
Customize Toolbox
COM Controls | Modeling Shapes j General Shapes | .NET Framework Components |

Library

j Path

Name

ActiveMovieControl Object
ActiveXPlugin Object
- ActorBvr Class
adbanner Class
Application Data Control
Apps Control
AxViewCompanion Class
ColorBvr Class
COM+ class: Microsoft.VSDesigner.. .
<l

E: \WIN_2000\Systern32\rnsdxm. ocx
E: \WIN_2000\System32\pkigin .ocx
E: \WIN_2000\Sy 5tem32\LMRT. dll
E:\WIN_2000\System32\msdxrri.ocx
E: \WIN_2u0u\System32\appwe. cpl
E:\WIN_2000\System32\inetsrv\cnfg...
D:\Visual Studio.NET\Comrnon?\Tool5..,
E:\WlN_200u\Systern32\LMRT.dll
E:\WIN_2000\System32\mscoree.dll

"

If-J

Microsoft Active...
Microsoft Active.,.

shappmgr 1.0 T...


cnfgprtsOLECo...
Rational RosePa...

11

ActionBvr Class
e

Language:

Unknown

Version:

1.277

Browse..,

Reset

Help

. 2.8. Customize Toolbox


I Add in Manager
Available Add-ins

Startup Command Line

Description:

OK

Cancel
J _ J ! * J

. 2 . 8 1 . Add-in Manager

,

. , ,
, .

2. Visual C++

683

Tools / Build Comment Web Pages


Build Comment Web
Pages ( Web-), . 2.82.
.:.
f* Build for entire Solution
* Build for selected Projects:

Save Web Pages in:


E:\Docurnents and Settings\Nick\My Dot

Browse,..

~ Add to Favorites

Cancel

Help

. 2.82.. Build Comment Web Pages

Fils dit Ve
i w Project Build Debug Toosl Wn
idow HeP
'
i
Debug
l-s and betmgs\Nick\My Oocum
C5

octe Comment \ Report


iolution
Project

'HTML' (1 project)
HTML
3 Source Ffes
J Childf rm cpp
J HTML.cpp
J HTML.rr
J HTMLDoc cpp
J HTMLView cpp
J MainFrm cpp
_ J natehtmlielp bat

C A b o u t D I g

- Global
THIS_FILE
CAboutOlg
THIS.FILE
thpAPF
HI J LE
HI FILE
r r
HI F LE

Access: Default
Base Classes:
CDialog

CAbdutDIg
IDD

4t

:HTMLDI

CH1ML v
1

I CHTMLApp VCCodeCa
lsb
:: ti ? -s

j tName)
CHTMLApp
Comment CHTMLApp DSe-

j Debug
Unloaded'E:\WIN_20O0isysfem32\rpcrt4.dll1
unloaded 'EAWIN 2000\sy5tem32\ote32.dll1

. 2.83.

IV.

684

HTML, .
. 2.83.

Tools / Macros
. , . 2.84.

Vvw Prov t Bud


li
,

| -

nils W
. nidow fcWP

L I &$

"%

URLDIg h j

|v#( upinij

"

u] l i r
!

t e b q

Erocesses

C o m e c t t0

Qrl+Alt+P

Catata-e

I <"onnect to Server
<*(jitLmize Toolbox

t:URLDlg(CHnd pPare;
';

' Global Functions and Variables


Macros and Constants
J CAboutDIg

^dd-inManaget
Euiid Comment Web Pages

Macros

Run TemporatyHacro

Cbl+Shft+P

ActiveX Control Test Container

Record Temporary Macro

Qrl+Shft+R

Create GUID

Save TemporaryMacro

!API
iDo'
L.

Error Lookup
DECLiRE_HESSAGE_HAP;
C S t x i n g m^UPL;

MFC/ATL Trace Tool

Macro Explorer

OLE/COM Object Viewer

Macrgs J_DE...

Spy+

Load Macro Project...

Create UID

txctemalTools...
Output

Customize,..

{{Debug
aded 'B:\WIH!

Qpttons...

fl: JTIO message t i n e prosipt- for ID .


^i Name of the project

D Output | 5 1

. 2.84. Macros

,
,
VBScript.

Tools \ ActiveX Control Test Container


ActiveX Control Test Container
( ActiveX),
-, Visual Studio.NET.
. 2.85.

Tools / Create GUID


guidgen, . 2.86.

2. Visual C++

685

; j ActiveX Control Test Container - UolMea


File Edit Container Control Ve
i w Options Tools Help
D fi? H

*&'

f 3 . ' ! U , *?

R m

Macro.]

. 2.85. ActiveX Control Test Container


Create GUID

Choose the desired format below, then select "Copy" to


Copy
copy the results to the clipboard [the results can then be
pasted into your source code). Choose "Exit" when New GUID
done.
z.
Exit

GUID Format
i f I IMPLEMENT_OLECREATE(...)

3. static const struct GUID -{...}

C' 4. Registry Format [ie. {-... xxxx})


Result

"

---;

// {3E06Ca49-5484-4f6b-BA7C-BE8ABA48566D}
j
DEFINE 6UID(name,
i
0x3e06c2a9,0x5484,0x4feb. Oxba, 0x7c, Oxbe, 0x8a. Oxba. 0x48,0x56, i
0x6d).

. 2.86. guidgen

- , .

IV.

686

Tools / Error Lookup


Error Lookup
( ), . 2.87.
| Error Lookt^it"
Value: jl
Eitor Message

. 2.87. Error Lookup

, , Value
().

Tools \ MFC/ATL Trace Tool


MFC/ATL Trace Tool,
. 2.88.
l&ATl/WC Trace Tool
Trace List

. Process
| Trace level
! 9 Enabled
Category Si Function Narmes
File Name & Line No.

. 2.88. ATL/MFC Trace Tool

2. Visual C++

687

Tools / OLE/COM Object Viewer


OLE/COM Object Viewer,
. 2.89.
lDl.X.1

OLE/COM abject Viewer


File

O_bject

View

Help

No . CryslalDecisions.Shaied.TotallerNodelD
*""""' {DDE05402-90B5-3CB6-A5D5-E8FCA55EA56D)
!p- Cr ,stalDecisions.V55hell
(Ifqp
qp
(jp(P"
(Jh.

Registry

Cr(stalDeasions.VSShell.CMirrosoft.CLRAdmin.CAboi
Microsoft,CLRAdmin.CCom
Microsoft.CLRAdmin.CDatc
Murosoft.CLRAdmin.CWEc
Microsoft.CLRAdmin.MMC.
Microsoft.CLRAdmin.MMC.
I1lrrosoft.CLRAdmin.MMCr-

Implementation I Activation I Launch Permissions j

CLSID =
{DDE054D2-9065-3CB6-A5D5-E8FCA556A56D}- = CrystalDecisions.Si
Implemented Categories
462C8FE6S-4EBB-45E7-B440-6E39B2CDBF29} =
InprocServer32 [<no name>] = mscoree.dll
InprocServer32 [ThreadingModel] = Both
: InprocServer32 [Class] = CrystalDecisions.Shared,TotallerNodeIC
InprocServer32 [Assembly] = CrystalDecisions.Sharedj Version=*
! InprocServer32 [RuntimeVersion] = v l ,0.2901
Progld = CrystalDecisions.Shared.TotallerNodelD
CrystalDecisions. Shared. TotallerNodelD = CrystalDecisions. Shared. Totall
CLSID = -{DDE0S4D2-90B5-3CB6-ASD5-E8FCA556A56D}

(? llirrosoftJScript.COMHelc
I P r-licrosoft.JScript.COMMetl
^
MirrosoftJScript.COMProc
p - Microsoft.JScript.DebugCo
^ I VrosoftJScriptJSAuthor
p
riirrosoftJScript.Vsa.VsaE
^ Microsoft.VisualPasic.Upgr-

lJ

J j

Ready
. 2.89. OLE/COM Object Viewer

OLE .

Tools / Spy++
Spy++, . 2.90.
.

Tools / External Tools


External Tools
( ), . 2.91.
Tools
() ,
.
Menu Contents ( ).

Microsoft. .

IV.

688

; Microsoft Spy++ Windows 1


Spy Tree Search View Messages Window Help

n|%|ol rs %\ ;-| -| I Ml I
0001000C "" 27 [Desktop)

"
"
~

000702C8 "" tooltips_class32


00020130 ""WotkerW
00030026 "" too!tips_class32
00040038 ""Shell_TtayWnd
0020040 "" tooltips_dass32
0009024A "" Iooltips_class32
00030028 "" tooltips_class32
00030148 "" WindowsFormsi O.tooltips_class32.app1
001802EA'"'tooltips_class32
000102F2 "Close" VBBubble
J

f"
For Help, press Fl
. 2 . 9 0 . Spy++

I External Tools
Menu Contents:

:'':':,

2U

Create &6UID
Error Loo&kup
MFC/ATL &Trace Tool
OLE/COM Object ^Viewer
Spy&++
Create &GUID
Spy&++

Add

Delete

Move Down I

j ActvieX Control Test Co&ntan


ier
| D;\Vs
iual Studo
i.NET\Cornmon7\Toosl\tstcor ^., |
I
jt(TatgetDir)

[Ide:
Command:
Arguments:
nitial directory;

" Prompt for arguments


OK

Cancel

'

!~
I

Help

. 2 . 9 1 . External Tools

2. Visual C++

689

Tools / Customize
Customize
(), . 2.92.

'Toolbars .j Commands | Options


Toolbars:
New...

Crystal Reports - Insert

* Crystal Reports - Main


" Data Design
" Database Diagram
" Debug
" Debug Location
" Design
" Dialog Editor
Diff-Merge Viewer
l ~ Formatting
Full Screen
HTML Editor
" Image Editor
Layout
!? MenuBar
" Query

Reset...

Keyboard... | [

Close

. 2.92. Customize

Visual Studio.NET. Toolbars ( ) . Commands ()


. Options () :
( ) ,
. Keyboard ()
Options (), .
, , , .

Tools \ Options
Options (),
. 2.93.
Visual Studio.NET.

IV.

690

C2l Environment
Documents
Dynamic Help
Fonts and Colors
Help
International Setting;
Keyboard
Projects and Solution'
Task List
Web Browser
i I Source Control
Cj Text Editor
Qj Database Tools
:"'! Debugging
C_J HTML Designer
;_3 Projects
<l

Settings
(* Tabbed documents
IDI environment

At startup.:
|Load last loaded solution

Reset Window Layout


f7 Show status bar
17 Animate environment tools
Speed
Jr +
p" Enable Command Window autocompletion
Display
Display

items in window menu


items in most recently used lists

Docked Tool Window Behavior - f/ Close button aFfects active tab only
" Auto Hide button affects active tab only

OK

Cancel

Help

. 2.93. Options

Window
Window (), . 2.94,
.

Window / New Window


, , , . (, :2). ,
, ,
:1. , , .

Window I Split
, , , . 2.95.
, ,
.

2. Visual C++

691

- Microsoft Visual C++1design! -HIMUi

He Edit V- [ el Jjd [.bug Tyo ird Hep


l
J] J _ i _
i ~ L< V ndo
HTML h

11 1 ic

l>wH t at Tab Group

d IX

f i" ^_crtiC9 Tab Group

4 > *.^ rjr

j j j CWdFrm.cpp
J HTML cpp
J HTML re
J ] HTMLDoc cpp
J2 HTMLView cpp
J MamfVm cpp
_ J makehtmlhelp.bat
J stdafx cpp
i Header Files

f i l e for PCH

Ciub.e AH Documents

CNIbFrm.h

0
2HTMl.Doc.cpp
3 HTML.cpp

;;,! thu in.plJ

class
(

CHTHLApp

public

"~\

'cHTMLApp VCCodeClass

CMinApp

(Name)
Comment

CHTMLApp () ;
w

CHTMLApp
CHTMLApp: DSee

JDebug
Unloaded
LnlD ^ d
d AW
i L

tL

>-

W e V dil

ES1 Properties J 0 (
Ln 1

Col 1

Ch 1

INS

. 2.94. Window
file'"j gdrt

View

oft Vlsgal C4+ [dedgn] - HTMLJi


project

guild

[.cbjg

Wndow

Help

J Cruldf rm
J3 HTML cpp
J3 tc

^ DOC cpp
J HTML View cpp
J J MainFrm cpp
_ J makehlrrJhelp bat
J stdafx cpp
i Header Files
J CMdFrm.h
_ J HTMLh

zl

#include "resource.h"

cpp

Vitndet FiXOH
IH .

C
iHTM
Alpp VCCodeC
asl
* r

Sercor include 'acdafx.h' before including this f i l e for PCH

.- Ai

p*f - y fjf 4

(Name)
Comment

:lui:le " . h"

CHTMLApp
CHTMLApp:

foebug
Unloaded'E:\WIN_2000\system32\ipcrt4.dr
Unloaded t:WIN 2000\system3^ole32.dir
3
Ready

'' i

El output | E

* Propetties | Q 1!: Ln 1

. 2.95.

Coll

Chi

___

692

IV.

, Window | Remove Split ( |


), Window | Split ( | ), .

Window I Dockable
Visual
Studio.NET, Workspace ( ), Output ( ), Watch
() .
( ), Visual Studio.NET.

Window / Hide
Visual
Studio.NET, Workspace ( ), Output ( ), Watch
() . , , ( ). View ,
.

Window / Floating
Visual
Studio.NET, Workspace ( ), Output ( ), Watch
() . , , ( ).
,
. ,
, .

Window I Auto Hide


Visual
Studio.NET, Workspace ( ), Output ( ), Watch
() . ,
, Visual Studio.NET,
, . 2.96.

( ).

Window \ Auto Hide All


Visual
Studio.NET, Workspace ( ), Output ( ), Watch
() . Visual Studio.NET, . 2.97.

2. Visual C++

693

f [design! 1 )
Fie

E*

View

Project

&jld

Debug

Tools

Wmi

Hefc
'

1*;

hTIIL.-i : main *!:

zl ! *

zl
-

I L I

Jpragn once
|

tfifndef

gendlf

___AFXIN_B
He ioc !

- JlHTML
+ Global Functions and Variables
+ Macios and Constants
- * J Classes
+ * CAboutDlg
CChildFrame
**CHTMLApp
CHTMLDoc
CHTMLView
CMainFrame

// CHTKLApp;

c l a s s CHTHLApp : p u b l i c CWinApp

i
1

public:
CHTHLApp();

I
i Untoaded'E:\WIN 2000\system32\rpcrt4,dir
Unloaded t \W1H ZOOO\system32\ole3Z *
it

g Output I
Ln t

Col 1

Ch 1

. 2.96.
File [dlt Ve
i w PrD|ect Buid Bebug Toosl *
L

DLJ

H fli L

HTMLh

z )

ppcagma once
nde
AFXKIN_H
Serroir include 'atdafx.b' before including this f i l e for PCH

include "resource . h"

/.''

man:

i."Mjjli'

CliTELAyp:
^ H'i'KL. c-pj. ot t h e ijt

c l a s s CHTHLApp : p u b l i c CUinApp
public:
CHTHLApp 0 ;

public:
v i r t u a l BOOL I n i c l n s t a n c e 0 ;
T

ti

* t *

M [ : -. HTML.h |

fI U

Ln 1

Col 1

. 2.97.

Ch 1

IV.

694

,
.

Window / New Horizontal Tab Group


Visual Studio.NET. , ,
, , . 2.98.

E.dii-

View

Project

Build

Qetwg

lools

Window

1
A S i e r t Valid

'"

HTMLDoc cpp |

>

i ^ i i i L l i

to

If

J.J

~*

j l . - i c T i i

,. >

i f

_ 2 C h M F r m cpp
M I

"HT'-Li

" H T H L . h "

HTML h

~ z l

__

cpp

_ J Header Fdes
J ChildFrm.h
J HTML.h

5J5obtl
ple(Lpn-i

HTML

J] HTML
^ 1 HTMLDoc cpp
J HTML<iew cpp
J MatriFrm upp
_J makthtmlhdp.bat

|^.li

-.

n e e

CHTMLApp VCCodeClass
f t i f i i d e f
S E L L o r

A F X U I N ^ H
i n c l u d e

' s c c t a f x . h

<

b e f o r e

i n c l u d i n g

t h i s

f i l e

f o r

PCH

, |

-j

, !* ? ^

(Name)
Comment

CHTMLApp
CHTMLApp C3See^__

C++

<

.) Task List |

Ready

.'} J1 **d ' iM .

* Propertcs | Q ' n r ^ h - l
';

- Ln 1

Coil "

Ch 1

INS

. 2.98.
. , , .
, .

Window / New Vertical Tab Group


Visual Studio.NET. , ,
,
, . 2.99.

2. Visual C++

695

.. HTML - Microsoft visual ++ [itesmnl HTMUI

1 x|

File Edti V^iw ^reject BuH


i Debug Xoosl Wnicfow Hep
l
L3 '

S d e f i n e new DEBUG_NEH
Sundef THIS_FILE
s t a t i c chat: THI3_fILE[]

J CMdFrm cpp
_] HTML cpp
J HTML re
J HTMLDoc cpp
_J HTMLView.cpp
J ManFrm.cpp
__] metehtmlbelp.bat
J stdafx.cpp
:^S Header Files
^ ChikiFrm.h
HTML.h
-

CHTHLApp;

class CHTHLApp : public CBini

zl.
J.-, ~-\
|Debug

! Unloaded "Ei\WIN 2000\sy5tem32\shlwapi.dll:


; Udoeded iE:(WIN_2000\sy5t=m32\advepi32.dir
i UJoaded "E:\W1N 2000\sy5tem32\rpclM.dH1
:
Unloaded t:\WIN 2000\sy5tem32lole32.dll'
! Unloaded t:\*nn 2000i!ystem3Z\oleaut32.dir
' I | 'F1W! ?nrmW ^ l T ^ *l

UJrlelp
Code and Text
Coding Techniques and Programming pra
Welcome to the Visual C++.NET Beta 1
Visual audio Documentation Start Pan
Visual C++ Samples
Entei prise Samples

Q Dynamic Holp j

- ~~'-- INS

. 2.99.
. , , .
, .

Window / Move to Next Tab Group


Visual Stndio.NET. . , .

Window / Move to Previous Tab Group


Visual Studio.NET. . , .

Window / Close All Documents


Visual Studio.NET.
.
23

. 629

IV.

696


Window () ,
.
, , .
Window |
Windows ( | ).

Windows
, .
.

Window / Windows
Windows (),
. 2.100.

Name
HTMLcpp
HTMLDoc.cpp

E:\Docunrtents and Settings\Nick\ffy Doc .


E :\Documents and Setn
i gs\Nc
i k\My Doc...

Activate

Save

Co
l se Window(s)
- '
1

Co
l se

Hep
l

. 2.100. Windows

,
, , , .

Help
Help (), . 2.101,
Visual Studio.NET. , Visual Studio.NET
.
Visual Studio.NET.

2. Visual C++

697

- Microsoft WsuaC
l ++ lteenl - UtaffiBB

JSjitl

Edit Ve
i w Project Sudd Debug Toosl Wndow Hefc
J ' t 7 8 ^9-!^ b *
<N 0 Dynamci Hep
l
i t URlDlg.cpp|
______
.

__

Ctrl+FI

-J> Contents
_ ^ ^ ^ ^
,

CURLDlg: :~CURLDlg()

Ctrl+Ak+F2

Inderesults

Class ^i

WebRead

$ J l WebRcad

i Sarch

IHPLEHENT_DYHAHIC(COELC1CJ, CDlslog) " j


CURLDlg: :CURLI4cj(CWncl* p P a r e n t / r=fJ
: ?Dialog,CURLDlg::?DD, p P a r e n t ^
m_URL (
("' r ) )

jj>

bckedStart

Ctrl+Alt+Fl

Shift++F2

S*t**

+ A f t + F 3

[ 3 5buw 5tart Page


Check for Updates
) \) Customer Feedback

v o i d CURLDlg: :DoDataExchange (CDataE| gs? Technical Support


| CURLDlg VCCodeClass
CDialog::DoDataExchange(pDX);
DDX TextfDDX. IDC URL m UPL1;

About Microsoft Visual C++ .


(Name)

Task Ust - 0 Build Error tasks shown (filtered)


!

CURLblg

*f Descrption

()
Sets/returns the name of the object
P) Task Ust [ D
Ready

. 2 . 1 0 1 . Help

Help I Dynamic Help



, .
Dynamic Help ( ),
. 2.102. , , .
IDynamic Help
3 -
VCCodeCa
l ss Object (C++)
Properties Wn
i dow
Project Properties
Setting Properties for Controls. Documents, and Forms
Code and Text Editor
Codn
i a Techniques and Programmn
i g Practices
Using the Debugger
Samples
Visual Studio Samples
Visual C++ Samples
) Getting Started

. 2.102. Dynamic Help

*J

IV.

698

Help / Contents
Contents
(), . 2.103. Show Help ( ) Visual Studio.NET

. , , -, .
> Visual studioMT Combined -

Fie Id* Jew luols Wnidow *lp


f

Contents
Filtered by
Visual C++and Related

'!

*'

ms help l/tb .:CC/fi; C'Hv5|dn>arl/l

4 X

The ABCsofMf...LiveX Controls \

. \Actne Centra* T-hr>K*i Articles.


ZJ T h e ABCs of M F C A c t i v e X C o n t r o l s

+ ^ VisualStudio.NET
- 0 The MSDN Library
- l i j Component Development
- I j j ActiveX Control
Paul Johr
- I j j Technical Article
Develops Trainer
The ABCs of MFC ud ;j
October ^ i , 1996
] Creating ActiveX Co
Introduction
_i] Creating an ActiveX
ActiveX controls (formerly known as OLE
& COM+ (Component Services
controls) are hot stuff, with more than 1,000
Component Object Model (C
controls currently available. They can run in a wide
Microsoft Transaction 5erve
variety of containersVisual Basic, Visual.C++,
Microsoft uccess, and, as we all know, Microsoft
OLE
Internet Explorer 3.0. (They also can be used by
5 Data Access & Databases
Delphi and Netscape Navigatorand perhaps other
? Development Strategies and Init
containers.)
? Enterprise Development
ActiveX
? Graphics and Multimedia
what I -.all salable." Their functionality can be
? Messaging & Collaboration
Networking b. Protocols
? Office and Visio Development
9 Security
T Location
? 5etup & System Administration
? User Interface Design & Develoi
5 Visual Tods & Languages
? Web Development
S Windows Development

Sample Files:
El!

Ready

. 2.103. Contents

Visual Studio.NET.

Help / Index
Index (
), . 2.104. ,
Contents (),
. , Contents ().
Visual Studio.NET.

2. Visual C++

699

? Visual Studio-Wl Combined C d t e l r t O T ^ l M


File

Edt

Tools

Window

M.
V *
LDialog Class
.Index
Look for:
" ^ MFC Library Reference
CDialog Class
CDa
io
lg ca
l ss
Filtered by:
[ r t
I
i j
Vs
iualC++ and Rea
l ted
CDa
io
l g ca
l ss
<
constructo
i n/destructo
in
~
-^ get
initialization
Wild
members
methods
CDtslog
operato
i ns
overrd
i abe
ls
CDa
io
l g ca
l ss members commonyl overrid
CDa
io
l g member functo
i ns commonyl add
CDa
io
lg method
CDa
io
lgBar ca
l ss
The CDialog class is the base class used for displaying dialog boxes on the screen.
constructo
i n/destructo
in
Dialog boxes are of two types: modal and modeless. A modal dialog box must be closed
control bars
by the user before the application continues. A modeless dialog box allows the user to
display the dialog box and return to another task without canceling or removing the
da
io
l g bars
dialog box
members
methods
A CDialog object is a combination of a dialog template and a CDIalog-derived class. Use
^

D trl

'? -1 t i l

overview
Tech Note 31 usage
CDialogBar method
CDialoglmpI
CDialoQlmpI class
members
methods
overview
static functions
CDINFO sample (ATL attributes)
CDINFO sample (ATL)
CDispParams Class

14" belf // k5CC/MS.M5DNVS|vdiWhtml .

the dialog editor to create the dialog template and store it in a resource, then use the Add
Inde< Results for CDialog class - 2 topics found
1 Location
CDialog Class (MFC)
Dialog Boxes (MFC)

Visual C++ Libraries


Visual C++ Concepts

ft...
Ready"

. 2.104. Index

Help I Search
Search ().
, Contents (),
.
,
Contents ().

Visual Studio.NET.
. 2.5.

Help / Index results


, , Index
( ),
, Visual Studio.NET Index Results
( ). . 2.104
, .
,
Help j Index results ( | )
.

700

IV.
I Studlo.NET Combined Collection - Visual +( / M f t

File

E*

Search

View

tools

Window

Look for:
| CDialog

Hep
l
ms-hep
l.//M5,VSCqM5.MSDNV5/dnvcpp/h
x
Visual C++, MF..sked Questions I
i/isua/c

and C++

(Genera/)

TechnicalArticles

Visual C + + / M F C Frequently Asked Questions

Filtered by:
iVisua! C++ and Related

Search m pities only


Match related words
P" Search in devious results
P Highlight search hits (in topics)

Sampe
l Tiles:
Scot Wn
igo
5244.exe
Stingray Software
Verso
i n 5.0, updated May 15, 1997
Verso
i n 5.6j updated July 14, 1998, and added as a
downo
l adabe
l file to this document
MSDN Editor's Note, May 1997 This
document was copied with permission from the
"Microsoft Visu&i C++/Microscft Foundation
Cfasses (MFC) Frequently Asked Questions (aka
the MFC FAQ.)," written and compiled by Scot
Wingo and sponsored by Stingray Software. You
can find out more about Stingray Software's
products at www.stinorav.corn/.
mments
If you have any Questions
or comments

Search Results for CDialog - 249 topics found


1 Location

Title

Vs
i ual C++/MFC Frequenty
l Asked Questo
i ns Visual and C++ (General) Technical Articles
Generc
i Ca
lss Questo
i ns
Visual and C++ (General) Technical Articles
Ve
i ws, Documents, and Frame Ca
lss Questo
i nsVisual and C++ (General) Technical Articles
OLE Ca
lss Questo
i ns
Visual and C++ (General) Technical Artictes
VvOSflCa
lss Questo
i ns
Visual and C++ (General) Technical Articles
rtalnn- mislnn fMFn
V K I IAI + + I ihrrtrifK
11

=3

) Search Results for CDialog [

. 2.105. Search

Help / Search results


, Search (),
Search Results ( ),
. 2.5. , ,
, Help | Index results ( |
).


Help | Previous topic ( | ), Help | Next
topic ( | ) Help | Sync Contents ( | ) , Visual
Studio.NET. Microsoft
. Microsoft
, .

2. Visual C++

701

Visual Studio.NET

Visual C++. .

Solution Explorer
Solution Explorer ( ), . 2.106, , . , .
(Source Files), (Header Files), (Resource Files) .
. <Delete> .
tm FTF
I. T
I TT?
!T
[J
]'"'"

^J Solution 'HTML' (1 project)


.31 HTML
1
-, _J Source Files
_+] ChildFrm.cpp
_*] HTML.cpp
HTML.rc

'-

+
-

HTMLVe
i w.cpp
MamFrm.cpp
j makfihtmlhelp.bat
stdafx.cpp
J Header Files
J ChldFrm.h
J HTML.h
HTMLDoc.h
i w.h
J HTMLVe
J MamFrm.h
J Resource.h
J stdafx.h
j Resource Files
_J HTML Help Files
J HTML.hhc
_ ] HTML.hhk
HTML.hhp
J HTML Help Topics
J afxcore.htm

i)
_^j

__
j

. 2.106. Solution Explorer

Class View
Class View ( ), . 2.107,
.

IV.

702

{%' J
Global Functions and Variables
S Variables
S indicators
i theApp
< THIS_FILE
<> THIS.FILE
<> THIS_FILE

THK.FILE
> THIS_FILE
Macros and Constants
Macros
* Classes
* CAboutDIg
+ * J Bases and Interfaces
+ Available Overrides
+ = Maps
+ ^ Enums
+ Functions
* * CChildFrame
" J CHTHLApp
Q
% CHTMLDoc
^X CHTMLView
+ ^% Bases and Interfaces
+ Available Overrides
+ = Maps

. 2.107. Class View

,
, .
, , ,
, - .
(protected) ,
(private) .

, . 2.8.
:
Build () ,
. , ;
D Rebuild ( ) .
, ;
Clean () , . , ;
Link () .
, ;
Go to Definition ( ) : -

2. Visual C++

703

, , ,
;

"+
+

;
1

+
+

Globd l**J Build


Maa<
i
t CAbo!
<** cMaid

Rebuild

Clean

+ =* M
+

i
|

3? -1

Add

^ ^|

Set as 5tartUp Project


Debug.

1
+

**CWe1^

>

Save WebRead
Sort Alphabetically

j
|

'+ *'J CWet[>J SortBylype


+ e CWelj ^ So|.|. gy AC(-eSS

| {$ Group By Type
-,- Properties

. 2.108. Class View

Go to Declaration ( ) , ,
;
Add () . , , .
Project ();
() ;
Sort Alphabetically ( ) ;
Sort By Type ( )
;
Sort By Access ( )
;

IV.

704

Group By Type ( ) (,
, , , . .);
Properties () Properties (), .

Properties
Properties (), . 2.109,
.
.
, ,
.

jD
ID_ABOUT8OX(Da
io
l g)IDIgEdtior
jl f 1 ' " ^ 7 "
Fasle
Fasle
Fasle
Fasle
Fasle
Fasle
Fasle
1
| Popup
\ 5ystemMenu
True
!! ThreeDLook
Fasle
Ttie
l Bar
True
TooW
l nidow
Fasle
Style
i
;
!
I
;
}
|

LayoutRTL
LeftScrollbar
MaximizeBox
MinimizeBox
OverlappedWindow
PaletteWindow
StaticEdge

j
___J
1
1

. 2.109. Properties


5 , ,
.

Watch
Watch (), . 2.110, , . , , , ,
.
Watch () Autos ( ) Locals ( -

2. Visual C++

705

), .
, , . 14.

' Name
g pDocTempa
lte

~ CCmdTarget
mJiAutoDelete
~ffl m_pAttachedFactory
- m_hMenuInPlace
-Q3 m_hAccelInPlace
+1 rn_hMenuEmbedding
m_hAccelEmbedding
~f+1 m_hMenuInPlaceServer
- m_hAccelInPlaceServer
m_nIDResource

Value
0x002f4e38 -{CHultiDocTempl3teV

Type
CMultiDocTemplate *

(CCmdTarget}
1
0x00000000 -{CObject}
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
129

CCmdTarget
int
CObject *
HMENU_ *
HACCEL_*
HMENU_ *
HACCEL_ *
HMENU_ *
HACCEL_*
unsigned int

j
i
j
'
v

. 2.110. Watch

Breakpoints
Breakpoints ( ), . , .

I Breakpoints

Name

-3 "iij Columns
Condition

|)|
URLDIg.cpp, line 25

Hit Count

(no condition) break always (currently 1)


(no condition) break always (currently 0)

i<L
. 2 . 1 1 1 . Breakpoints

, ,
Properties (). Breakpoint Properties
( ), . 2.112. .
14.

706

IV.
I Breakpoint Properties
Function Fi'e | Address |
Break execution when the prograrn reaches this location in a file.
File:

j E:\Documents and Settings\Nick\My Documents\Visual Studio Proje

yne:
[~~
Character: j l

Condition...

Hit Count...
Program:

(no condition)
break always
[304] HTML.exe: Native

Cancel

. 2.112. Breakpoint Properties

Help

3

samples.exe .
, .
.
, :
Brush , ;
Console , ;
D DateTime , ;
DDB , - ;
DemoLib , Library Extension;
DIB , - ;
Dialog . / J;
EditApp ;
Extension MFC;
Help , ;
HTML , ,
WinHelp HTML Help;
Library (DLL);
Line , ;
List , ;
MDI . 1 2;
Print , ;
Progress , ;
Rich ;
Sheet , . 3;

708

IV.

Sync , ;
Text ,
;
Tool , ;
WebRead , Web-
HTML.

Listhdr, MtGDI Mutexes, MFC , . MSDN


Library Visual Studio 6.0.

, , , .

607


538
195
- 195
- 202
:
catch 317
try 317
623

:
Server Explorer 659
Toolbox 15, 661

163

:
Brush 186
Console 21
DateTime 125
DDB 195
DemoLib 579

Dialog 15, 57, 149


DIB 202
EditApp 236
Extension 562
Help 415
HTML 487
Library 555
Line 181
List 101
MD1 18, 25, 43
Print 286
Progress 110
RichApp 244
Sheet 82
Sync 369
Text 176, 208
Tool 256
WebRead 588
:
Add Class 555, 591, 666
Add Existing Item 487, 669
Add Member Function Wizard 666
Add Member Variable Wizard 70, 105,
666
Add New Item 668
Add Resource 563, 668
Add Server 680
Add Web Reference 670
Add-in Manager 681
Advanced Save Options 632
Batch Build 672
Breakpoint Properties 516, 705
Build Comment Web Pages 683
Configuration Manager 673
( . . 710)

710
():
Customize 689
Customize Toolbox 680
Data Link Properties 680
Error Lookup 686
Exceptions 676
External Tools 687
Find 638
Find in Files 642
Find Symbol 645
Generic Class Wizard 558
Go To 647
Insert File 648
MFC Application Wizard 255, 285
MFC Class Wizard 565, 591
MFC DLL Wizard 555
New Breakpoint 677
New File 439, 500, 627
New Project 555, 625
New Symbol 274
Open 229
Open File 629
Open Project 628
Open Project From Web 628, 630
Open Solution 631
Open With 629
Options 493, 689
Page Setup 634
Paste Special 245
Path or URL 496
Print 634
Processes 675
Property Pages 321, 524, 571, 664
QuickWatch 522, 677
Replace 641, 642
Replace in Files 644
Resource Symbols 274
Run 232
Save As 229
Save Dump As 679
Save File As 501, 632
Selected Components 646
Table of Contents Entry 494
Topics Found 399
VS Wizards Select File 240
Windows 696

602
:
34, 162
:
17
19
317

:
153
344
138
:
CArchive 29
CArchiveException 323
CArray 348
CBitmap 200
CBmsh 125
CClientDC 164
CCmdTarget 138
CCriticalSection 369
CDaoException 323
CDBException 323
CDC 164
CDocument 26
CDumpContext 29, 528
CDynLinkLibrary 548
CEdit 236
CEditView 597
CEvent 369
CFile 218
CFileException 323
CFont 308
CFrameWnd 41
CInternetSession 597
CList 348
CMap 348, 357
CMapPtrToPtr 349
CMapPtrToWord 349
CMapStringToOb 349
CMapStringToPtr 349
CMapWordToPtr 349

CMemoryException 323
CMemoryState 537
CMultiDocTemplate 40
CMultiLock 369
CMutex 369
CNotSuportedException 323
CObArray 349
CObject 347
CObList 349
COleDispatchException 323
COIeException 323
CPaintDC 164
CPen 185
CPrintlnfo 308
CPtrArray 347
CPtrList 347
CResourceException 323
CRgn 125
CRichEditView 244
CRuntimeClass 548
CSemaphore 369
CSingleDocTemplate 40
CSingleLock 369
CSize 292
CSpinButtonCtrl 81
CTime 134
CToolbar 269
CTypedPtrArray 349
CTypedPtrList 349
CTypedPtrMap 349
CUserException 323
CView 31
CWinApp 38, 217, 361
CWindowDC 164
CWinThread 38, 361
608
614
603
608
369
369
:
About 255
Add New Item 624
Class View 624
Copy 255, 624
Cut 255, 624
Find in Files 624

711
Navigate Backward 624
Navigate Forward 624
New 255
New Project 624
Open 255
Open File 624
Paste 255, 624
Print 255
Properties Window 624
Redo 624
Save 255, 624
Save All 624
Solution Explorer 624
Start 624
Toolbox 624
Undo 624
308
:
HELP_CONTENTS 397
HELP_CONTEXTMENU 398
HELP_CONTEXTPOPUP 398
HELP_FINDER 397
HELPJNDEX 397
HELP_KEY399
HELP_MULTIKEY 399
HELP_PART1ALKEY 399
HELP_QUIT 402
HELP_SETWINPOS402
HELP_TCARD 402
HELP_WM_HELP 398
:
Add:
Add Variable 70
Build:
Batch Build 672
Build 671
Build Solution... 562, 573
Clean 672
Compile 673
Configuration Manager 673
Deploy 673
Rebuild All 671
Debug:
Apply Code Changes 675
Break 675
Clear All Breakpoints 679
Continue 513
( . . 712)

712
():
Detach All 675
Disable Breakpoint 679
Exceptions 676
New Breakpoint 677
Processes 675
QuickWatch521,677
Restart 513, 675
Save Dump As 679
Start 79
Start 675
Step Into 514, 676
Step Out 514, 677
Step Over 513, 676
Stop Debugging 513, 675
Windows 673
Windows Breakpoints 515
Edit:
Bookmarks 650
Copy 638
Cut 637
Delete 638
Find and Replace 638
Go To 647
Insert File As Text 647
IntelliSense 655
Outlining 651
Paste 638
Redo 637
Select All 638
Undo 636
File:
Add Existing Item 630
Advanced Save Options 632
Exit 635
New 625
New File... 500
New Project... 555
New Item 630
Open 628
Open File... 579
Page Setup 634
Print 634
Print Preiew 294
Recent Files 635
Recent Projects 635
Save 632
Save All 633

Save As 632
Save As... 501
Source Control 633
Help:
Contents 698
Dynamic Help 697
Index 698
Index results 699
Search 699
Search results 700
Show Start Page 618
Insert Dialog 239
Project:
Add Class 666
Add Existing Item 669
Add Existing Item... 487
Add Function 666
Add New Item 668
Add Resource 668
Add Variable 666
Add Web Reference 670
New Folder 669
Reload Project 670
Set as StartUp Project 670
Unload Project 669
Tools:
ActiveX Control Test Container 684
Add-in Manager 681
Build Comment Web Pages 683
Connect to Database 680
Connect to Server 680
Create GUID 684
Customize 689
Customize Toolbox 680
Debug Processes 680
Error Lookup 686
External Tools 687
Macros 684
MFC/ATL Trace Tool 686
OLE/COM Object Viewer 687
Options 689
Spy++ 687
View:
Class View 43, 70, 659
Full Screen 662
Navigate Backward 664
Open 657
Open With 657

713

Other Windows 661


Properties Window 659
Property Pages 321, 664, 671
Resource View 50, 57, 659
Server Explorer 659
Show Tasks 662
Solution Explorer 657
Toolbars 662
Toolbox 661
Web Browser 661
Window:
Auto Hide 692
Auto Hide All 692
Dockable 692
Floating 692
Hide 692
Move to Next Tab Group 695
Move to Previous Tab Group 695
New Horizontal Tab Group 694
New Vertical Tab Group 694
New Window 691
Split 691
Windows 696
Close All Documents 695
:
293
:
293
293
293

293

:
AFX_EXT_CLASS 548
AFX_MANAGE STATE 545
ASSERT 526 *~
BEGIN_MESSAGE_MAP 138
CATCH 329
DECLARE_DYNACREATE 363
DECLARE_DYNCREATE 608
DECLARE_MESSAGEJvlAP 138
END MESSAGE MAP 138

IMPLEMENT_DYNACREATE 363
IMPLEMENT_DYNCREATE 610
IMPLEMENT_SERIAL 351
TCard 402
TRACE 270, 527
UNREFERENCED_PARAMETER
547
320
344
MFC Application Wizard 13
:
Build 671
Debug 673
Edit 636
File 625
Help 696
Project 664
Tools 679
View 657
Window 691
:
360
360

602
166

605
-
601
:
Autos 520, 704
Breakpoints 515, 705
Call Stack 524
Class View 70, 659, 701
Contents 698
Disassembly 524
Dynamic Help 697
Find Setup Wizard 392
Help Topics 389
HTML Help 390
Index 698

( . . 714)

714
():
Index Results 699
Locals 520, 705
Memory 523
MFC Application Wizard 404
Properties 57, 154, 659, 704
Registers 523
Registry Editor 232
Resource View 57, 659
Search 699
Search Results 700
Solution Explorer 579, 657, 701
Toolbox 58
Watch 520, 704
390
:
template 335
throw 317
607

254
Dialog Editor 68
Standard 623, 636
623
622
:
614
614
613
613
612
:
294
602
:
289
292
292
360
363
362
36J
367
534

:
ActiveX Control Test Container 684
guidgen 684
Help Workshop 481
HTML Help 485
HTML Help Workshop 486
MFC/ATL Trace Tool 686
RegEdit.exe 232
Spy++ 687
Sync 369
13
17
19
286
360

299
526

166
:
294
294
232
603
:
358
357
:
UPDATE_COMMAND_UI 261,
271
WM_CLOSE 261, 271
WM_COMMAND 388, 407
WM_COMMANDHELP 409
WM_CONTEXTMENU 389, 40/
WM_DESTROY,402
WM_FONTCHANGE 171
WM_HELP 389, 407
WM_HELPH1TTEST 412
WM_NOTIFY 141
WM_TCARD 402
145
344

:
390
403
403
403
403
388
448
:
404
405
404
405
405
405
404
404
:
HTML 485
480
481
166
254
:
AFX_EXTENSION_MODULE 548
BITMAPINFO 206
BITMAP!NFOHEADER 206
CHARFORMAT2 252
HELPINFO388, 511
HELPW1NINFO 402
IMAGE_DOS_HEADER 554
LOGFONT 171
NMHDR 142
OUTLINETEXTMETR1C 172
RGBQUAD 207
TEXTMETRIC 175

:
540
401
:
MS Word 478
513

715

:
afxcore.rtf 406, 450
afxprint.rc 415
afxprint.rtf 406, 469
afxpriv.h 473
afxres.rc 415
DateTimeDlg.cpp 130
DemoDlg.cpp 444, 499
DemoDlg.h 444, 499
DemoLib.cpp 581
Dialog.re 65
DialogDlg.cpp 74
DialogDlg.h 72
EditAppView.cpp 242
Help.cnt 472
Help.hpj 441
Help.rc417
help.rtf 475
HelpApp.hpj 473
HelpView.cpp 444
HTML.rc 487
Library.def 562
LiStDlg.cpp 106
MainFrm.cpp 262, 275
MainFrm.h 262, 275
MDI.cppv35, 46
MDIDoc.cpp 27
MDIDoc.h 25
MDlView.cpp 31
MDIView.h 29
Median.epp 559
Median.h 558
MedianDlg.cpp 567
MedianDlg.h 567
MySpmCtrl.cpp 151
MyView.cpp 49
MyView.h 48
NewHelp.hm 440, 445
Pagel.cpp 87
Page2.cpp 89
Page3.cpp 90
PrintAppDoc.cpp 286
PrintAppView.cpp 295
( . . 716)

716
():
PrintView.cpp 288, 300
ProgressDlg.cpp 115
Resource, h 136
RichAppView.cpp 248
StdAfx.h 584
Sync.cpp 377
SyncDlg.cpp 373, 380
SyncDlg.h 373, 380
Text.cpp 227
TextDoc.cpp 226 Text View, cpp 223
ToolAppView.cpp 265, 280
606
542
232
540
606
:
_CrtCheckMemory 536
_CrtDumpMemoryLeaks 536
_CrtSetDbgFlag 536
_DllMainCRTStartup 539
AddFontResource 170
AfxBeginThread 361, 377
AfxCheckError 529
AfxCheckMemory 529
AfxDumpStack 530
AfxEnableControlContainer 39
AfxEnableMemoryTracking 529
AfxEndThread 365
AfxGetApp217
AfxGetResourceHandle 549
AfxInitExtensionModule 548
AfxIsMemoryBlock 530
AfxIsValidAddress 530
AfxIsValidString 530
AfxMessageBox 409
AfxOlelnit 39
AfxSetAllocHook 530
AfxTermExtensionModule 548
AfxThrowMemoryException 328
CArchive:
IsStoring29, 212
operator << 212
operator >> 213
CArray:
Add 348
GetSize 356

CBitmap:
CreateCompatibleBitmap 200
GetBitmapBits 201
SetBitmapBits 202
CButton:
SetCheck 97
CCmdUI:
Continue Routing 271
Enable 222, 272
SetCheck 271
SetText 278
CControlBar:
EnableDocking 270
CDateTimeCtrl:
GetTime 134
SetFormat 135
SetTime 134
CDC:
SetBkColor 173
CDC:
BitBlt 201

CreateCompatibleDC 201
DrawText 176
EndDoc311
EndPage311
Escape 309
FillRect 124, 200
GetBkColor 173
GetBkMode 173
GetCharABCWidths 174
GetDeviceCaps 175, 306
GetFontData 172
GetOutlineTextMetrics 172
GetTextAlign 173
GetTextCharacterExtra 173
GetTextColor 173
GetTextExtent 283
GetTextMetrics 175
IsPrinting 307
Rectangle 292
SelectClipRgn 125
SelectObject 178, 201
SetBkMode 173
SetMapMode 307
SetMapperFlags 171
SetTextAlign 173
SetTextCharacterExtra 173
SetTextColor 173

SetTextJustification 173
SetViewPortOrg 307
StartDoc 310
StartPage 310
TabbedTextOut 176
TextOut 179
Dialog:
DoModal 244
EndDialog 385
OnOK 386
CDocManager:
DoPromptFileName 229
CDocTemplate:
GetDocString 216
CDocument:
GetFile 221
GetPathName 221
OnNewDocument 29
ReleaseFile 222
SetModifiedFlag 164, 212
UpdateAU Views 164
CEdit:
CharFromPos 244
Clear 585
Cut 585
LineLength 585
ReplaceSel 585, 598
SetSel 585
CEditView:
FindText 244
GetBufferLength 244
GetEditCtrl 243, 597
OnFindNext 244
CEvent:
ResetEvent 386
SetEvent 386
CException:
Delete 324
ReportError 598
CFile:
Close 231
GetFileName 231
GetFilePath 231
GetLength 230
Read 221
Remove 231

717
SeekToBegin 230
Write 222
CFrameWnd:
Create 42
DockControlBar271
EnableDocking 270
LoadBarState 271
Load Frame 41
SaveBarState 271
ShowControlBar 271
Choose Font 169
CInternetFile:
ReadString 598
SetReadBufferSize 597
CInternetSession:
Close 598
OpenURL 597
CListBox:
AddString 109
DeleteString 109
GetCurSel 109
GetText 109
SetSel 109
CloseHandle 385
CMap:
GetNextAssoc 354
GetStartPosition 354
Lookup 355
RemoveAH 357
RemoveKey 357
CMemoryState:
Checkpoint 537
Difference 537
DumpAllObjectsSince 536
CMenu:
GetMenuContextHelpId 399
SetMenuContextHelpId 399
CMonthCalCtr:
GetCurSel 134
SetCurSel 134
CMultiLock:
Lock 368
Unlock 368
CObArray:
operator [] 349
CObject:
AssertValid 34, 528
( . . 718)

718
():

Dump 34, 528


Serialize 29, 212
ConstructElement 350
CPrintlnfo:
GetFromPage 312
GetMaxPage 312
GetMinPage 312
GetToPage 312
SetMaxPage 306
CProgressCtrl:
Create 120
SetPos 119
Set Range 118
CPropertyPage:
DoModal 92
OnSetActive 92
OnWizardBack 96
OnWizardFinish 97
OnWizardNext 96
SetWizardMode 92
CPropertySheet:
SetActivePage 96
SetFinishText 96
SetWizardButtons 92
CreateDC 293
CreateEvent 384
Create Font 171
CreateFontlndirect 171
CreateScalableFontResource 170
CreateWindowEx 389
CRect:
PtlnRect 201
CRgn:
Create RectRgnlndirect 125
CRichEditView:
' *.
GetCharFormatSelection 253
OnCharEffect 250
OnParaAlign 250
SetCharFormat 253
CScrollView:
SetScroIlSizes 292
CSingleLock:
IsLocked 376
Lock 368, 376
Unlock 368, 376
CSliderCtrl:
GetPos 119

SetLineSize 118
SetPageSize 118
SetRange 118
SetTicFreq 118
CStatusBar:
CommandTolndex 284
Create 282
Setlndicators 282
SetPanelnfo 283
SetPaneText 284
CString:
Format 278
GetBuffer 597
LoadString 320
ReleaseBuffer 597
CToolBar:
CreateEx 270
LoadToolbar 270
CTypedPtrArray:
GetAt 354
operator [] 354
CTypedPtrList:
AddHead 358
AddTail 358
GetAt 349
GetHead 349
GetHeadPosition 354, 356
GetNext 349, 356
GetPrev 349
GetTail 349
RemoveAU 356
RemoveAt 356
RemoveHead 349, 358
RemoveTail 349
CTypedPtrMap:
GetNextAssoc 350
Lookup 350
CView:
Do Prepare Printing 311
GetDocument 34, 292
OnBeginPrinting 310
On Draw 34, 164
OnEndPrinting 311
OnFilePrint 33
OnFilePrintPreview 33
OnPrepareDC 164, 310
OnPreparePrinting 310

OnPrint 311
OnUpdate 165
CWinApp:
AddDocTemplate 41
EnableHtmlHelp 486
GetProfilelnt 235
GetProfileString 217, 235
Initlnstance 39, 227
LoadStdProfileSettings 39, 235
OnContextHelp 412
OnHelp 409
OnHelplndex 409
Onldle412
ParseCommandLine 42
PreTranslateMessage 412
ProcessSliellCommand 42
SetRegistryKey 39. 234
WinHelp 396
WriteProfilelnt 235
WriteProfileString 217
CWinThread:
CreateThread 364
Exitlnstance 363
Initlnstance 364
Onldle 364
PostTlireadMessage 137
PreTranslateMessage 364
ProcessWndProcException 364
Run 153, 364
CWnd:
BeginPaint 164, 294
DefWindowProc 388
DoDataExchange 81
EndPaint 164
GetClientRect 199, 292
GetDC 164, 294
GetParentOwner 284
GetSafeHwnd 385, 510
GetStyle 271
GetWindowContextHelpId 399
GetWindowDC 294
Invalidate 222, 292
IsDialogMessage 412
Modify Style 134
OnContextMenu 446, 510
OnHelpInfo 446, 511
OnHScroll 119
OnNotify 143

719
OnPaint 124, 165
OnWnd Message 153
PreCreateWindow 34
Release DC 164
ScreenToClient 124, 294
SetDlgltemText 81, 109, 134
SetWindowContextHelpId 399
ShowWindow 43
Update Data 81
UpdateWindow 43
DestructElement 350
Dispatch Message 137
DllMain 539, 547
DuplicateHandle 366
EnumFontFamilies 169
FindResource 549
FreeLibrary 543
GetCharABCWidthsFloat 174
GetCharWidth32 174
GetCharWidthFloat 174
GetCurrentDirectory 217
GetDlgltem 124
GetExitCodeThread 365
GetMessage 137
GetProcAddress 543
GetTabbedTextExtent 175
GetTextExtentExPoint 175
GetTextExtentPoint32 173
GetWindowRect 124
HtmlHelp 509
LoadLibrary 543
LoadResource 549
MessageBox 221, 320
PeekMessage 137
PostMessage 367, 385
PostQuitMessage 365
Remove FontResource 171
ResumeThread 366
SerializeElement 351
SetCurrentDirectory 217
SetDIBitsToDevice 207
SetEvent 386
SetFileAttributes 231
SetThreadPriority 362, 364
SetWindowLong 270
Sleep 377
TranslateMessage 137
( . . 720)

720
():
UpdateAllViews 367
WaitForMultipleObjects 384
WaitForSingleObject 385
WinHelp 395
WinMain 360
604, 614

361

:
341
338
166

:
Button 103
Check Box 63
Combo Box 62
Date Time Picker 126
Edit Control 59
Group Box 64
List Box 102
Month Calendar Control 126
Picture Control 111
Progress 110
Radio Button 64
Slider Control 110
Spin Control 61
Static Text 58
59

"-"
:
" "
. . Windows 2000 Professional.
. . Microsoft Windows 2000 Server.
. . Windows 2000
. . Microsoft Windows 2000 Server Professional.
., . Word 2000
. Java ( -)
. Microsoft Word 2002
. Windows NT Unix ( -)
. A. Delphi 6
. MS Excel 2000
. .
., . PC, 4-
. . HTML 4.0
. MS SQL Server 2000
., . Microsoft Access 2000
., A. Microsoft Office 2000
., A. Microsoft Office XP
. : - .
1
., . Java 2
. : . 2
.,. XML
. Macromedia FreeHand 9
. Adobe Illustrator 9.0
. Adobe Photoshop 6.0
. WAP:
. PC ( )
. ., A. A. CorelDRAW 10:
. ., A. A. Adobe InDesign
. A. A. PageMaker 6.5
. . Active Server Pages ( -)
. Microsoft Outlook 2002
Microsoft office 2000: -

700 .
960 .
576 .
1056 .
992 .
1104 .
992 .
464 .
1152 .
1088 .
1008 .
1024 .
672 .
1280 .
1088 .
728 .
928 .
848 .
1072 .
528 .
736 .
432 .
608 .
832 .
432 .
1248 .
1136 .
500 .
832 .
672 .
656 .

""
Microsoft Press. . 2-
( -)
. Dynamic HTML ( -)

368 .
496 .

.
. -: , ,
. Windows
. .
. Internet 2000
. Novell GroupWise 5.5:

A. Visual'Basic 6.0: ( )
A. Excel, VBA, Internet
A. Microsoft Excel 2000:
. Windows ( )
., . Delphi
. JavaScript Web-
. . MS Excel
. -
. Windows ME
. Windows 2000
. Web-
. DirectX. Delphi ( -)
. Open GL Delphi ( )
. JAVA
. 3ds max 4:
. MS Office Project
. . Motorola
. . , ,
A. Maple 6.
., .
., . Microsoft Access 2000:
. . Microsoft Office 2000:
., . IP-
. Visual LISP AutoCAD
. ActiveX Delphi
. InDesign:
. Windows Scripting Host
.
., . PC: , ,
2-
. SVGA- IBM
. MS SQL Server 2000:
. Visual C++
( )
. ATL 3.0 ( ).
. , , Web Linux
A. Windows 2000 Active Directory

384
256
250
320
448
480

.
.
.
.
.
.

448 .
816 .
576 .
384 .
656 .
880 .
304 .
480 .
448 .
352 .
592 .
416 .
352 .
336 .
448 .
400 .
560 .
304 .
528 .
560 .
832 .
680 .
512 .
576 .
320 .
544 .
320 .
512 .
336 .
432 .
368 .
256 .
928 .
416 .
400 .

. Java ( -)
. -
. Web-. XML
. Web-
. C++
., . .
( -)
Microsoft Windows NT Server 4.0
Microsoft Windows NT Server 4.0
Visual Basic 6.0
*
CD-ROM " Windows NT Server 4" "
Windows NT Server 4"
CD-ROM "": "Office 2000", "Excel 2000",
"Access 2000".

400 .
224 .
304 .
224 .
416 .
432 .
752 .
880 .
992

""
., . Visual Basic 6.0
.
. VBA
. JavaScript
. Excel 2000 ( )
. Macromedia Flash 5
. Macromedia Dreamweaver 4
. MathCAD 2001
. 4
. Object Pascal Delphi 6 ( )
. . Turbo Pascal 7.0 Delphi,
2- ( )
. UML
., . Perl
. Visual FoxPro 6.0
., . Windows 2000 Professional
., . Microsoft FrontPage 2002
. 3D Studio MAX 4.0
. AutoCad 2000 Visual LISP, 2-
. Kylix
. Visual C++ 6 ( )
. #
. WML WMLScript
. ., . . Adobe Photoshop 6 ( )
. ., . . CorelDRAW 10
. MFC ( )
. Microsoft Outlook 2000
. Java
. Microsoft Word 2000

624 .
448 .
512 .
512 .
368 .
368 .
560 .
544 .
576 .
528 .
416 .
304 .
432 .
512 .
528 .
576 .
370 .
672 .
416 .
960 .
576 .
240 .
608 .
640 .
640 .
336 .
464 .
688 .

. .
. HTML 4
. C++, 3- ( )

272 .
288 .
512 .

" "
. PC
. Web-
.
., . .
., . PC. Cakewalk. ""
., . PC
., . PC
., . PC
., . PC. Cakewalk Pro Audio 9.

352 .
288 .
320 .
608 .
272 .
272 .
256 .
240 .
420 .


. :
. 600
., .

.
. Linux: ( -)
. PC
. : , ,
.
.
.

288 .
624 .
256 .
64 .
144 .
400 .
288 .
416 .
256 .
384 .

" "
. Access 2000 20
.
( -)
. .
. ,
2-
. C/C++
. Turbo Pascal
. Unix
.
. .
. .
MOTOROLA
.
.

512 .
464 .
480 .
512 .
288 .
256 .
528 .
224 .
464 .
512 .
528 .
592 .

1600

w w w . c o m p u t e r b o o k . r u

> ;:

hllp //www compuieibook lu/


J JobUsUu , @ . ..

[JO
j >>

Bl

-
- Computeibook ru

Microsoft Office XP


20

* : 1636
: 11
t : 1

"

Web-. XML

- "-
"

Copyright lcomputetboolc.ra.2001

'

H i

Microsoft* ".;....
Access

Mcirosoft*

...

Microsoft

i;;i.,.

Outlook

4T.' I

Excel

Mcirosoft
Office

Mcirosoft91z:s.
Word

-: www.bhv.ru (812) 251-42-44


-: www.computerbook.ru
: trade@bhv.spb.su

You might also like