Уроки Iczelion'а




Урок 27. Тултип-контрол - часть 8


invoke CreateWindowEx,NULL,ADDR ToolTipsClassName,NULL,\

TTS_ALWAYSTIp,CW_USEDEFAULT,\

CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,\

hInstance,NULL

mov hwndTool,eax

mov id,0

mov ti.cbSize,sizeof TOOLINFO

mov ti.uFlags,TTF_SUBCLASS

push hDlg

pop ti.hWnd

invoke GetWindowRect,hDlg,addr rect

invoke SetDlgToolArea,hDlg,addr ti,addr

MainDialogText1,id,addr rect

inc id

invoke SetDlgToolArea,hDlg,addr ti,addr

MainDialogText2,id,addr rect

inc id

invoke SetDlgToolArea,hDlg,addr ti,addr

MainDialogText3,id,addr rect

inc id

invoke SetDlgToolArea,hDlg,addr ti,addr

MainDialogText4,id,addr rect

invoke EnumChildWindows,hDlg,addr EnumChild,addr ti

.elseif uMsg==WM_CLOSE

invoke EndDialog,hDlg,NULL

.else

mov eax,FALSE

ret

.endif

mov eax,TRUE

ret

Dlgproc endp

EnumChild proc uses edi hwndChild:DWORD,lparam:DWORD

LOCAL buffer[256]:BYTE

mov edi,lparam

assume edi:ptr TOOLINFO

push hwndChild

pop [edi].uId

or [edi].uFlags,TTF_IDISHWND

invoke GetWindowText,hwndChild,addr buffer,255

lea eax,buffer

mov [edi].lpszText,eax

invoke SendMessage,hwndTool,TTM_ADDTOOL,NULL,edi

assume edi:nothing

ret

EnumChild endp

SetDlgToolArea proc uses edi esi

hDlg:DWORD,lpti:DWORD,lpText:DWORD,id:DWORD,lprect:DWORD

mov edi,lpti

mov esi,lprect

assume esi:ptr RECT

assume edi:ptr TOOLINFO

.if id==0

mov [edi].rect.left,0

mov [edi].rect.top,0

mov eax,[esi].right

sub eax,[esi].left

shr eax,1

mov [edi].rect.right,eax

mov eax,[esi].bottom

sub eax,[esi].top

shr eax,1

mov [edi].rect.bottom,eax

.elseif id==1

mov eax,[esi].right

sub eax,[esi].left

shr eax,1

inc eax

mov [edi].rect.left,eax

mov [edi].rect.top,0

mov eax,[esi].right

sub eax,[esi].left

mov [edi].rect.right,eax

mov eax,[esi].bottom

sub eax,[esi].top

mov [edi].rect.bottom,eax

.elseif id==2

mov [edi].rect.left,0

mov eax,[esi].bottom

sub eax,[esi].top

shr eax,1

inc eax

mov [edi].rect.top,eax

mov eax,[esi].right

sub eax,[esi].left

shr eax,1

mov [edi].rect.right,eax

mov eax,[esi].bottom




Содержание  Назад  Вперед