.386
.Model Flat,Stdcall

Extrn   DefWindowProcA:Proc
Extrn   RegisterClassExA:Proc
Extrn   SendMessageA:Proc
Extrn   SetWindowLongA:Proc
Extrn   GetWindowLongA:Proc
Extrn   GetWindowDC:Proc
Extrn   GetDlgItem:Proc
Extrn   GetParent:Proc
Extrn   ExtTextOutA:Proc
Extrn   GetWindowRect:Proc
Extrn   SetBkColor:Proc
Extrn   SetTextColor:Proc
Extrn   GetSysColor:Proc
Extrn   SetCursor:Proc
Extrn   GetCursorPos:Proc
Extrn   SetCapture:Proc
Extrn   ReleaseCapture:Proc
Extrn   BeginPaint:Proc
Extrn   EndPaint:Proc
Extrn   PtInRect:Proc
Extrn   LocalAlloc:Proc
Extrn   LocalFree:Proc
Extrn   GetDlgCtrlID:Proc
Extrn   LoadCursorA:Proc
Extrn   GetModuleHandleA:Proc
Extrn   GetCapture:Proc
Extrn   SelectObject:Proc
Extrn   GetClientRect:Proc
Extrn   BitBlt:Proc
Extrn   CreateCompatibleDC:Proc
Extrn   DeleteDC:Proc
Extrn   TrackPopupMenu:Proc
Extrn   GetCursorPos:Proc
Extrn   DrawIcon:Proc
Extrn   FillRect:Proc
Extrn	GetCursor:Proc

include win32api.inc
include addctrls.inc

.Data

hInstance               HINSTANCE      ?
wc                      WNDCLASSEX     ?
HLinkClass              db             "HyperLink",0
CheckIconClass		db             "CheckIcon",0

.Code

DllEntry        Proc    hInstDll:HINSTANCE,reason:DWORD,reserved:DWORD
                mov     eax,TRUE
                ret
DllEntry        EndP

HLinkProc       Proc    hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL           hDC:DWORD
                push    ebx edi esi
                mov     eax,uMsg
		cmp	eax,WM_CAPTURECHANGED
		jz	HLinkMove
                cmp     eax,WM_COMMAND
                jz      HLinkCommand
                cmp     eax,WM_PAINT
                jz      HLinkPaint
                cmp     eax,WM_MOUSEMOVE
                jz      HLinkMove
                cmp     eax,WM_CREATE
                jz      HLinkCreate
                cmp     eax,WM_LBUTTONUP
                jz      HLinkLPressed
                cmp     eax,WM_RBUTTONUP
                jz      HLinkRPressed
                cmp     eax,HL_SETINACTIVECOLOR ; wParam=new inactive color
                jz      HLinkSetClr_1
                cmp     eax,HL_SETACTIVECOLOR      ; wParam=new active color
                jz      HLinkSetClr_2
                cmp     eax,HL_GETINACTIVECOLOR
                jz      HLinkGetClr_1
                cmp     eax,HL_GETACTIVECOLOR
                jz      HLinkGetClr_2
                cmp     eax,HL_SETCURSOR
                jz      HLinkSetCur
                cmp     eax,HL_GETCURSOR
                jz      HLinkGetCur
                cmp     eax,HL_SETINACTIVEFONT
                jz      HLinkSetInFont
                cmp     eax,HL_GETINACTIVEFONT
                jz      HLinkGetInFont
                cmp     eax,HL_SETACTIVEFONT
                jz      HLinkSetAcFont
                cmp     eax,HL_GETACTIVEFONT
                jz      HLinkGetAcFont
                cmp     eax,HL_SETINACTIVEBITMAP
                jz      HLinkSetInBitmap
                cmp     eax,HL_GETINACTIVEBITMAP
                jz      HLinkGetInBitmap
                cmp     eax,HL_SETACTIVEBITMAP
                jz      HLinkSetAcBitmap
                cmp     eax,HL_GETACTIVEBITMAP
                jz      HLinkGetAcBitmap
                cmp     eax,HL_SETINACTIVEICON
                jz      HLinkSetInIcon
                cmp     eax,HL_GETINACTIVEICON
                jz      HLinkGetInIcon
                cmp     eax,HL_SETACTIVEICON
                jz      HLinkSetAcIcon
                cmp     eax,HL_GETACTIVEICON
                jz      HLinkGetAcIcon
                cmp     eax,HL_SETMENU
                jz      HLinkSetMenu
                cmp     eax,HL_GETMENU
                jz      HLinkGetMenu
                jmp     HLinkDefProc
HLinkCommand:   cmp     lParam,0
                jnz     HLinkEnd
                mov     eax,wParam
                shr     eax,16
                cmp     ax,0
                jnz     HLinkEnd
                call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,16
                push    eax
                push    hWnd
                pop     dword ptr [eax]
                call    GetWindowLongA,hWnd,GWL_ID
                pop     ebx
                push    ebx
                mov     dword ptr [ebx+4],eax
                mov     dword ptr [ebx+8],HLN_MENUITEM
                push    wParam
                pop     dword ptr [ebx+12]
                push    eax
                push    ebx
                call    GetParent,hWnd
                pop     ecx
                pop     ebx
                call    SendMessageA,eax,WM_NOTIFY,ebx,ecx
                pop     eax
                call    LocalFree,eax
                jmp     HLinkMove
HLinkSetMenu:   call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_MENU
                jz      HLinkError
                call    SetWindowLongA,hWnd,28,wParam
                jmp     HLinkEnd
HLinkGetMenu:   call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_TEXT
                jz      HLinkError
                call    GetWindowLongA,hWnd,28
                ret
HLinkSetInFont: call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_TEXT
                jz      HLinkError
                test    eax,HS_BITMAP
                jnz     HLinkError
                call    GetSysColor,COLOR_3DFACE
                call    SetWindowLongA,hWnd,8,eax
                call    SendMessageA,hWnd,WM_PAINT,0,-1
                call    SetWindowLongA,hWnd,16,wParam
                cmp     lParam,TRUE
                jz      HLinkMove
                jmp     HLinkEnd
HLinkGetInFont: call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_TEXT
                jz      HLinkError
                test    eax,HS_BITMAP
                jnz     HLinkError
                call    GetWindowLongA,hWnd,16
                ret
HLinkSetAcFont: call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_TEXT
                jz      HLinkError
                test    eax,HS_BITMAP
                jnz     HLinkError
                call    GetSysColor,COLOR_3DFACE
                call    SetWindowLongA,hWnd,8,eax
                call    SendMessageA,hWnd,WM_PAINT,0,-1
                call    SetWindowLongA,hWnd,20,wParam
                cmp     lParam,TRUE
                jz      HLinkMove
                jmp     HLinkEnd
HLinkGetAcFont: call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_TEXT
                jz      HLinkError
                test    eax,HS_BITMAP
                jnz     HLinkError
                call    GetWindowLongA,hWnd,20
                ret
HLinkSetInBitmap: call  GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_BITMAP
                jz      HLinkError
                test    eax,HS_TEXT
                jnz     HLinkError
                call    SetWindowLongA,hWnd,0,wParam
                cmp     lParam,TRUE
                jz      HLinkMove
                jmp     HLinkEnd
HLinkGetInBitmap: call  GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_BITMAP
                jz      HLinkError
                test    eax,HS_TEXT
                jnz     HLinkError
                call    GetWindowLongA,hWnd,0
                ret
HLinkSetAcBitmap: call  GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_BITMAP
                jz      HLinkError
                test    eax,HS_TEXT
                jnz     HLinkError
                call    SetWindowLongA,hWnd,4,wParam
                cmp     lParam,TRUE
                jz      HLinkMove
                jmp     HLinkEnd
HLinkGetAcBitmap: call  GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_BITMAP
                jz      HLinkError
                test    eax,HS_TEXT
                jnz     HLinkError
                call    GetWindowLongA,hWnd,4
                ret
HLinkSetInIcon: call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_ICON
                jz      HLinkError
                test    eax,HS_TEXT
                jnz     HLinkError
                call    SetWindowLongA,hWnd,0,wParam
                cmp     lParam,TRUE
                jz      HLinkMove
                jmp     HLinkEnd
HLinkGetInIcon: call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_BITMAP
                jz      HLinkError
                test    eax,HS_TEXT
                jnz     HLinkError
                call    GetWindowLongA,hWnd,0
                ret
HLinkSetAcIcon: call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_ICON
                jz      HLinkError
                test    eax,HS_TEXT
                jnz     HLinkError
                call    SetWindowLongA,hWnd,4,wParam
                cmp     lParam,TRUE
                jz      HLinkMove
                jmp     HLinkEnd
HLinkGetAcIcon: call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_ICON
                jz      HLinkError
                test    eax,HS_TEXT
                jnz     HLinkError
                call    GetWindowLongA,hWnd,4
                ret
HLinkSetCur:    call    SetWindowLongA,hWnd,12,wParam
                cmp     lParam,TRUE
                jz      HLinkMove
                jmp     HLinkEnd
HLinkGetCur:    call    GetWindowLongA,hWnd,12
                ret
HLinkSetClr_1:  call    SetWindowLongA,hWnd,0,wParam
                cmp     lParam,TRUE
                jz      HLinkMove
                jmp     HLinkEnd
HLinkSetClr_2:  call    SetWindowLongA,hWnd,4,wParam
                cmp     lParam,TRUE
                jz      HLinkMove
                jmp     HLinkEnd
HLinkGetClr_1:  call    GetWindowLongA,hWnd,0
                ret
HLinkGetClr_2:  call    GetWindowLongA,hWnd,4
                ret
HLinkLPressed:  call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,20
                push    eax
                push    hWnd
                pop     dword ptr [eax]
                call    GetWindowLongA,hWnd,GWL_ID
                pop     ebx
                push    ebx
                mov     dword ptr [ebx+4],eax
                mov     dword ptr [ebx+8],HLN_LMOUSECLICK
                push    wParam
                pop     dword ptr [ebx+12]
                push    lParam
                pop     dword ptr [ebx+16]
                push    eax
                push    ebx
                call    GetParent,hWnd
                pop     ecx
                pop     ebx
                call    SendMessageA,eax,WM_NOTIFY,ebx,ecx
                pop     eax
                call    LocalFree,eax
                jmp     HLinkMove
HLinkRPressed:
        call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_MENU
                jnz     ShowMenu
                call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,20
                push    eax
                push    hWnd
                pop     dword ptr [eax]
                call    GetWindowLongA,hWnd,GWL_ID
                pop     ebx
                push    ebx
                mov     dword ptr [ebx+4],eax
                mov     dword ptr [ebx+8],HLN_RMOUSECLICK
                push    wParam
                pop     dword ptr [ebx+12]
                push    lParam
                pop     dword ptr [ebx+16]
                push    eax
                push    ebx
                call    GetParent,hWnd
                pop     ecx
                pop     ebx
                call    SendMessageA,eax,WM_NOTIFY,ebx,ecx
                pop     eax
                call    LocalFree,eax
                jmp     HLinkPaint
ShowMenu:       call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,SIZE POINT
                push    eax
                call    GetCursorPos,eax
                call    GetWindowLongA,hWnd,28
                pop     ebx
                push    ebx
                call    TrackPopupMenu,eax,TPM_RIGHTALIGN,dword ptr [ebx],dword ptr [ebx+4],0,hWnd,0
                pop     ebx
                call    LocalFree,ebx
                jmp     HLinkPaint
HLinkMove:      call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,24
                push    eax
                call    GetCursorPos,eax
                pop     eax
                push    eax
                add     eax,8
                call    GetWindowRect,hWnd,eax
                pop     eax
                push    eax
                mov     ebx,eax
                add     ebx,8
                call    PtInRect,ebx,dword ptr [eax],dword ptr [eax+4]
                pop     ebx
                push    eax
                call    LocalFree,ebx
                pop     eax
                cmp     eax,0
                jz      HLinkLastMsg
                call    GetCapture
                cmp     eax,hWnd
                jz      HLinkEnd
                call    SetCapture,hWnd
                call    GetWindowLongA,hWnd,12
                call    SetCursor,eax
NotText_1:      call    GetWindowLongA,hWnd,4
                call    SetWindowLongA,hWnd,8,eax
                call    GetWindowLongA,hWnd,20
                call    SetWindowLongA,hWnd,24,eax
                call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,12
                push    eax
                push    hWnd
                pop     dword ptr [eax]
                call    GetWindowLongA,hWnd,GWL_ID
                pop     ebx
                push    ebx
                mov     dword ptr [ebx+4],eax
                mov     dword ptr [ebx+8],HLN_MOUSEOVER
                push    eax
                push    ebx
                call    GetParent,hWnd
                pop     ecx
                pop     ebx
                call    SendMessageA,eax,WM_NOTIFY,ebx,ecx
                pop     eax
                call    LocalFree,eax
                mov     lParam,-1
                jmp     HLinkPaint
HLinkLastMsg:   call    ReleaseCapture
                call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,12
                push    eax
                push    hWnd
                pop     dword ptr [eax]
                call    GetWindowLongA,hWnd,GWL_ID
                pop     ebx
                push    ebx
                mov     dword ptr [ebx+4],eax
                mov     dword ptr [ebx+8],HLN_CURSOROUT
                push    eax
                push    ebx
                call    GetParent,hWnd
                pop     ecx
                pop     ebx
                call    SendMessageA,eax,WM_NOTIFY,ebx,ecx
                pop     eax
                call    LocalFree,eax
NotText:        call    GetWindowLongA,hWnd,16
                call    SetWindowLongA,hWnd,24,eax
                call    GetWindowLongA,hWnd,0
                call    SetWindowLongA,hWnd,8,eax
                mov     lParam,-1
                jmp     HLinkPaint
HLinkCreate:    call    LoadCursorA,0,IDC_CROSS
                call    SetWindowLongA,hWnd,12,eax
                call    SetWindowLongA,hWnd,0,0
                call    SetWindowLongA,hWnd,4,00FF0000h
                call    SetWindowLongA,hWnd,8,0
                jmp     HLinkEnd
HLinkDestroy:
                jmp     HLinkEnd
HLinkPaint:     cmp     lParam,-1
                jnz     HLinkNormPaint
                call    GetWindowDC,hWnd
                mov     hDC,eax
                call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_TEXT
                jnz     IsText_1
                test    eax,HS_BITMAP
                jnz     ItsBitmap_1
                test    eax,HS_ICON
                jnz     ItsIcon_1
                jmp     HLinkEnd
IsText_1:       call    Paint,hDC,hWnd
                jmp     HLinkEnd
ItsBitmap_1:    call    ShowBitmap,hDC,hWnd
                jmp     HLinkEnd
ItsIcon_1:      call    ShowIcon,hDC,hWnd
                jmp     HLinkEnd
HLinkNormPaint: call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,SIZE PAINTSTRUCT
                push    eax
                call    BeginPaint,hWnd,eax
                mov     hDC,eax
                call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,HS_TEXT
                jnz     IsText
                test    eax,HS_BITMAP
                jnz     ItsBitmap
                test    eax,HS_ICON
                jnz     ItsIcon
                jmp     AfterPaint
IsText:         call    Paint,hDC,hWnd
                jmp     AfterPaint
ItsBitmap:      call    ShowBitmap,hDC,hWnd
                jmp     AfterPaint
ItsIcon:        call    ShowIcon,hDC,hWnd
AfterPaint:     pop     eax
                push    eax
                call    EndPaint,hWnd,eax
                pop     eax
                call    LocalFree,eax
                jmp     HLinkEnd
HLinkDefProc:   call    DefWindowProcA,hWnd,uMsg,wParam,lParam
                pop     esi edi ebx
                ret
HLinkEnd:       xor     eax,eax
                pop     esi edi ebx
                ret
HLinkError:     mov     eax,-1
                pop     esi edi ebx
                ret
HLinkProc       EndP

ShowBitmap      Proc    hDC:DWORD,hWnd:DWORD
LOCAL           hMemDC:DWORD
                call    CreateCompatibleDC,hDC
                mov     hMemDC,eax
                call    GetWindowLongA,hWnd,8
                call    SelectObject,hMemDC,eax
                call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,SIZE RECT
                push    eax
                call    GetClientRect,hWnd,eax
                pop     eax
                push    eax
                call    BitBlt,hDC,0,0,dword ptr [eax+8],dword ptr [eax+12],hMemDC,0,0,SRCCOPY
                pop     eax
                call    LocalFree,eax
                call    DeleteDC,hMemDC
                ret
ShowBitmap      EndP

ShowIcon        Proc    hDC:DWORD,hWnd:DWORD
                call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,16
                push    eax
                call    GetClientRect,hWnd,eax
                pop     eax
                push    eax
                call    FillRect,hDC,eax,COLOR_WINDOW
                pop     eax
                call    LocalFree,eax
                call    GetWindowLongA,hWnd,8
                call    DrawIcon,hDC,0,0,eax
                ret
ShowIcon        EndP

Paint           Proc    hDC:DWORD,hWnd:DWORD
                call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,16
                push    eax
                call    GetClientRect,hWnd,eax
                pop     eax
                push    eax
                call    FillRect,hDC,eax,COLOR_WINDOW
                pop     eax
                call    LocalFree,eax
                call    GetWindowLongA,hWnd,24
                call    SelectObject,hDC,eax
                call    GetSysColor,COLOR_3DFACE
                call    SetBkColor,hDC,eax
                call    GetWindowLongA,hWnd,8
                call    SetTextColor,hDC,eax
                call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,116
                push    eax
                add     eax,16
                call    SendMessageA,hWnd,WM_GETTEXT,100,eax
                pop     ebx
                push    ebx
                push    eax
                call    GetWindowRect,hWnd,ebx
                pop     eax
                pop     ebx
                push    ebx
                mov     ecx,ebx
                add     ebx,16
                call    ExtTextOutA,hDC,0,0,2,ecx,ebx,eax,0
                pop     eax
                call    LocalFree,eax
                ret
Paint           EndP

CheckIconProc	Proc    hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL		hDC:DWORD
		push    ebx edi esi
                mov     eax,uMsg
		cmp	eax,WM_MOUSEMOVE
		jz	ChckIconMove
		cmp	eax,WM_PAINT
		jz	ChckIconPaint
		cmp	eax,WM_CREATE
		jz	ChckIconCreate
		cmp	eax,WM_LBUTTONUP
		jz	ChckIconBtn
		cmp	eax,CI_SETUNCHKDICON
		jz	ChckSetIcon_1
		cmp	eax,CI_GETUNCHKDICON
		jz	ChckGetIcon_1
		cmp	eax,CI_SETCHKDICON
		jz	ChckSetIcon_2
		cmp	eax,CI_GETCHKDICON
		jz	ChckGetIcon_2
		cmp	eax,CI_GETSTATE
		jz	ChckGetState
		cmp	eax,CI_SETSTATE
		jz	ChckSetState
		cmp	eax,CI_SETCURSOR
		jz	ChckSetCur
		cmp	eax,CI_GETCURSOR
		jz	ChckGetCur
		cmp	eax,CI_SETFONT
		jz	ChckSetFont
		cmp	eax,CI_GETFONT
		jz	ChckGetFont
		jmp	ChckIconDef
ChckIconMove:	call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,24
                push    eax
                call    GetCursorPos,eax
                pop     eax
                push    eax
                add     eax,8
                call    GetWindowRect,hWnd,eax
                pop     eax
                push    eax
                mov     ebx,eax
                add     ebx,8
                call    PtInRect,ebx,dword ptr [eax],dword ptr [eax+4]
                pop     ebx
                push    eax
                call    LocalFree,ebx
                pop     eax
                cmp     eax,0
                jz      ChckIconEnd
		call	GetCursor
		push	eax
		call	GetWindowLongA,hWnd,16
		pop	ebx
		cmp	eax,ebx
		jz	ChckIconEnd
		call	GetWindowLongA,hWnd,16
		call	SetCursor,eax
		jmp	ChckIconEnd
ChckSetCur:	call	SetWindowLongA,hWnd,16,wParam
		cmp	lParam,TRUE
		jz	ChckIconMove
		jmp	ChckIconEnd
ChckGetCur:	call	GetWindowLongA,hWnd,16
		ret
ChckSetFont:	call	SetWindowLongA,hWnd,12,wParam
		cmp	lParam,TRUE
		jnz	ChckIconEnd
		mov	lParam,-1
		jmp	ChckIconPaint
ChckGetFont:	call	GetWindowLongA,hWnd,12
		ret
ChckGetState:	call	GetWindowLongA,hWnd,0
		push	eax
		call	GetWindowLongA,hWnd,8
		pop	ebx
		cmp	eax,ebx
		jz	ChckIconEnd
		mov	eax,1
		ret
ChckSetState:	call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,16
                push    eax
                push    hWnd
                pop     dword ptr [eax]
                call    GetWindowLongA,hWnd,GWL_ID
                pop     ebx
                push    ebx
                mov     dword ptr [ebx+4],eax
                mov     dword ptr [ebx+8],CIN_STATECHANGED
		push	wParam
		pop	dword ptr [ebx+12]
                push    eax
                push    ebx
                call    GetParent,hWnd
                pop     ecx
                pop     ebx
                call    SendMessageA,eax,WM_NOTIFY,ebx,ecx
                pop     eax
                call    LocalFree,eax
		cmp	lParam,0
		jz	ChckItOff
		call	GetWindowLongA,hWnd,4
		call	SetWindowLongA,hWnd,8,eax		
		mov	lParam,-1
		jmp	ChckIconPaint
ChckItOff:	call	GetWindowLongA,hWnd,0
		call	SetWindowLongA,hWnd,8,eax
		mov	lParam,-1
		jmp	ChckIconPaint
ChckIconBtn:	call	SendMessageA,hWnd,CI_GETSTATE,0,0
		cmp	eax,0
		jz	ChckOff
		call	SendMessageA,hWnd,CI_SETSTATE,0,FALSE
		jmp	ChckIconEnd
ChckOff:	call	SendMessageA,hWnd,CI_SETSTATE,0,TRUE
		jmp	ChckIconEnd
ChckSetIcon_1:	call	GetWindowLongA,hWnd,GWL_STYLE
		test	eax,CIS_ICON
		jz	ChckIconErr
		call	SetWindowLongA,hWnd,0,wParam
		cmp	lParam,TRUE
		jnz	ChckIconEnd
		call	SetWindowLongA,hWnd,8,wParam
		mov	lParam,-1
		jmp	ChckIconPaint
ChckGetIcon_1:	call	GetWindowLongA,hWnd,GWL_STYLE
		test	eax,CIS_ICON
		jz	ChckIconErr
		call	GetWindowLongA,hWnd,0
		ret
ChckSetIcon_2:	call	GetWindowLongA,hWnd,GWL_STYLE
		test	eax,CIS_ICON
		jz	ChckIconErr
		call	SetWindowLongA,hWnd,4,wParam
		cmp	lParam,TRUE
		jnz	ChckIconEnd
		call	SetWindowLongA,hWnd,8,wParam
		mov	lParam,-1
		jmp	ChckIconPaint
ChckGetIcon_2:	call	GetWindowLongA,hWnd,GWL_STYLE
		test	eax,CIS_ICON
		jz	ChckIconErr
		call	GetWindowLongA,hWnd,4
		ret
ChckIconPaint:	cmp     lParam,-1
                jnz     ChckNormPaint
                call    GetWindowDC,hWnd
                mov     hDC,eax
                call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,CIS_BITMAP
                jnz     ItsBitmap_2
                test    eax,CIS_ICON
                jnz     ItsIcon_2
                jmp     HLinkEnd
ItsBitmap_2:    call    ShowBitmap,hDC,hWnd
		call	ShowText,hDC,hWnd
                jmp     HLinkEnd
ItsIcon_2:      call    ShowIcon,hDC,hWnd
		call	ShowText,hDC,hWnd
                jmp     HLinkEnd
ChckNormPaint:  call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,SIZE PAINTSTRUCT
                push    eax
                call    BeginPaint,hWnd,eax
                mov     hDC,eax
                call    GetWindowLongA,hWnd,GWL_STYLE
                test    eax,CIS_BITMAP
                jnz     ItsBitmap_3
                test    eax,CIS_ICON
                jnz     ItsIcon_3
                jmp     AfterPaint_1
ItsBitmap_3:    call    ShowBitmap,hDC,hWnd
		call	ShowText,hDC,hWnd
                jmp     AfterPaint_1
ItsIcon_3:      call    ShowIcon,hDC,hWnd
		call	ShowText,hDC,hWnd
AfterPaint_1:   pop     eax
                push    eax
                call    EndPaint,hWnd,eax
                pop     eax
                call    LocalFree,eax
		jmp	ChckIconEnd
ChckIconCreate:	call	SetWindowLongA,hWnd,8,1
		jmp	ChckIconEnd
ChckIconDef:	call    DefWindowProcA,hWnd,uMsg,wParam,lParam
                pop     esi edi ebx
                ret
ChckIconEnd:	xor	eax,eax
		ret
ChckIconErr:	mov	eax,-1
		ret
CheckIconProc	EndP

ShowText        Proc    hDC:DWORD,hWnd:DWORD         
                call    GetWindowLongA,hWnd,12
                call    SelectObject,hDC,eax
                call    GetSysColor,COLOR_3DFACE
                call    SetBkColor,hDC,eax
                call    SetTextColor,hDC,0
                call    LocalAlloc,LMEM_FIXED or LMEM_ZEROINIT,116
                push    eax
                add     eax,16
                call    SendMessageA,hWnd,WM_GETTEXT,100,eax
                pop     ebx
                push    ebx
                push    eax
                call    GetWindowRect,hWnd,ebx
                pop     eax
                pop     ebx
                push    ebx
                mov     ecx,ebx
                add     ebx,16
                call    ExtTextOutA,hDC,32,0,2,ecx,ebx,eax,0
                pop     eax
                call    LocalFree,eax
                ret
ShowText        EndP

InitControls    Proc
                mov     wc.wce_style,CS_HREDRAW or CS_VREDRAW or CS_GLOBALCLASS
                mov     wc.wce_cbSize,SIZE WNDCLASSEX
                mov     wc.wce_lpfnWndProc,offset HLinkProc
                mov     wc.wce_cbClsExtra,NULL
                mov     wc.wce_cbWndExtra,32
                call    GetModuleHandleA,0
                mov     wc.wce_hInstance,eax
                mov     wc.wce_hbrBackground,COLOR_WINDOW
                mov     wc.wce_lpszMenuName,NULL
                mov     wc.wce_lpszClassName,offset HLinkClass
                mov     wc.wce_hIcon,0
                mov     wc.wce_hIconSm,0
                mov     wc.wce_hCursor,0
                call    RegisterClassExA,offset wc

		mov     wc.wce_style,CS_HREDRAW or CS_VREDRAW or CS_GLOBALCLASS
                mov     wc.wce_cbSize,SIZE WNDCLASSEX
                mov     wc.wce_lpfnWndProc,offset CheckIconProc
                mov     wc.wce_cbClsExtra,NULL
                mov     wc.wce_cbWndExtra,20
                call    GetModuleHandleA,0
                mov     wc.wce_hInstance,eax
                mov     wc.wce_hbrBackground,COLOR_WINDOW
                mov     wc.wce_lpszMenuName,NULL
                mov     wc.wce_lpszClassName,offset CheckIconClass
                mov     wc.wce_hIcon,0
                mov     wc.wce_hIconSm,0
                mov     wc.wce_hCursor,0
                call    RegisterClassExA,offset wc
                ret
InitControls    EndP

; Hyperlink Extra window memory:
;0 DWORD        Inactive color or bitmap handle
;4 DWORD        Active color or bitmap handle
;8 DWORD        Current color or bitmap handle
;12 DWORD       Cursor handle
;16 DWORD       Inactive font handle
;20 DWORD       Active font handle
;24 DWORD       Current font handle
;28 DWORD       Menu handle

; CheckIcon Extra window memory
;0 DWORD	Unchecked icon or bitmap handle
;4 DWORD	Checked icon or bitmap handle
;8 DWORD	Current icon or bitmap handle
;12 DWORD	Font handle
;16 DWORD	Cursor handle

PUBLIC InitControls

End DllEntry