Tutorials to .com

Tutorials to .com » Software » Asm » WIN32 compilation: 19. Tree view control

WIN32 compilation: 19. Tree view control

Print View , by: iSee ,Total views: 23 ,Word Count: 5212 ,Date: Wed, 6 May 2009 Time: 8:28 PM

19th class tree view control


This lesson, we will learn how to use the tree view control. In addition, learn how to be completed in the tree view drag - pull action, as well as a list of how to use the images.

Theory:

Tree view is a special type of window, we can use it at a glance that the relationship between a certain level. For example, as in the left Explorer window is the tree view. You can call CreateWindowEx to create a tree view, pass a class name "" SysTreeView32 "", or you can put it to a dialog box. Do not forget to add your code InitCommonControls function.
There are several unique tree view style. The following are several frequently used.
    TVS_HASBUTTONS == displayed in the parent project (+) or (-). Users can click on the symbol to expand or put away the sub-project under the parent. If you want to in the root directory there is such a symbol must be specified TVS_LINESATROOT style.
    Level used in TVS_HASLINES == lines to connect the name of each item.
    TVS_LINESATROOT == in the root directory of the project also used wire connection. If you do not specify TVS_HASLINES style, the style will be ignored.
Like other common controls, the tree view to complete the communication with the news. Father of a series of window messages sent to the tree view, tree view and send "notification" message to its parent window. In this regard, the tree view and other common control is no different.
When the time of the incident, send a tree view of the parent window WM_NOTIFY news and information included in the transmission of additional information.
    WM_NOTIFY
    wParam == control ID. Because the value is not the only, so we do not have it. We use the NMHDR structure hwndFrom or member variables IDFrom.
    point lParam == pointer NMHDR structure. Some may send a control point to a greater point of the target structure. However, the structure must ensure that a member of its first variable is a variable type NMHDR. In this way, you lParam variable in dealing with, at least can get a variable type NMHDR.
Now we look at NMHDR:
    NMHDR struct DWORD
    hwndFrom DWORD?
    idFrom DWORD?
    code DWORD?
    NMHDR ends
WM_NOTIFY message is sent hwndFrom control window handle.
idFrom message is sent WM_NOTIFY control ID.
code is sent to the parent window control data.
Tree view sent to the parent window notification message to the head TVN_. Tree view of the information received to the head TVM_, such as: TVM_CREATEDRAGIMAGE. Tree view TVN_XXX Send message Add variables in the code variable NMHDR. Send news TVM_ parent window to control the tree view.

In the tree view to add items

In the tree view created after TVM_INSERTITEM news by sending items to be added to the.

    TVM_INSERTITEM
    wParam = 0;
    lParam = point of indicators TV_INSERTSTRUCT structure;

    You should be aware that some information on the project tree view the relationship between the number of terms. A project may be a father, son or both. Contains a sub-item under the parent and the father of the project there may be other sub-projects. The father of a project called the root of the project item. In the tree view in the project may have multiple root. Now we take a look at the structure TV_INSERTSTRUCT:

    TV_INSERTSTRUCT STRUCT DWORD
    hParent DWORD?
    hInsertAfter DWORD?
    ITEMTYPE <>
    TV_INSERTSTRUCT ENDS
hParent = parent item handle. If the value of TVI_ROOT value or NULL, the item inserted in the tree view of the roots.
hInsertAfter = should be inserted in the project from behind the handle or the following value:
  • TVI_FIRST ==> inserted in the list of the head.
  • TVI_LAST ==> inserted in the tail of the list.
  • TVI_SORT ==> Insert in alphabetical order.
    ITEMTYPE UNION
    itemex TVITEMEX <>
    item TVITEM <>
    ITEMTYPE ENDS
We use only TVITEM.
    TV_ITEM STRUCT DWORD
    imask DWORD?
    hItem DWORD?
    state DWORD?
    stateMask DWORD?
    pszText DWORD?
    cchTextMax DWORD?
    iImage DWORD?
    iSelectedImage DWORD?
    cChildren DWORD?
    lParam DWORD?
    TV_ITEM ENDS

According to the structure type, used to send or receive on a tree-view project information. For example: For information TVM_INSERTITEM, it is used to specify tree-view control to insert the attributes of the item. As for the news TVM_GETITEM, the structure used to fill the information on the selected items.
imask used to designate those members of TV_ITEM effective variables. For example, if the designated TVIF_TEXT, which means that members of pszText variable is valid. You can specify a number of flag bits at the same time.
hItem is the handle of the tree view item. Each item has its own handle, like the same window. If you want to operate a project, it must choose its handle.
pszText is a string pointer. It is a project of the label name.
cchTextMax only the names in the query to use. Therefore, you must give the value.
iImage and iSelectedImage used to specify a list of images, as well as an index number. This will know when the item is selected or not selected which images to use to express the project. As the left side of Explorer folder window is a small chart of these two parameters are determined.
In the tree view to insert an item, you must configure at least hParent, hInsertAfter, you have to set another imask and pszText value.

Add graphics to graphics view

If you want to show the names of the left icon, you must create a graphical list, and view it and the tree is associated with. ImageList_Create you can call to create a graphical list.
    ImageList_Create PROTO cx: DWORD, cy: DWORD, flags: DWORD, \
    cInitial: DWORD, cGrow: DWORD

If the creation is successful, the function returns an empty image list handle.
cx == in pixels the width of the image.
cy == pixels in the image height. Image list of each piece must be the same height. WINDOWS otherwise your images will be cut, if too large, then may be cut into several pieces. Therefore, you must specify the image of the same size.
list of designated flags == image color depth of images. Details please refer to Guide to WIN32 API.
cInitial == specify the number of images included. WINDWOS will be allocated accordingly to the appropriate memory.
cGrow == add a new image in an increase in the number.

Image is not window list. It is only kept in the window to the other resources used. After the image list, you can call to them to join ImageList_Add image.

    ImageList_Add PROTO himl: DWORD, hbmImage: DWORD, hbmMask: DWORD
If the function call fails, return -1.
himl == image list handle. It is a call to return ImageList_Create value.
adding hbmImage == bitmap image list handle. You can usually save the bitmap in the resources, and then call it LoadBitmap to come in to load. Note you do not need to specify the bitmap contained in the number of images. WINDOWS will be based on its size, automatically calculate.
hbmMask == mask bitmap handle. If you do not use the mask bitmap, the value can be ignored. Normally, we join the two images to the image list. A time when he was selected to display images, and the other when not displayed when selected.
When the image list is ready, you can send a message to TVM_SETIMAGELIST tree list view to allow image linking and tree view.
    TVM_SETIMAGELIST
    wParam = image of the state list, a total of two kinds:
    • TVSIL_NORMAL contains selected and two states have not been selected image.
    • TVSIL_STATE contains the status of user-defined image.
    lParam = handle to image list.

Tree view of information retrieval

You can send a message to retrieve the graphical view TVM_GETITEM information.

    TVM_GETITEM
    wParam = 0
    lParam = point of indicators TV_ITEM structure. The structure will be used to obtain relevant information.

    Sending the message must be set before the members of the value of imask variables in order to be able to tell WINDOWS-related information. Of course, the most important thing is, you must pass the information you want to handle the project. This raises a question, how do you handle the project? Save all items to handle it?
    The answer is very simple: there is no need to. TVM_GETNEXTITEM You can send a message to the tree view to retrieve the properties you want to get the handle of the item. For example: You can query the first handle sub-projects, the root directory of the handle, the handle to select the item and so on.

    TVM_GETNEXTITEM
    wParam = sign
    lParam = tree view of the handle (only when the value of wParam is when some flag is necessary).
The value of wParam is very important, I explained as follows:
    • TVGN_CARET selected item
    • TVGN_CHILD hitem the first parameter specifies the sub-project project
    • TVGN_DROPHILITE drag - pull the purpose of operating the project
    • TVGN_FIRSTVISIBLE the first visible item
    • TVGN_NEXT at the same level the next item
    • TVGN_NEXTVISIBLE can be seen the next project, the project has to be specified can be seen. Send a message to decide whether TVM_GETITEMRECT can be seen
    • Father TVGN_PARENT projects designated projects
    • At the same level TVGN_PREVIOUS the previous item
    • Can be seen TVGN_PREVIOUSVISIBLE the previous project, the project has to be specified can be seen. Send a message to decide whether TVM_GETITEMRECT can be seen
    • TVGN_ROOT root item
From this you can by sending the message to handle the project, and then send a message TVM_GETITEM when the variables in the structure of the member variable TV_ITEM Add hItem in the handle of the project can be on the item of relevant information.

In the tree view to drag - pull operation

It is because this part of my classes before deciding to write this tutorial. When I InPrise in accordance with the company's help to run WIN32 example, it was found that the lack of help it really important information. I can only do so through their own experiments to find out months after the end of reason. I hope you do not go away, like me, these detours, I know I put the following in the tree view to drag - pull operation steps described as follows:
  1. When the user to drag an item, the tree-view control parent window will send its message TVN_BEGINDRAG notice. Here you can create a drag that item in the operation of the image, which can be TVM_CREATEDRAGIMAGE by sending a message to the tree view, as currently used to generate a default image of the image to achieve. Tree-view control will create an image list, which contains only a drag show in the images, image list is created, you can handle it.
  2. Images generated in the drag, you can call ImageList_BeginDrag through drag images to specify the location of the hot spots.
      ImageList_BeginDrag PROTO himlTrack: DWORD, \
      iTrack: DWORD, \
      dxHotspot: DWORD, \
      dyHotspot: DWORD
      himlTrack is included in the image displayed when dragging the image list handle
      iTrack image is selected in the image index number in the list.
      dxHotspot because of the drag image is used to replace the cursor, so we must specify the image in the upper-left corner point is the location of the cursor. is the relative position of the level of dxHotspot.
      vertical relative position dyHotspot.
      iTrack equal to 0. If you have to drag the cursor hot spot in the images shown in the upper left corner, and dyHotspot to dxHotspot are set to 0.
  3. When dragging the image to show, we call ImageList_DragEnter in the tree view to display the image.
      ImageList_DragEnter PROTO hwndLock: DWORD, x: DWORD, y: DWORD
      hwndLock is dragging the handle of the window, drag and drop restrictions on the movement of the window.
      x and y is in the drag-and-drop images to display the coordinates of initial position. These values are relative to the upper left corner of the window rather than the client area of the upper-left corner.
  4. As can display images in drag, and we have to deal with the drag operation. Here there is a small problem. We monitor the drag is by monitoring the movement of the mouse cursor to achieve, such as in mobile WM_MOUSEMOVE when we catch the news to get the coordinates of the location of moving through the WM_LBUTTONUP capture user information to learn to lay down their operation. But then if the mouse cursor moved over the parent window when child window will not be able to get the mouse cursor movement and mouse button news. Solution is to call the lock function SetCapture mouse events, so no matter where the mouse to move and what moves the window we can know.
  5. In dealing with WM_MOUSEMOVE message, you can call to update the image of mobile ImageList_DragMove track. The drag and drop function to move the location of the image. In addition, if you want a moving image through a high measure of when certain items, it can be called TVM_HITTEST to determine whether an item above. If so, you can send messages and set TVM_SELECTITEM flag TVGN_DROPHILITE makes high-brightness display that item. Note: send a message in TVM_SELECTITEM, you'll need to hide list of images, otherwise they will leave a very bad track. To hide the image and drag can call ImageList_DragShowNolock, finished in high-brightness display image and then call the function so that the image and then drag in the normal display.
  6. When the user after the release of the primary key, you have to do a few things. If you are in the high-brightness display, when the release of the mouse primary key (that you want to add the item here), you must enable the project to become a regular show, which can send messages through the news and set TVM_SELECTITEM flag TVGN_DROPHILITE to achieve only then lParam must be to 0. If you're not high-brightness display the item back to normal, it will be a strange phenomenon occurred: When you choose another item, that item will be included in the image of a square, high-brightness display at the time the item is still on a project. Must call the next ImageList_EndDrag and ImageList_DragLeave. There ReleaseCapture call to release the mouse capture. If you create an image list, it would also like to call calling ImageList to be destroyed after the end of the drag and drop you can make the operation of the other other.

Example code:

.386
. model flat, stdcall
option casemap: none
include \ masm32 \ include \ windows.inc
include \ masm32 \ include \ user32.inc
include \ masm32 \ include \ kernel32.inc
include \ masm32 \ include \ comctl32.inc
include \ masm32 \ include \ gdi32.inc
includelib \ masm32 \ lib \ gdi32.lib
includelib \ masm32 \ lib \ comctl32.lib
includelib \ masm32 \ lib \ user32.lib
includelib \ masm32 \ lib \ kernel32.lib

WinMain PROTO: DWORD,: DWORD,: DWORD,: DWORD
. const
IDB_TREE equ 4006; ID of the bitmap resource
. data
ClassName db "TreeViewWinClass", 0
AppName db "Tree View Demo", 0
TreeViewClass db "SysTreeView32", 0
Parent db "Parent Item", 0
Child1 db "child1", 0
Child2 db "child2", 0
DragMode dd FALSE; a flag to determine if we are in drag mode

. data?
hInstance HINSTANCE?
hwndTreeView dd?; handle of the tree view control
hParent dd?; handle of the root tree view item
hImageList dd?; handle of the image list used in the tree view control
hDragImageList dd?; handle of the image list used to store the drag image

. code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke WinMain, hInstance, NULL, NULL, SW_SHOWDEFAULT
invoke ExitProcess, eax
invoke InitCommonControls

WinMain proc hInst: HINSTANCE, hPrevInst: HINSTANCE, CmdLine: LPSTR, CmdShow: DWORD
LOCAL wc: WNDCLASSEX
LOCAL msg: MSG
LOCAL hwnd: HWND
mov wc.cbSize, SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground, COLOR_APPWORKSPACE
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, OFFSET ClassName
invoke LoadIcon, NULL, IDI_APPLICATION
mov wc.hIcon, eax
mov wc.hIconSm, eax
invoke LoadCursor, NULL, IDC_ARROW
mov wc.hCursor, eax
invoke RegisterClassEx, addr wc
invoke CreateWindowEx, WS_EX_CLIENTEDGE, ADDR ClassName, ADDR AppName, \ WS_OVERLAPPED + WS_CAPTION + WS_SYSMENU + WS_MINIMIZEBOX + WS_MAXIMIZEBOX + WS_VISIBLE, CW_USEDEFAULT, \
CW_USEDEFAULT, 200,400, NULL, NULL, \
hInst, NULL
mov hwnd, eax
. while TRUE
invoke GetMessage, ADDR msg, NULL, 0,0
. BREAK. IF (! Eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
. endw
mov eax, msg.wParam
ret
WinMain endp

WndProc proc uses edi hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
LOCAL tvinsert: TV_INSERTSTRUCT
LOCAL hBitmap: DWORD
LOCAL tvhit: TV_HITTESTINFO
. if uMsg == WM_CREATE
invoke CreateWindowEx, NULL, ADDR TreeViewClass, NULL, \
WS_CHILD + WS_VISIBLE + TVS_HASLINES + TVS_HASBUTTONS + TVS_LINESATROOT, 0, \
0,200,400, hWnd, NULL, \
hInstance, NULL; Create the tree view control
mov hwndTreeView, eax
invoke ImageList_Create, 16,16, ILC_COLOR16, 2,10; create the associated image list
mov hImageList, eax
invoke LoadBitmap, hInstance, IDB_TREE; load the bitmap from the resource
mov hBitmap, eax
invoke ImageList_Add, hImageList, hBitmap, NULL; Add the bitmap into the image list
invoke DeleteObject, hBitmap; always delete the bitmap resource
invoke SendMessage, hwndTreeView, TVM_SETIMAGELIST, 0, hImageList
mov tvinsert.hParent, NULL
mov tvinsert.hInsertAfter, TVI_ROOT
mov tvinsert.item.imask, TVIF_TEXT + TVIF_IMAGE + TVIF_SELECTEDIMAGE
mov tvinsert.item.pszText, offset Parent
mov tvinsert.item.iImage, 0
mov tvinsert.item.iSelectedImage, 1
invoke SendMessage, hwndTreeView, TVM_INSERTITEM, 0, addr tvinsert
mov hParent, eax
mov tvinsert.hParent, eax
mov tvinsert.hInsertAfter, TVI_LAST
mov tvinsert.item.pszText, offset Child1
invoke SendMessage, hwndTreeView, TVM_INSERTITEM, 0, addr tvinsert
mov tvinsert.item.pszText, offset Child2
invoke SendMessage, hwndTreeView, TVM_INSERTITEM, 0, addr tvinsert
. elseif uMsg == WM_MOUSEMOVE
. if DragMode == TRUE
mov eax, lParam
and eax, 0ffffh
mov ecx, lParam
shr ecx, 16
mov tvhit.pt.x, eax
mov tvhit.pt.y, ecx
invoke ImageList_DragMove, eax, ecx
invoke ImageList_DragShowNolock, FALSE
invoke SendMessage, hwndTreeView, TVM_HITTEST, NULL, addr tvhit
. if eax! = NULL
invoke SendMessage, hwndTreeView, TVM_SELECTITEM, TVGN_DROPHILITE, eax
. endif
invoke ImageList_DragShowNolock, TRUE
. endif
. elseif uMsg == WM_LBUTTONUP
. if DragMode == TRUE
invoke ImageList_DragLeave, hwndTreeView
invoke ImageList_EndDrag
invoke ImageList_Destroy, hDragImageList
invoke SendMessage, hwndTreeView, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0
invoke SendMessage, hwndTreeView, TVM_SELECTITEM, TVGN_CARET, eax
invoke SendMessage, hwndTreeView, TVM_SELECTITEM, TVGN_DROPHILITE, 0
invoke ReleaseCapture
mov DragMode, FALSE
. endif
. elseif uMsg == WM_NOTIFY
mov edi, lParam
assume edi: ptr NM_TREEVIEW
. if [edi]. hdr.code == TVN_BEGINDRAG
invoke SendMessage, hwndTreeView, TVM_CREATEDRAGIMAGE, 0, [edi]. itemNew.hItem
mov hDragImageList, eax
invoke ImageList_BeginDrag, hDragImageList, 0,0,0
invoke ImageList_DragEnter, hwndTreeView, [edi]. ptDrag.x, [edi]. ptDrag.y
invoke SetCapture, hWnd
mov DragMode, TRUE
. endif
assume edi: nothing
. elseif uMsg == WM_DESTROY
invoke PostQuitMessage, NULL
. else
invoke DefWindowProc, hWnd, uMsg, wParam, lParam
ret
. endif
xor eax, eax
ret
WndProc endp
end start

Analysis:

WM_CREATE message in dealing with the code, you can create a tree view control.
    invoke CreateWindowEx, NULL, ADDR TreeViewClass, NULL, \
    WS_CHILD + WS_VISIBLE + TVS_HASLINES + TVS_HASBUTTONS + TVS_LINESATROOT, 0, \
    0,200,400, hWnd, NULL, \
    hInstance, NULL
Note: TVS_xxxx is a unique tree-style view.
    invoke ImageList_Create, 16,16, ILC_COLOR16, 2,10
    mov hImageList, eax
    invoke LoadBitmap, hInstance, IDB_TREE
    mov hBitmap, eax
    invoke ImageList_Add, hImageList, hBitmap, NULL
    invoke DeleteObject, hBitmap
    invoke SendMessage, hwndTreeView, TVM_SETIMAGELIST, 0, hImageList
Next, you can create an empty list of images, the image is based on the list to accommodate the size of 16x16 pixels and 16-bit depth images, the image contains two images, the initial list, the largest can accommodate 10. Then we load the image from the resources and put them to the list of images. Then we removed the image of the handle, because we do not need to re-use it. Image list is set up, we send messages through it and TVM_SETIMAGELIST tree view control link.
    mov tvinsert.hParent, NULL
    mov tvinsert.hInsertAfter, TVI_ROOT
    mov tvinsert.u.item.imask, TVIF_TEXT + TVIF_IMAGE + TVIF_SELECTEDIMAGE
    mov tvinsert.u.item.pszText, offset Parent
    mov tvinsert.u.item.iImage, 0
    mov tvinsert.u.item.iSelectedImage, 1
    invoke SendMessage, hwndTreeView, TVM_INSERTITEM, 0, addr tvinsert
The project is now inserted into the tree view control to, first of all, we started from the root. Because it is the root item, so the members of hParent variable is NULL, hInsertAfter is TVI_ROOT. TV_ITEM structure imask variables specified in the pszText, iImage and three members iSelectedImage the variable's value is valid. We should give the members of these three variables give the correct value. PszText which shows the name of the project, iImage is the image list index image, the image display is not selected in the left side of the project name, iSelectedImage item is selected the image index number. Set up these values, we send a message to TVM_INSERTITEM tree view control to the root entry to the tree view to control.
    mov hParent, eax
    mov tvinsert.hParent, eax
    mov tvinsert.hInsertAfter, TVI_LAST
    mov tvinsert.u.item.pszText, offset Child1
    invoke SendMessage, hwndTreeView, TVM_INSERTITEM, 0, addr tvinsert
    mov tvinsert.u.item.pszText, offset Child2
    invoke SendMessage, hwndTreeView, TVM_INSERTITEM, 0, addr tvinsert
After adding the root end, we re-join the sub-project. At this time is the member variable hParent his father handle the project, hInsertAfter the value is TVI_LAST. As for the selected and non-selected images used are the same, so we do not need to change the value of other variables.
    . elseif uMsg == WM_NOTIFY
    mov edi, lParam
    assume edi: ptr NM_TREEVIEW
    . if [edi]. hdr.code == TVN_BEGINDRAG
    invoke SendMessage, hwndTreeView, TVM_CREATEDRAGIMAGE, 0, [edi]. itemNew.hItem
    mov hDragImageList, eax
    invoke ImageList_BeginDrag, hDragImageList, 0,0,0
    invoke ImageList_DragEnter, hwndTreeView, [edi]. ptDrag.x, [edi]. ptDrag.y
    invoke SetCapture, hWnd
    mov DragMode, TRUE
    . endif
    assume edi: nothing
When the user drag the item, the tree view control WM_NOTIFY message will be sent to its parent window is the sub-message TVN_BEGINDRAG. LPAram is the point in the structure of NM_TREEVIEW pointer, the structure contains a number of additional information. We put the value of lParam register edi, edi This can be used as a pointer. "Assume edi: ptr NM_TREEVIEW" statement to tell MASM compiler edi to point to NM_TREEVIEW as the structure of the variables used. We TVM_CREATEDRAGIMAGE by sending a message to create a drag image. It will return a list of the newly created image of the handle, the drag image list that contains the image. We call the set function ImageList_BeginDrag hot drag image. ImageList_DragEnter function calls into the operation. The function will be displayed in a specific location of the drag image. At first, we show the location of the structure located in the member variable NM_TREEVIEW referred to ptDrag position. We lock the mouse input, and set the sign variables, that we entered a drag operation.
    . elseif uMsg == WM_MOUSEMOVE
    . if DragMode == TRUE
    mov eax, lParam
    and eax, 0ffffh
    mov ecx, lParam
    shr ecx, 16
    mov tvhit.pt.x, eax
    mov tvhit.pt.y, ecx
    invoke ImageList_DragMove, eax, ecx
    invoke ImageList_DragShowNolock, FALSE
    invoke SendMessage, hwndTreeView, TVM_HITTEST, NULL, addr tvhit
    . if eax! = NULL
    invoke SendMessage, hwndTreeView, TVM_SELECTITEM, TVGN_DROPHILITE, eax
    . endif
    invoke ImageList_DragShowNolock, TRUE
    . endif
Now we take a look at news WM_MOUSEMOVE process. When the user drag the image, our parent window will receive WM_MOUSEMOVE. In response to these messages, we call update ImageList_DragMove to update the location of the image. Then we send a message to the list view control TVM_HITTEST drag the image to see whether some items just after the above, of course, but also coordinates the location of ancillary information such as delivery. If after, then we send a message TVM_SELECTITEM and signs attached to the tree view TVGN_DROPHILITE controls, the latter will be the high-brightness display items are being passed. In the high-brightness display, we drag out the hidden images in the display image so ugly.
    . elseif uMsg == WM_LBUTTONUP
    . if DragMode == TRUE
    invoke ImageList_DragLeave, hwndTreeView
    invoke ImageList_EndDrag
    invoke ImageList_Destroy, hDragImageList
    invoke SendMessage, hwndTreeView, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0
    invoke SendMessage, hwndTreeView, TVM_SELECTITEM, TVGN_CARET, eax
    invoke SendMessage, hwndTreeView, TVM_SELECTITEM, TVGN_DROPHILITE, 0
    invoke ReleaseCapture
    mov DragMode, FALSE
    . endif
When the user releases the left mouse button, the drag operation could be over. We call ImageList_DragLeave, ImageList_EndDrag and to put an end to drag ImageList_Destroy mode of operation. Tree view control in order to make good-looking, we check the last item of high-brightness display, and select it. We must also make its high-brightness display, or other items can not be selected when a high-brightness display. Finally, we release the captured mouse input events.


Assembly Language Tutorial Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.