Professional Documents
Culture Documents
681.3.06
- 32 Windows.
. , . , ,
. (DLL). Visual C++.
:
.
. .
Visual C++ .NET. .: -, 2002. 736 : .
ISBN 5-94157-032-5
. . , 2002
, "-", 2002
?
,
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
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,
Visual C + + , C++.
, MFC,
,
.
, DOS.
.
Microsoft. ,
DOS, Windows . Visual Studio.NET , ,
, .
,
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 + + , , .
.
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
I WindowsApplicationl
Location:
Browse...
1.
15
Xemplates:
Project Types:
I Visual Basic Projects
| Visual C# Projects
Custom
Wizard
Extended
Stored Pro...
Makefile
Project
; <Enter >
Location:
^ Add to Solution
Browse...
OK
"
Cancel
I.
16
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
Project style:
Windows Explorer
(i MFC standard
Dialog based
Use of MFC:
(V Use MFC in a shared DLL
Use MFC in a static library
Generated Classes
1.
'.. Dialog -Microsoft W5Ualt++[desion1
file Edit
View
Project
guild
Debug
^ ^ ' ^ ^ ^ '*'*
Tools
Wndow
"T5"t
** ^
_|gj X |
Help
> Debug
<
17
rf*
Te
*t
-*
' JtF-
15 --I1 *?
"
T
1
<l
'
giReso
1
t X
Properties
Find Re Jt 1
J
J
<i
3 ... hsReady
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.
I.
18
Multiple documents (
(). MFC Application
,
.
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
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.
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
Finish
Cancel
Help
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:
Console application
;.
i*" Windows|.application:
?* DLL
("' Static library
Additional options:
F~ Empty project
Finish
Cancel
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];
<F5> .
, . 1.11.
***> ".'- .
. 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() ;
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
# 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()
// CMDIView
void CMDIView: :OnDraw(CDC* /*pDCV)
{
CMDIDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// :
// CMDIView
BOOL CMDIView::OnPreparePrinting(CPrintlnfo* plnfo)
{
//
return DoPreparePrinting(plnfo);
2. ,
33
II :
}
void CMDIView::OnEndPrinting(CDC* /*pDC*/, CPrintlnfo* /*plnfo*/)
{
// :
// CMDIView
#ifdef _DEBUG
void CMDIView::AssertValid() const
{
CView::AssertValid();
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)
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
Cancel
2. ,
45
I Add Class-MDI
Templates:
~5napTn " TransicEC
ATL OLEDB
Consumer
ATL OLEDB
ATL
Provider Performanc...
ATL Property
Page
MFC Class
MFC Class
MFC ODBC
Cancel
Help
. 2 . 4 . Add Class - M D I
Automation
Creatable by type ID
"
Finish I Cancel
. 2 . 5 . MFC Class Wizard - M D I
Help
I.
46
!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;
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
//
//
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyDoc))) ;
r e t u r n (CMyDoc*)m_pDocument;
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. ,
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*
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.
"\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 " -"*
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 ?
Menu
_ J
PT_MANIFE5T
_ J
String Table
f 'et^ian
| I ~ J J
Output
"
|Dehug
1 Prop^rtie^
_ J i String Editor
*
BlrEd
*
_]
1 (Name)
1
5
output
:'l
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
. 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 ().
;
<F4>;
, , , ,
. .
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 *
1 ' X
u
xj
PC nte
' '
|
OK
X.
rc*
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
. .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
con
JT_MAflIFEST
1
l
Ihrg Table
Version
# Spin Control
3--".
1 *
^ C .
aReso...|
Properties
flDD_DIALOG_DIALOG (Dialog)
Q Animation Control
General
X
J^J
jTT) $i [] -/ "
C 3 Tab Control
Ao Rich Edit 2.0 Control
'
z\
(name)
Ready
. 3 . 3 . Dialog Editor
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?', - -
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
File dif tfiew Project guild Qebug FQrmat lools Wnidow Help
none
J Sample edit
.-I.JlXl
* \_M Text
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
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
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
" ".
()
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
igrc*
dialog
3 IDD_AEOUTBOX [English (U.S.)]
1
none
j Sample edit
j Sample edit box
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
fjle
Edit
View
Project
J ia - r# H 9
guild
Qebug
* * d>
Fjj-mat
"
jpols
gmdow
.i
t x
.grc*
Jiaioa
3 IDD_ABOUTBO>! [English (U.S,)]
3] IDD_DIftLOS_DIALOS [English (U.S.)]
tcon
(T_MANIFE5T
jtrmg Table
Version
*i
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
..,,,,.,
i*.
~.,
|
none
j Sample edit
f*"
^"
Cancel 1
~4
:.
cue*
Jialog
S | !DD_ftBOUTBOX [English (U.S.)]
3 IDD_DIALOG_DIALOG [English (U.5,)]
xon
ST_MANIFE5T
String Table
Version
( , , , , ! , , ,
i
Pmperties
Group
False
ID
IDC_SPIN_5WIT(_J
Tabstop
False
ID
Specifies the identifier of the control.
J
Ready
jj*~
+
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.
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
|1
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
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
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. .
.
CBN_D6LJi.K
<Add> OnCbnCo
l seupCombo
CBNJ3ROPDOWN '
CB('J_EDITCHANGE
: CBN_EDITUPDATE
: CBN.ERRSPACE
]
CBN.KILLFOCUS
'. XBN SELCHANGE
:CBN_CLOSEUP
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
I-
I
Comment (// notation not required):
I
I
J
Finish
Cancel
H
pel|
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.
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) ;
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)
//
.
3.3, .
.
3.4.
78
I.
\ 3.4.
;
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
Base class:
|cWnd
.HTM file:
___^
~3
.H file:
Automation:
<*" None
<~ Automation
f~ Creatable by type ID
.CPP file:
f~ Active accessibility.
F_inish
Cancel
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'
V~ ?
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.
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() ;
}
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();
//
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
. 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.
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.
.
// ,
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
\.
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
i
Group
False
ID
Tabstop
IDC.LIST
True
(Name)
Ready
. 4 . 1 .
4.
103
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
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.
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
(
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
<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
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.
110
II.
, TRUE, , FALSE, .
Progress, , . :
1.
, 1.
Progress.
2.
3.
Language (). .
4.
Russian ().
5.
Output ( ) .
6.
7.
8.
Cancel ()
Caption () Properties ()
.
9.
4.
111
'
'7.7,
' i+ U^T f*
- L
Propere
tis
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
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
''"I 16,66
j " 29x212
. 4 . 1 0 .
4.
113
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
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
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
// 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;
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 ) ;
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.
4.
127
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.
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
Ready
. 4 . 2 0 .
21. DTN_DATETIMECHANGE.
.
22. . .
23. .. 2022 Month Calendar Control
( ),
MCN_SELECT.
4.
129
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 , .
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
Visible
I!
True
Group
False
ID"_5FLECT
2}"1
ID
- 5penh*s the identifier of the contiol.
___)
jj"
"'
Ready
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:
(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,
Win32
, Windows 3.1, Win32 API . Win32 ,
Windows 3.x.
.
, ,
WM_*, Win32 API , WMNOTIFY, .
142
II.
tagNMHDR
HWND hwndFrom;
UINT i d F r o m ;
UINT code;
} NMHDR;
,
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.
,
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)
ON_UPDATE_COMMAND_UI_REFLECT
(memberFxn)
ON_WM_CTLCOLOR REFLECT()
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{)
ON_WM_COMPAREITEM_REFLECT()
ON_WM_CHARTOITEM_REFLECT()
ON_WM_VKEYTOITEM_REFLECT()
ON_WM_HSCROLL_REFLECT()
ON_WM_VSCROLL_REFLECT()
ON WM PARENTNOTIFY REFLECT))
ON_NOTIFY_REFLECT ON_CONTROL_REFLECT
( ). . 5.2.
.
5.2.
ON_NOTIFY_RE FLECT_EX
(wNotifyCode, memberFxn)
ON_CONTROL_RE FLECT_EX
(wNotifyCode, 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
Categories;
Add ATL
Support .,.
ATL Dialog
ATL MMC
Snapln
ATL M5
Transact!,..
Cancel
Open
Base class:
H
.TM file:
Automato
in:
_J f None
.H file:
Automation
' ,,,\
(~ Creatable by type ID
,CPP file:
I
* Active accessibility.
Finish
Cancel
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
[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)
152
II.
pNMUpDown-> i D e l t a = -pNMUpDown-> i D e l t a ;
*pResult = 0;
Access:
Variable type:
Variable name:
,.
.1
Finish
. 5.5.
Cancel
Help
5.
153
, 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++
' \ - \,
. 5 . 6 . Properties
[MySpinCti-l VCCodeClas^
QT] % -/ ^
MySpinCtrl
C++
. 5 . 7 . Properties
II.
156
Event ()
(ControlEvents) ( ) Messages ().
ControlEvents ( ) , . ,
(. 5.8).
*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.
...A
. 5.9.
5.
157
.
.
, .
Properties
() , ,
, . 5.10.
.-
' 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
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.
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.
//
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.
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;
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;
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
-i, -i-
d r
"
- .31 Brush
_
) Brush re
!
+ ^_j Accelerator
- _ J Dialog
IDD_ABOUTBOX [Enc
3 IDD_8RU5H_DIALOG
_ J Icon
* _)Menu
_ J String Table
* _ J Toolbar
'
:*> OnEnHscroEditBox
*"" ,
,
; |
Ready
. 6.6.
I Add Class - Brush
lemplates:
Categories:
Snapln
Iransacti,,, ^1
Cancel
Help
II.
192
C (Treatable by type ID
Finish
Cancel
Help
6.
193
Access:
" Control variable
Variable type:
fbooi
Variable name:
J
Fn
is
ih
Cancel
Hep
l
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
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
//
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);
// 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;
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. (, .)
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.
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
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
'
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
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
^>
*
+
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
.
'
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:
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:
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;
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.
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)
//
//
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
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.
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
7.
229
onLButtonDown ,
.
CFile: :write,
, , .
OnRButtonDown ,
, .
,
Save
As
(
).
230
II.
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.
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
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.
3. Base class ( )
CEditview Finish ().
8,
Generated Classes
Review generated classes and specify base classes for your application,
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
20. .h file.
VS Wizards Select File, . 8.5.
Finish
Cancel
Help
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
Cancel
242
II.
). Add Member Variable Wizard
( ).
8.
243
// 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.
,
CRichEditview. WordPad, MSDN. -
. , .
, CRichEditview
, RichApp ,
. :
1. , I
RichApp, MFC Application Wiz-
8.
245
OK
Source: E:\VC7WC08WC08_.doc
As:
<? Paste
Microsoft word
Picture (Metafile)
Rich Text (RTF)
Unformatted Text
Cancel
" Display As Icon
. 8 . 7 . Paste Special
, ,
,
.
. .
. . 8.8.
. 8.8 "",
Word. ,
Word.
, Edit | Insert New Object ( | ), Object Type ( ) In-
246
II.
UV RichApp - RichApp 1
File
'
* ', . ..
Window
) \
Jg)
! I
I LS3 =
*?
ll
> = iW
PJ RichApp 1
^^
* 1''--.'^|
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.
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".
248
II.
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.
,
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
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
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
: :
Advanced Features
* Spjt window
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
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
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.
File Edti Ve
i t Eroe
i ct BuJd Debug Toosl Wn
idow Hep
l
,
-'
^
.,
'
\
1 , . - 1!
Debug
^ ."
"
., , b . i '
. EDIT1
fi>
.!" C>
- _]
+
+
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
_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.
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;
263
264
II.
//
SaveBarState("Local AppWizard-Generated Applications");
CMDIFrameWnd::OnClose() ;
44.
OnUpdateMyTooibar 9.3.
//
//
//
pCmdUI->SetCheck((m_MyToolBar.GetStyle() & WSJVISIBLE) != 0) ,
return;
//
//
pCmdUI->ContinueRouting() ;
45.
9.4.
//
ShowControlBar(&m_MyToolBar,
(m_MyToolBar.GetStyle() S WS_VISIBLE) == 0, FALSE);
return TRUE;
}
return FALSE;
9.
265
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;
II.
266
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
. 9.8. Tool
268
II.
. 9.9. Tool
58. View () My Toolbar ( ).
.
59. , . 9.10.
60. .
.
,
, .
, Visual C++ ,
.
9.
269
. 9.10.
"Jj
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 -
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.
, 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...
*>
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.
275
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,
276
II.
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 ) ;
}
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))
//
//
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)))
{
//
//
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 .
.
Advanced features:
Advanced Feature
* Active Accessibility
Generated Classes
Finish
Cancel
Help
, , 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.
ill
_J
Finish
Cancel |
Help
288
II.
// 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);
13. <F5> .
14. .
, ,
. 10.4.
15. . .
16. . , , . 10.5.
,
, " ".
290
II.
. 1 0 . 4 .
Ready
. 1 0 . 5 .
10.
291
Edit
View
Window Help
,..#
Ready
. 1 0 . 6 .
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
. 10.7.
5. . .
6. . , ,
. 10.8.
7. . , . 10.9.
8. Zoom Out ().
, . 10.8.
9.
10. , . 10.10.
11. Close () .
12. PrintAppView.cpp.
13. OnDraw 10.4.
II.
296
liUPrint-Print!
File Edit Sew Window Help
Q
CTQS.^
Pagel
. 10.8.
Print- Print I
.JSliiJ
Pnnl
; Nexi Page
Zoom CM
_ _,'
Page 1
. 10.9.
10.
' D
I
Pnnl _J fclexlPageJ
Page 1
. 1 0 . 1 0 .
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);
I If Fa .
'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!
Pages 1-2
. 10.13.
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.
//
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);
10.
305
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.
10.
309
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++
Microsoft Visual C + + .
, , , .
Windows , . , , ,
, .
,
. ,
MFC, .
.
Visual C + + :
t r y , ;
catch,
t r y , ,
;
throw
catch.
catch, MFC,
.
,
:
//
try
318
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.
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
catch(MyException* me)
{
me-> E r r o r P u t ( ) ;
Visual C++
Visual C++ :
, C++.
MFC 3.0 ;
, MFC.
321
, MFC,
C++.
, .
, , C++. .
:
1. Class View ( ) Solution Explorer ( ), ,
, View | Property
Pages ( | ). Print Property
Pages ( ), . 11.1.
_*]
. 3 Platform; (Active(Win32)
'B 'imr; ,ii
! Intermediate Directory
| Extensions to Delete on Clean
Output Directory
Hro)ect Defaults
CJMIDL
i
!
|
!
j
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
OK
Cancel
Help
322
4. . .
5. "Yes (/EHsc)".
Print Property Pages ( ) , . 11.2.
xj
'
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 |
.
) .
Property
Pages
:
:
. ,
. . .
. , , , , , ;
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
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
, -
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
catch(CException* e)
{
// .
. .
:
, ;
catch ,
.
,
:
void SomeFuncO //
{
CSomeClass* Local = new CSomeClass;
// ,
// .
Local-> OtherFpnc() ;
// .
delete Local;
Local
someFunc. ,
,
.
, ,
. ""
.
,
"" .
void SomeFuncO
{
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
//
// ,
delete Locale;
,
.
, MFC . .
AfxThrowMemoryException . someFunc :
void SomeFunc()
{
delete s z F i r s t ; //
AfxThrowMemoryException();
//
delete szFirst;
delete szSecond;
, , , , , -
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)
{
330
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 , -
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
.
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
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
)
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
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
. 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)
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))
338
:
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)
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)
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.
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
)
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>
343
(<>).
, , >> ->. ,
Some_Class< f l o a t , a > ? : >
X;
Some_Class< f l o a t , (a > b ? : b) >
X;
, ,
.
, , , , . , ,
.
,
.
,
, . , some_ciass ,
.
Template
,
.
, .
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
MFC
. :
, ;
, .
, MFC, 1.0.
" . .
MFC : ,
( ).
, .
.
, , . , .
,
. .
,
.
.
( )
.
,
, , MFC , . . 11.1 .
11.1. ,
CArray
CList
CMap
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
.
.
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
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
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
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.
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 .
351
constructElements , (
)
. DestructEiements ,
, , . constructElements .
class CMyClass : public CObject
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
352
// 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
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
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)
( ), 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
,
.
:
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();
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
AddHead,
RemoveHead.
, , MFC , .
.
class CBullet : public CObject
cobList,
,
.
"", "",
.
: .
, AddTail,
RemoveHead:
, , MFC,
, .
.
class CSomeClass : public CObject
359
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
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
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
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
, ,
.
,
. ,
,
. .
:
, 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
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.
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
" 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
"
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.
372
.' 5--
JSl
Access;
| |
" Cgntiolvanable
Variable type:
Vara
i be
l name;
Cancel
Hep
l
12. Windows
373
//
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::();
i;
CString
szTemp;
CSyncDlg*
pt = (CSyncDlg*) param;
CSingleLock
pt->m_Count++;
FirstLock(&(pt->m_Critic)) ;
//
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
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.
378
Solution
Look in:
History
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
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
10. CEvent' m e F i n i s h ;
HANDLE m _ p E v e n t s [ 2 ] ;
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
*/
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;
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
,
,
, . .
, , . ,
.
. 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
, . 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
. ,
, , . ,
.
.
.
. ,
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, ,
.
390
|.[|1.:..!
()
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
. 13.2.
,
/ ,
"".
.
. 1 3 . 3 .
2 0 0 0
P r o f e s s i o n a l
. 1 3 . 4 . HTML Help
zl
392
Cancel |
13.
393
Back
Finish "
Cancel
I!
Bisplay
6. , . 13.8.
394
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
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
.
, , , , . ,
. , .
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
, , . .
.
winHelp
HELP_WM_HELP HELP_CONTEXTMENU.
,
.
HELP_WM_HELP WM_HELP
.
WM_HELP Defwindov.-P;.;,c,
( ).
,
, , winHelp
, hitemHandie,
HELPINFO, WM_HELP.
, WMHELP
.
HELP_CONTEXTMENU
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. . (
400
, Windows 3.x)
, ,
( cnt), : index :Link.
^ ^ ^
mi
Contents
Index
| pr,d
4U.XJ
]l
2
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 '
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
13.
403
, . :
. (
" ?" " ?");
. (
,
. , , );
. ( ).
Windows .
<F1> WinHelp, , .
<Shift>+<Fl>. ( )
.
<F1>
.
.
( ).
,
.
,
. .
Context-sensitive Help ( ) Advanced Features ( )
MFC Application Wizard - Help (
MFC), . 13.13.
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
Advanced Features
Generated Classes
Finish
Cancel
Help
.
, . , AppWizard .
h (header file) ,
.
hrn (help mapping file)
. , ,
.
rtf (rich text format) .
cnt ,
Contents ( ) Help Topics (
). (, , hip).
13.
405
[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
[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
[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
//
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
.
.
, , , . 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.
414
?????????
/~>->->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 ().
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
Open |-|
Open
Open With...
. 13.16. Open
Add...
Set as Default
Close
Help
13.
417
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
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"
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"
CURSOR DISCARDABLE
#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"
"resWtrcknwse. cur"
"resWtrcknesw.cur"
"resWtrckns. cur"
"resWtrckwe. cur"
"res\\trck4way.cur"
"res\\move4way.cur"
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"
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
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
// 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
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
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
" \"
428
ID_FILE_SAVE
" \"
ID_FILE_SAVE_AS
"
\ "
ID_FILE_PAGE_SETUP
"
"
ID_FILE_PRINT_SETUP
"
\ "
ID_FILE_PRINT
" \"
"
\ "
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
" \
"
" \
"
END
STRINGTABLE
BEGIN
AFX_IDS_SCSIZE
" "
AFX_IDS_SCMOVE
" "
AFX_IDS_SCMINIMIZE
" "
AFX_IDS_SCMAXIMI ZE
" "
AFX_IDS_SCNEXTWINDOW
" "
AFX_IDS_SCPREVWINDOW
" "
" "
" "
" "
" "
"
\ "
END
tendif
iifndef APSTUDIO_INVOKED
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""
"#include
""afxres.rc""
// Standard components\r\n"
"iinclude
""afxprint.re""
"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
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"
tinclude "afxres.rc"
// Standard components
#include "afxprint.rc"
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_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 (
) ."
434
"He
(
INI file)."
"
%s,
."
"
%s
%s.
% "
// 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
" %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
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
13.
439
WinHelp(HID_NEW_HELP);
17.
#pragma once
HelpView.h
Categories:
Templates:
C++ File
()
I
Resource File
(.re)
Bitmap File
(.bmp)
Cursor File
(.cur)
j \
Icon File (.ico)
Resource
Template ...
zl
Cancel
Help
0x01
440
No
Yes
Cancel
Help
. 13.20.
Microsoft Development Environment
ISaveFileAs
Save in:
History
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.
441
, ,
. , , , .
Help ,
:
1. Help Resource View ( ).
2. Help.rc, Menu ().
3. iDRHeipTYPE.
.
4. " ",
,
"&"
<Enter>.
5. ,
.
442
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
ATL Dialog
ATL MMC
Snapln
ATL MS
Transacti...
Help
Cancel
">
.^, , v :0
iii
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
Help
444
j
i
//
void CHelpView::OnDemoDialog(void)
{
CDemoDlg dig(this);
dig.DoModal();
BOOL OnHelpInfo(HELPINFO*);
afx_msg
v o i d OnContextMenu(CWnd*, C P o i n t ) ;
DECLARE_MESSAGE_MAP()
13.
445
IDC_CONTEXT, HIDD_CONTEXT,
IDOK, HIDD_CONTEXT_OK,
IDCANCEL, HIDD_CONTEXT_CANCEL,
0, 0
};
// 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;
32. NewHelp.hm
HIDD_CONTEXT
0x02
HIDD_CONTEXT_OK
0x03
HIDD_CONTEXT_CANCEL 0x04
.
DemoDlg.cpp aHelpIDs,
.
.
NewHelp.hm.
, HelpApp.hm.
Properties () HelpID ( ) (
446
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.
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
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
.
"
{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
, 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
^ ( )
. , .
.
:
{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
{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
.
^ 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}
,
, , .
<< >>
* ( )
, ,
. .
{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
CTRL+F4
ALT+F4 YourType
" ( )
.
' ( )
Windows.
:
CTRL+ESC
'^ ( )
. >>
**
.
**
<< .
*' ( )
.
13.
465
>>
"'
.
*^ ( )
.
"*
.
*' ( )
.
:
F4
"' ( )
.
!
"' ( )
.
'''
<< .
466
^
.
>>
*
, .
'
.
*
.
,
, 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
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
.
.
.
AFX HIPP PRINTSETUP,'
.
,
"" "".
,
,
.
<< >>
YourApp
. , , .
{ ).
ttK S
( )
, .
, ,
. HIDW PREVIEW BAR. , , ,
.
13.
471
# $ _
:
/
.
.
>>
# $
( )
.
npnHTepaAFX HIPP PRINTSETUP.
:
,
, .
( ).
, .
16 . 629
472
( ,
).
,
, .
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
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
13.
475
6. afxcore.rtf help.rtf.
7. , ,
.
8. afxcore.rtf
help.rtf .
* *
:
1 DEMO DIALOG
# $ ( )
,
.
'' ( )
,
.
'' ( )
.
'' ( )
.
# $
.
.
476
DEMO.
"
.
9.
help.rtf .
* menu_demo
HID_DEMO_DIALOG
* 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.
Print
.
.
.
. 13.28. HELP
, . , -
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
"
"
"
"~ ' "
"~~*~
TrueType. , .
...
. 13.30.
^|
,
.
, ,
.
<Ctrl>+<Enter>
:
1. | . , . 13.31.
2. . .
480
" ;
* !
*
f~"
. 13.31.
RTF
.
, .
, .
, . hip. :
{ }
. BMROOT [OPTION] hpj.
. . 13.3.
13.3.
bmc
bml
bmr
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
. 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.
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 ()
" " ( ). .
484
<"* Heading
( Jopio
< yacro
" Include
Title:
Topic ID:
Help file:
Window type:
|
Cancel
J<J
v,
Yes
lies
i;,
Yes to 11
No
No to All
13.
485
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
486
, ,
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
().
488
xj
.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
Open i' |
Cancel |^
HTML File
Table of Contents
Index
Cancel
. 13.38. New
13.
489
1
ai*
**
' ''1
*i'
i
i
i
!
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
j|_
Next>
i =41.-1
i
\
- *"*
--.'-
. , . "' ft
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
490
( ).
Open ().
New Project Source and Destination PicAitl
Specify where your WinHelp project file is located:
firowse...
<Back
Next>
Cancel
ZJ
;*JMy Pictures
I ] Visual Studio Projects
File name:
Files of Jype:
flpen
] Project Files (",hpj)
Cancel
. 13.41. Open
13.
491
Cancel
^ 7
^|
HTML, , ,
Visual Studio.NET, , .
17. HTML.
<Title> (untitled) ,
rtf .
^7
,
.
Context .
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
PO
'e
i clj Contents | Index j
l!?l [||>1
OPTIONS] 1 or later
1Comptedlile-HTMLchm
"1.
IS
_;
Jj
Hi
"ftl
'
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.
493
,
. .
18. Change project options ( )
, Project ().
Options (), . 13.45.
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
21*1
General | Files Compe
lir j Merge Files |
r While compilng, display
! P
Erogiess
OK
Cancel
Cancel
. 13.47.
Table of Contents Not Specified
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
tiff1 x l
</BODY>
</HTML>
Jll
Ml
. .
' '
.
'
'
"
.
. 13.49. Contents
.
.
'
.
.
^
.'
- '
'
.
. . :;
'..
"
496
.- :
Table of Contents Entry -v.:-- :
General j Advanced |
Available information types:
Entry title:
1
Add...
Edit... ]
j?J x 1
Remove |
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
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
<-> 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>
. 13.52.
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;
.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
'|
Cancel
Help
502
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
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
'^?$^~-
Qplions
YourApp
...
j
:i]
<<
>>
. 1 3 . 5 5 . Help
Hide
Options
1
j .
.
. 1 3 . 5 6 .
13.
Hide
507
Qptions
]
;=]
. >>
.
.
. :
.
:
.
. 13.57.
20. | . .
21. Help ().
.
. , . 13.58.
22. .
, HTML . , (
) . , HTML
,
( ). -, ,
. -,
, ,
. , -, ,
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
_ 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
i" 1
Cancel
,.,',..-.j^
510
, : :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
512
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
( | );
, , ,
514
Edit
Bw
Eroiect
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
_^
_ J ChildFrm.h
_ J DemoDlg.h
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"'
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 #
_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
Hit Count
break always 1
break always t
;
J
^J
. 1 4 . 2 . Breakpoints
, , -
516
. <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
OK
Cancel
Hep
l
, . 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
jj
!|
OK
Cancel
He|p
518
iNew Breakpoint
Language:
C++
Condition... 1 C condition)
Hit Count... break always
OK
Cancel
Help
14.
519
). Breakpoint Properties
( ) ,
, , , .
Data (). New Breakpoint
( ) , . 14.6.
, , Variable
(), Items () , . Items () , Variable () .
, , , , , .
. 14.7.
, ,
, -
.
, .
Visual C++
. 14.8. ( ) , ,
520
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
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.
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>
522
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
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
\
:
No
No
Application (.exe)
Not Using ATL
No
Use MFC in a Shared DLL
No
Use Multi-Byte Character Set
i
;
\
;
,
OK
Cancel
Help
ZJ Platform: JActive(Win32)
Configuration Manager..
Warning Level
Select how strict you want the compiler to be about checking for potentialy
suspect constructs. (/WO - /W4)
Cancel
Apply
Help
i
:
j
526
, .
, . , .
.
, ,
. ,
, . , " ". Visual C++ : Debug
() Release ()
, .
:
;
#def ine _DEBUG;
/
MFC;
.
Visual C++ _DEBUG .
ASSERTw TRACE
ASSERT () , . , lpObject. ,
, . ASSERT, :
ASSERT(lpObject)
, , ASSERT, FALSE,
,
14.
527
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
!ra_wndStatusBar.Setlndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
//
:
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
const
CMDIFrameWnd::AssertValid();
, . .
AfxCheckError. ,
SCODE, OLE
MFC .
AfxCheckMemory. , Output ().
.
, .
AfxEnabieMemoryTracking. MFC.
, .
530
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
,
:
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&) ;
534
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
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
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] ;} ;
SomeClass SoroeFunccion(J
SoweClass
SomeClass
= A;
return
A;
;
_J
J ^ Samples
Visual C++ Samples
Enterprise Samples
void OtherFunction()
SomeClass
Vatje
A * SorneFuncxion() ;
Type
_J f^"ug
zl
. 1 4 . 1 4 . Output
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
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
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
(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?
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.
Finish
Cancel
Help
15.
545
lpParent = CWnd::FromHandle(hwParent);
myDlg.DoModal();
MFC . OnDig
, , ,
.
MFC
MFC
, MFC, MFC (MFC extension DLL's)
546
#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);
//
DllMain
DllMain
548
, ,
( ). . 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
II
//
AfxSetResourceHandle(::GetModuleHandle("MyLib.dll")};
CString szString;
szString.LoadString(IDS_SOME_RESOURCE);
//
AfxSetResourceHandle(::GetModuleHandle(hlnstance) ) ;
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
.
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
:
.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.
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.
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:
Browse...
f Close Solution
OK
Help
Cancel
| ( Qnjsh jj
Cancel
Help
15.
557
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
' ATL Sm
i pe
l
Obe
j ct
M^
Fife
MFC Ca
lss
From Activ...
ATL Server
Web Service
Cancel
Open
Help
ili
.hfe
li :
A
e
(pc
ucb
c
is
ls:
" Tj
file:
Fn
isih Cancel
Help
558
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
// ( )
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
{
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 );
= 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];
562
12. Library.def,
.
13. 15.3.
| 15.3. Library.def
MFC
MFC Extension ,
. MFC:
1. File | New | Project ( | | ), <Ctrl>+<Shift>+<N> New Project
( ) Standard ().
New Project ( ).
2.
15.
3.
563
Application Settings ( ),
DLL Type ( )
MFC extension DLL (
MFC) Finish ().
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
564
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.
.*'
Base class:
.HTM file:
jCWnd
~Z3
.H file:
(
Automation;
r
None
Automation
Creatable by type ID
.CPPfile:
V Active accessibility.
Finish
Cancel
Help
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.
Access:
* Control variable
Variable type:
I bool
13
Variable name:
Finish
Cancel
Help
15.
567
..
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
| 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;
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
m_lpArray;
delete
m_Median;
m_lpArray
m_Median
szText
= new int[Aperture];
= new Median<int>( Aperture );
= "O\r\n";
m_lpArray[O]
= 0;
m_lpArray[i]
szText
=0;
+= "0\r\n";
//
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;
_]
Configuration Manager..
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
572
J*J
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.
573
JExtensionProperty Page*,'
Configuration: JActive(Debug)
A
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
' Resources
CJMIDL
Additional Dependencies
! Specifies additional items to add to the link line (ex: kernel32.lib);
' configuration specific.
OK
Cancel
Apply
Help
574
,
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.
575
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
576
(Environment Variables
84'
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
j Path
OK
Cancel |
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
idi
( Config.sys Autoexec bat | System mi | Win.ini j j
Autoexec bat.
""
OK
. 15.18. Autoexec.bat
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
I Output Directory
; Specifies a relative path to the output file directory; can include environment
! variables,
Cancel
Help
15.
579
PATH, ,
.
:
1. Class View ( ),
Extension () Properties (). Extension Property Pages ( ).
2.
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.
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
Cancel
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
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
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
, 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
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
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
590
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 _
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
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
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
>
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...
zl
Hep
l
Cancel
Open
Base class:
jcWnd
.HTM file:
i]
Automation:
a
None
Automation
,H file;
C G eatable by type ID
.CPP file:
Active accessibility
Finish
Cancel
Help
16. Internet
593
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
34. OnConnectMakeconnection
16.1.
//
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();
[Connection ^
Enter URL
[http: //www, mcp.com
OK
;|
Cancel |
. 16.6. Connection
38. Enter URL ( URL) Web-
HTML .
,
. 16.7. ( ,
HTML.)
596
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">
. 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
.
,
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();
//_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*
File
Build
Crystal Reports - Insert
Crystal Reports - Main
WebReadView.cpp
OnBnClicbedStart
Data Design
4 * fi'
Database Diagram
Debug
Debug Location
Design
Dialog Editor
Diff-Merge Viewer
Formatting
Full Screen
#include
<afxinet.h>
#melude "URLDlg.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
j CWebReadVe
iw VCCodeCals
(
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:
Help Filter:
Show Help:
1
1
At
Startup:
1
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
_^
HH
~^ C^ ^
;.
Start Page
'
J
d f Properties | Q l> /
. 2.3.
Mi 1'
_^
620
IV.
Visual C++,
,
. ,
Visual C++. , , .
, ,
. ,
.
.
, :
1. .
2. .
.
2. Visual C++
621
3. .. 1 2 ,
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
5. Toolbars ( ).
.
6. Close ().
:
1. , .
2. Tools | Customize ( | ). Customize ().
3. Commands (). Customize () , . 2.5.
4. , .
5. .
IV.
622
Keyboard.,,
Close
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
Open File
File | Open
Save
File | Save
Save All
Cut
Edit | Cut
Copy
Edit | Copy
Paste
Edit | Paste
Undo
Edit | Undo
Redo
Edit | Redo
Navigate Backward
Navigate Forward
Start
Debug I Start
Find in Files
Solution Explorer
Properties Window
Toolbox
View! Toolbox
Class View
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
* I I WebReadVtew h |
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
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) ;
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
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:
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
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
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
Cancel
Help
,
, .
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
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
, ,
.
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
,
. ,
. ( ,
).
2. Visual C++
631
Loot in:
History
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
: , , Open ().
,
. Visual C++ .
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.
,
.
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 [" 1
Cancel -
I Advanced Save o S ^ S
^ ^ ^ ! ! ! !
.,:.:
ill
Encoding:
[ (Windows) - Codepage 1251
Line endings:
Current Setting
[
OK
jj
Cancel
Help
. 2.18.
Advanced Save Options
IV.
634
. , .
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
, , , . .
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
. Number of copies
OK
Cancel
. 2.20. Print
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
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
appli.i-ar.ior,
Ctrl+
_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
Ctrl+G
Advanced
plii[ie,.i,.d.
Bookmarks
Outlining
l(J
r.
"J^i
TmApp
IntelliSense
> :
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] 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
-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
., 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 ().
2. Visual C++
639
Debuq
t -
"
p
1
Lut
_
]
Fa*re
< j.\f lipboard Ring
p_elete
Select All
Go To...
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
j General
'
( i
Comment
CAbnutDIg
.
C++
Output | 1J
fi* Properties [ Q
Item(s) Saved
Ln 101
Cols
Ch8
Find what:
*] _ J
Match case
S e a r c h
Replace
Current document
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
|_5
Find what:
Match case
Beginning of line
$ End of line
< Beginning of word
> End of word
\n Line'break
. 2.25.
|
Find what:
Repjace with: |
Bnd Next
Replace
Search
( Current document
1 f" All open documents
<~ flection only
Use; I . ,
Replace All
Mark All
Close
Help
. 2.26. Replace
, Find (), . -
IV.
642
Find
* Match case
Replace
Look in:
Current Project
* Look in subfolders
File types:
Close
j*.*
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 " . ' :
--
txt(Bl)
hip\HTML
txt(85)
hlp\HTHL.hhc
t p 6 )
r e s o u r c e file HTr- J
hhp
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
"' # ' ^ ^ ^ ^ 1 1
Find what:
Repjace with:
m_nAperture
* Match case
Look in;
Use:
xl
Replace
Replace All j
Current Project
Find Next j
Skip File
Close
Help
^3
~ Look in subfolders
**
File types:
'J
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 case
Close
Help
. 2 . 3 1 . Find Symbol
, , , , , ,
, , , .
Find Symbol Results ( ), . 2.32.
:
Find what () , .
, ;
IV.
646
Look in ( ) , , .
:
Active Project ( )
, ;
Selected Components ( ) , ,
, , :
Browse
(). Selected Components
( ), . 2.33. , , ;
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.
Cancel j
. 2.34. Go To Line
*
. ,
.
IV.
648
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
Cancel
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
- ,4 OnBnClickedStart
WebReadView.h |
*
(
cu.
O * ( Sou
l to
i n Expo
l rer - WebRead
l]*i Cop,-
Qrl+C
13%
Ctrl+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
. 2.36. Advanced
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
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
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
Ctrl+M, Ctrl+L
StQE Outlining
Ctrl+M, Ctrl+P
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;
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
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;
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 -
H,
(Name)
Comment
\ Task List f
CAboutDlg
CAboutDlg dialog -
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 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
';
[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
'J 1 CHTMLApp
Sirndef AFXMIN_H
#ert:ui: include 'stdafx.h' before including this file or PrH
ftendif
^include "resource.h"
'/
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
;
cti
Delete
Select All
+rhft+/
Del
+ 1
;.h'
before
including
this
file
for
Boctaarfa
InteBiSense
H I !
I L D L
c p p
_ j Head-, Files
_ J hildFtrn h
J HTJ1L h
^ ^ luti
JinApp
t--.<
>
-50'
. ,.}
Outlining
| CHTMLApp VCCDdeClass
<_! _ , ..
I ,, Oescp
io
tir,
:<|
Ready
_ ^ ]
Ctrl+G
J hildFtrn cpp
_3 HTM pp
Ctrl+A
Go To...
"~.
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
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
[CHTMLApp VCCodeClass
~3
CHTMLApp
CHTMLApp: DSee
& Properties | Q
77
26
Ch23
::
: INS
. 2.46.
View
View (), . 2.47, ,
,
.
View / Open
>
,
Solution Explorer ( ) Class View
( ).
658
IV.
^ 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
(Name)
9X
J
4
!
FindPesub 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
File.
] r a
Prop t spender
J
2] 1 'i i
"Ready
* A'ebFcad epp
_^] WebReadDoc Lf p
"-bF^ad
2. Visual C++
659
^ 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
-
,. |
IV.
660
. , , ,
. 2.52 .
.. WebRead - Microsoft Visual C++ [design]-WcMt
gfoe
j ct gud
li Bebug lools Wnidow Hep
l
71
4 X
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
::
--
- 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.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
ji
^ Pointer
Q Button
Combo Box
j Acceleiator
_ J Icon
List Box
_ J dialog
3 ] I0D_A60UTBC [Er
3 ] IDD_URLDLG
>
- 5 P WebRead
- _ J WebRead re
Dialog Editor
] Menu
S| IDR_MAINFRAME [E
J RT_MANIFE5T
Picture Control
' Properties
[TDOURLDLG (Dialog)
[jT] *i [] / r j
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
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
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
JLJ
Ctrl+Alt+K
Alt+F8
Shrt+Alt+Enter
^ f';' J>
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
& Propeities |
: Ln25
Col 56
Ch 53
1 j
INS
View\ Toolbars
, , . 2.56.
, , , .
2. Visual C++
663
_ jflj
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
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)
(Name)
i Sets/returns the name of the object
E g Properties |
Ln25
CWebReadView
jH
Col 56
I T H. Ir
Ch53
INS
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+-
"
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
. 2.57.
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
| 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
Bebug
Jods
T l T
< *j
i r>bug
~"
Ctrl+5Nft+A
H'ndow
SI- ft+Alt+A
:
SReJ
UnloadPralKt
-, , n P r c e d
LoadSt^
Add WebRefermcf
CBultij|a properties
pDocTeiipraoc
New Folder
"1%
AssertValid
"
\i
<
'
'n
ne-^nuixi-iis-re,i,jrin:ce(ir
RUWTIE_CLAS3(CHTHLBoo) ,
RJTIME_CLAS3 (CChildFremie) , / : cu:^tatr
RUNTIHE_CLAS5(CHTHLVie) ) ;
AcUiDocTemplate (pDocTemplata) ;
;
:
[i
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
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. Visual C++
667
Return type:
Function name:
Parameter type:
Parameter name;
Parameter list:
Add
Access:
(public"
Implementation file:
~3
Jhtml.cpp
mime
Finish
Cancel
Help
Access:
Variable type:
(booi
Variable name:
"J
Fn
is
ih
Cancel
Hep
l
IV.
668
New
Import...
Qjstom...
Cancel
, ,
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. Visual C++
669
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
, .
, . ,
, Visual Studio.NET.
,
,
, . Visual Studio.NET , .
IV.
670
, , . ,
.
Reload Project ( ).
Available references:
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
( ).
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...
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 () , .
IV.
672
, ,
. , Visual
Studio.NET (, ,
).
Build / Clean
, ,
. , ,
Rebuild () , .
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
(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
, .
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
ygndou
OnBnCklrkedStart
4)
I .Ll,...
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
'
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 / Restart
. . .
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
Id
HTML.exe
968
| Title
HTML
| Machine
HOME-DS5AF...
| Port
Default
. 2.72. Processes
Debug I Exceptions
Exceptions
(), . 2.73.
, - ,
.
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
:
End...
Clear All
Add...
<
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 / QuickWatch
QuickWatch
( ), . 2.74.
,
Expression (). Add Watch
( ) Watch ().
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)
OK
Cancel
Help
2. Visual C++
679
Save Dump As
Save jn:
xj
Q j WebRead
tn
., - Tools-
_J Debug
res
History
My Projects
Desktop
Favorites
j Myy Network
Places
Save
Cancel
I
'-
,
.
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
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
2. Visual C++
681
' JSl
'
"
~~
OK
Cancel
Help
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
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.,.
11
ActionBvr Class
e
Language:
Unknown
Version:
1.277
Browse..,
Reset
Help
Description:
OK
Cancel
J _ J ! * J
. 2 . 8 1 . Add-in Manager
,
. , ,
, .
2. Visual C++
683
Browse,..
~ Add to Favorites
Cancel
Help
Fils dit Ve
i w Project Build Debug Toosl Wn
idow HeP
'
i
Debug
l-s and betmgs\Nick\My Oocum
C5
'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.
| -
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;
';
^dd-inManaget
Euiid Comment Web Pages
Macros
Run TemporatyHacro
Cbl+Shft+P
Qrl+Shft+R
Create GUID
Save TemporaryMacro
!API
iDo'
L.
Error Lookup
DECLiRE_HESSAGE_HAP;
C S t x i n g m^UPL;
Macro Explorer
Macrgs J_DE...
Spy+
Create UID
txctemalTools...
Output
Customize,..
{{Debug
aded 'B:\WIH!
Qpttons...
D Output | 5 1
. 2.84. Macros
,
,
VBScript.
2. Visual C++
685
*&'
f 3 . ' ! U , *?
R m
Macro.]
GUID Format
i f I IMPLEMENT_OLECREATE(...)
"
---;
// {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
, , Value
().
. Process
| Trace level
! 9 Enabled
Category Si Function Narmes
File Name & Line No.
2. Visual C++
687
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-
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.
.
Microsoft. .
IV.
688
n|%|ol rs %\ ;-| -| I Ml I
0001000C "" 27 [Desktop)
"
"
~
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
[Ide:
Command:
Arguments:
nitial directory;
Cancel
'
!~
I
Help
. 2 . 9 1 . External Tools
2. Visual C++
689
Tools / Customize
Customize
(), . 2.92.
Reset...
Keyboard... | [
Close
. 2.92. Customize
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
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 I Split
, , , . 2.95.
, ,
.
2. Visual C++
691
11 1 ic
d IX
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
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
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
.- Ai
p*f - y fjf 4
(Name)
Comment
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 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
() . , , ( ).
,
. ,
, .
2. Visual C++
693
f [design! 1 )
Fie
E*
View
Project
&jld
Debug
Tools
Wmi
Hefc
'
1*;
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
/.''
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
,
.
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
* Propertcs | Q ' n r ^ h - l
';
- Ln 1
Coil "
Ch 1
INS
. 2.98.
. , , .
, .
2. Visual C++
695
1 x|
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;
zl.
J.-, ~-\
|Debug
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.
. , , .
, .
. 629
IV.
696
Window () ,
.
, , .
Window |
Windows ( | ).
Windows
, .
.
Window / Windows
Windows (),
. 2.100.
Name
HTMLcpp
HTMLDoc.cpp
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
jj>
bckedStart
Ctrl+Alt+Fl
Shift++F2
S*t**
+ A f t + F 3
CURLblg
*f Descrption
()
Sets/returns the name of the object
P) Task Ust [ D
Ready
. 2 . 1 0 1 . Help
*J
IV.
698
Help / Contents
Contents
(), . 2.103. Show Help ( ) Visual Studio.NET
. , , -, .
> Visual studioMT Combined -
Contents
Filtered by
Visual C++and Related
'!
*'
4 X
+ ^ 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
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
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)
ft...
Ready"
. 2.104. Index
Help I Search
Search ().
, Contents (),
.
,
Contents ().
Visual Studio.NET.
. 2.5.
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
Filtered by:
iVisua! C++ and Related
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
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
. 2.105. Search
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
]'"'"
'-
+
-
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
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
,
, .
, , ,
, - .
(protected) ,
(private) .
, . 2.8.
:
Build () ,
. , ;
D Rebuild ( ) .
, ;
Clean () , . , ;
Link () .
, ;
Go to Definition ( ) : -
2. Visual C++
703
, , ,
;
"+
+
;
1
+
+
Rebuild
Clean
+ =* M
+
i
|
3? -1
Add
^ ^|
1
+
**CWe1^
>
Save WebRead
Sort Alphabetically
j
|
| {$ Group By Type
-,- Properties
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
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:
yne:
[~~
Character: j l
Condition...
Hit Count...
Program:
(no condition)
break always
[304] HTML.exe: Native
Cancel
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.
, , , .
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
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
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
():
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
> ;:
[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