x 和 y是在拖拉时显示图象的初始位置的坐标值。这些值是相对于窗口的左上角而不是客户区的左上角。
例子代码:
.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,\