; +-----------+
; | procedure |
; +-----------+

; proc_createfont
LOGPIXELSY	= 90
; stdcall proc_createfont,9,sfont.tahoma
proc proc_createfont uses ebx esi edi, height, fontname
			invoke	GetDC,HWND_DESKTOP
					push eax
			invoke	GetDeviceCaps,eax,LOGPIXELSY
			invoke	MulDiv,[height],eax,72
					mov  ebx,eax
					neg  ebx
					pop  eax
			invoke	ReleaseDC,HWND_DESKTOP,eax
			invoke	CreateFont,ebx,[sfont.width],[sfont.escape],[sfont.orientation],[sfont.weight],\
					[sfont.italic],[sfont.underline],[sfont.strike],[sfont.charset],\
					[sfont.oprecision],[sfont.cprecision],\
					[sfont.quality],[sfont.pitch],[fontname]
					mov  [sfont.handle],eax
			stdcall	proc_deleteobject_store,eax
					ret
endp

; proc_label
; stdcall proc_label, caption, 0, 0, 100, 25, [hwnd]
proc proc_label uses ebx esi edi, caption, x, y, width, height, parent
			invoke	CreateWindowEx,[slabel.exstyle],[slabel.clsname],[caption],[slabel.style],\
					[x],[y],[width],[height],\
					[parent],[slabel.id],[modh],NULL
					mov  [slabel.handle],eax
					ret
endp

; proc_button
; stdcall proc_button, caption, 0, 0, 100, 30, [hwnd], id
proc proc_button uses ebx esi edi, caption, x, y, width, height, parent, id
			invoke	CreateWindowEx,[sbutton.exstyle],[sbutton.clsname],[caption],[sbutton.style],\
					[x],[y],[width],[height],\
					[parent],[id],[modh],NULL
					mov  [sbutton.handle],eax
					ret
endp

; proc_edit
; stdcall proc_edit, caption, 0, 0, 100, 30, [hwnd], id
proc proc_edit uses ebx esi edi, caption, x, y, width, height, parent, id
			invoke	CreateWindowEx,[sedit.exstyle],[sedit.clsname],[caption],[sedit.style],\
					[x],[y],[width],[height],\
					[parent],[id],[modh],NULL
					mov  [sedit.handle],eax
					ret
endp

; proc_listbox
; stdcall proc_listbox, 0, 0, 100, 30, [hwnd], id
proc proc_listbox uses ebx esi edi, x, y, width, height, parent, id
			invoke	CreateWindowEx,[slistbox.exstyle],[slistbox.clsname],NULL,[slistbox.style],\
					[x],[y],[width],[height],\
					[parent],[id],[modh],NULL
					mov  [slistbox.handle],eax
					ret
endp

; proc_deleteobject_store
; stdcall proc_deleteobject_store, [font.h]
proc proc_deleteobject_store uses eax, objhandle
					mov  eax,sobjdel
					mov  ecx,[sobjdelidx]
					lea  edx,[eax+ecx*4]
					push [objhandle]
					pop  dword [edx]
					inc  [sobjdelidx]
					ret
endp

; proc_deleteobject
; stdcall/call proc_deleteobject
proc proc_deleteobject uses ebx esi edi
					mov  ebx,sobjdel
					mov  edi,[sobjdelidx]
					xor  esi,esi
		.go:
					cmp  esi,edi
					je   .finish
			invoke	DeleteObject,[ebx+esi*4]
					inc  esi
					jmp  .go
		.finish:
					ret
endp