1. .
:
- Windows32 .
- ++ Visual C++ 6.0, VS.NET VS2005.
- Win API32. .
:
- :
, .
, 400 200 .
. ( ) .
- --- .
:
1
2
3
, .. ASCII .
txt, htm, html, php.
<!--start_bwc-->, - .
:
<!--start_edit type="####" name="$$$$$" body=%%%-->
:
#### - , :
- shorttext
- longtext
- image
$$$$$ - ,
%%% - , .
3 :
- .
type=shorttext
body ()
- .
type=longtext
body
- BMP
type=image
body , "img\1a.bmp"
. , .
(body) shorttext longtext. ( ) .
- ( 1), . ( Hotkey - ):
- (Ctrl+D)
- (Ctrl+S)
- (Alt+F4)
- (Ctrl+C)
- (Ctrl+X)
- ( ) (Ctrl+V)
- / (Ctrl+Z)
-
- Toolbar ( 2) :
-
|
|
-
-
-
-
- ( )
- /
- . .
) shorttext ( 3) ( A) [ ] ( B) [].
) longtext ( 4) ( A) [ ] 4-6 ( B) [].
) image ( 5) ( A) [ ] , ( B) [ ].
shorttext longtext . ( B) .
- .
, () toolbar ( ).
, .
, . .
, .
.
.
.. ( ) .
.
() .
( ).
- , scrollbar ( 7). , ( ).
.
- .
Visual C++.
Menu -> File -> New -> Projects -> Win32 Application
.
A Typical Hello, World! Application.
VS.NET VS2005
Menu -> File -> New -> Projects -> Win32 Project
.
, Application Settings Empty Project
FileView Source Files :
xxx.cpp
StdAfx.cpp
xxx.cpp , .
StdAfx.cpp StdAfx.h
|
|
Resources
xxx.rc
xxx.rc ( ResourceView)
FileView Header Files :
xxx.h
resource.h
StdAfx.h
xxx.h ; .
resource.h , , ( )
, . . .. yyy.cpp yyy.h . .
yyy.cpp . :
#include "stdafx.h"
Rebuild All.
InitInstance InitCommonControls, ComCtrl, .. . Common Controls , .
- . :
#include commctrl.h
- Linker ( Command Line)
comctl32.lib
Common Control , H Common Control , . , , InitCommonControls, , , InitCommonControls ( , InitCommonControls).
- . , .
File Item ().
, FileList ItemList
.
. , File .
, File ( ) .
- .
: _findfirst _findnext , _finddata_t.
, .
, Name _finddata_t ( : fopen, fgets strstr).
- .
(, ) strstr.
. :
- .
-
|
|
- .
TreeView Control.
: CreateWindowEx WC_TREEVIEW
, ( ), (RegisterClass, UnregisterClass), (CreateWindowEx) -.
. : ImageList_Create, LoadImage, ImageList_Add, DeleteObject.
. ( ):
WM_NOTIFY TVN_SELCHANGED ( TVC_BYKEYBOARD TVC_BYMOUSE, NM_TREEVIEW, lParam ) NM_DBLCLK ( NMHDR, lParam ) , , WM_SIZE.
, NM_TREEVIEW NMHDR -.
(SendMessage) TVM_INSERTITEM -. TV_INSERTSTRUCT TV_ITEM.
( ), TreeView_SetItem.
: TreeView_DeleteItem
: TreeView_DeleteAllItems
TreeView_SortChildren.
TreeView_SelectItem.
:
TreeView_GetNextItem TreeView_Expand.
- .
: . :
-
-
, CreateWindowEx "STATIC" SS_SIMPLE, WM_SETTEXT.
shorttext Edit ( CreateWindowEx EDIT ES_MULTILINE). WM_SETTEXT.
longtext Edit ( CreateWindowEx EDIT ES_MULTILINE). WM_SETTEXT.
Edit ( ) SetWindowPos.
- ( CreateWindowEx BUTTON BS_BITMAP BS_FLAT)
BMP LoadImage, ( ) DeleteObject.
BM_SETIMAGE.
SetWindowPos.
DestroyWindow.
- .
.
& . .
(, resource.h). , .
, , - WM_COMMAND - . , . , Hello, World!.
|
|
- Toolbar.
Toolbar Windows, .
CreateToolbarEx ( CCS_ADJUSTABLE). TBBUTTON, (.. Toolbar ) Toolbar .
Toolbar .
, flat Toolbar ( , ), TBSTYLE_FLAT, WM_NOTIFY, NM_CUSTOMDRAW. dwDrawStage LPNMTBCUSTOMDRAW ( lParam) CDDS_PREERASE Toolbar ( GradientFill) CDRF_SKIPDEFAULT ( ). , Toolbar .
, - . Toolbar TBSTYLE_TOOLTIPS. WM_NOTIFY, TTN_NEEDTEXT. lpszText LPTOOLTIPTEXT ( lParam) . hdr.idFrom .
- Scrollbar ( ).
Scrollbar Windows, .
WS_VSCROLL.
. SetScrollInfo . SCROLLINFO.
WM_VSCROLL, SB_TOP, SB_BOTTOM, SB_LINEDOWN, SB_LINEUP, SB_PAGEDOWN, SB_PAGEUP, SB_THUMBPOSITION, SB_THUMBTRACK. :
- (. .6)
- SetScrollPos
- : UpdateWindow
. WM_KEYDOWN. wParam. VK_PRIOR VK_NEXT (PgUp PgDwn) .
- .
RegCreateKeyEx. HKEY_CURRENT_USER (. ).
RegOpenKeyEx.
RegSetValueEx.
RegQueryValueEx.
- .
Edit . , , Toolbar, ( ). Edit WM_CUT, WM_COPY, WM_PASTE, . . IsClipboardFormatAvailable CF_TEXT.
, Edit CR (13) NL (10). ( t fopen) CR,NL NL. . . ( b fopen) CR,NL EDIT .
|
|
, , , ( ).
- . API GetOpenFileName , OPENFILENAME.