.


:




:

































 

 

 

 


.

1. .

 

:

  1. Windows32 .
  2. ++ Visual C++ 6.0, VS.NET VS2005.
  3. Win API32. .

 

:

 

  1. :

 

, .

, 400 200 .

. ( ) .

 

  1. --- .

:

1

2

3

, .. ASCII .

txt, htm, html, php.

<!--start_bwc-->, - .

:

<!--start_edit type="####" name="$$$$$" body=%%%-->

:

#### - , :

- shorttext

- longtext

- image

$$$$$ - ,

%%% - , .

3 :

    1. .

type=shorttext

body ()

    1. .

type=longtext

body

    1. BMP

type=image

body , "img\1a.bmp"

. , .

(body) shorttext longtext. ( ) .

 

  1. ( 1), . ( Hotkey - ):

- (Ctrl+D)

- (Ctrl+S)

- (Alt+F4)

- (Ctrl+C)

- (Ctrl+X)

- ( ) (Ctrl+V)

- / (Ctrl+Z)

-

 

  1. Toolbar ( 2) :

-

-

-

-

-

- ( )

- /

 

  1. . .

) shorttext ( 3) ( A) [ ] ( B) [].

) longtext ( 4) ( A) [ ] 4-6 ( B) [].

) image ( 5) ( A) [ ] , ( B) [ ].

shorttext longtext . ( B) .

 

  1. .

, () toolbar ( ).

, .

, . .

, .

.

.

.. ( ) .

.

() .

( ).

 

  1. , scrollbar ( 7). , ( ).

 

 

.

  1. .

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).

 

  1. . , .

File Item ().

, FileList ItemList

.

. , File .

, File ( ) .

 

  1. .

: _findfirst _findnext , _finddata_t.

, .

, Name _finddata_t ( : fopen, fgets strstr).

 

  1. .

(, ) strstr.

. :

- .

-

 

  1. .

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.

 

  1. .

: . :

-

-

, 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.

 

  1. .

.

& . .

(, resource.h). , .

, , - WM_COMMAND - . , . , Hello, World!.

 

  1. 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 .

 

  1. 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) .

 

  1. .

RegCreateKeyEx. HKEY_CURRENT_USER (. ).

RegOpenKeyEx.

RegSetValueEx.

RegQueryValueEx.

 

  1. .

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 .

, , , ( ).

 

  1. . API GetOpenFileName , OPENFILENAME.

 



<== | ==>
. |
:


: 2018-11-10; !; : 154 |


:

:

,
==> ...

994 - | 936 -


© 2015-2024 lektsii.org - -

: 0.067 .