Азбука программирования в Win32 API


Азбука программирования в Win32 API - стр. 178


static HWND hTreeChild;

static HTREEITEM hParentltem;

switch(Message)

{ case WM_CREATE:

GetC'licntRcct(hWnd, &Rect);

hTreeChild = CreateWindow(WC_TREEVIEW,"",

WS_VISIBLE | WS_TABSTOP j WS_CHILD |

TVS_HASLINES | TVS J.INESATROOT |

TVS_HASBUTTONS | WS_DLGFRAME,

0, 0, Rect.right, Rcct.bottom,

hWnd,

NULL,

hlnst,

NULL);

InsertStruct.item.mask = TVIF_TEXT;

InscrtStruct.item.hltem = NULL;

InsertStruct.item.pszText = "Registry Keys";

InsertStruct. item. cchTextMax = 14;

InscrtStmct.hParcnt = TVI_ROOT;

InsertStruct.hlnsertAfter = TVI_LAST;

hParentltem = TreeView_InscrtItem(hTreeChild, &InsertStruct);

FillTrce(hTreeChild, hParentltem);

TreeView_Expand(hTreeChild, hParentltem. TVE_EXPAND);

TreeView_SclcclItem(hTreeChild, hParentltem);

return 0; case WM_SIZE:

Move\Vindow(hTreeChild, 0. 0, LOWORD(lParam), HIWORD(lParam), TRUE);

return 0; case WM_DESTROY:

PostQuitMcssage(O);

return 0;

!

return DeAVindovvProc(hWnd, Message, wParam, ll'aram);

214

void FillTrce(HWND hTrceWnd, HTREEITEM hParentltem) {

ULONG i; TVJTEM Item;

TVJNSERTSTRUCT IiisertSmict; LPSTR IpszKeysf?] •--= {"HKEY CLASSES ROOT",

"HKEY~CURRENf USER",

"HKEY" LOCAL_MACHINE".

"HKEYJJSERS",

"HKEY PERFORMANCE_DATA",

"HKEY CURRENT_CONFIG",

"HKEY  DYN_DATA"j; char cClass[80] - ""; DWORD dwSizc ~ 80, dwSubKeys, dwMaxLength, dwMaxClass, dwValucs,

(IwMaxValuc, dwMaxData, dwSec; FILETIME ItFilcTime; HTREEITEM hNewParentltem;

for(i - hKcyMin, i <-•' hKeyMax; i-i-~)

// Add the highest items

illERROR^SUCCESS -=-- RegQiierylnl'oKeyffHKEY) i, cClass, &dwSizc,

NULL.

&dwSubKeys, &dwMaxLength, &dwMaxClass, &dwValues, &dwMaxValue, &dwMaxData, &dwSec, &ftF)leTime))

Uem.mask = TVIFJTEXT;

Itcin.pszTcxt - lps/Keys[i - hKcyMin];

InsertStruct.item ~ Item;

InsertStruct.hParcnl = hParentltem;

hNewParentltem = TreeView_Insertltem(hTrecWnd, &InsertStruct);




Начало  Назад  Вперед



Книжный магазин