DlgProc proc uses ebx esi edi hWnd,uMsg,wParam,lParam
	mov eax,uMsg
WM_CASE eax,<CLOSE,INITDIALOG,COMMAND,VKEYTOITEM>
@r0:	xor eax,eax
@r:		ret
@@CLOSE:
	invoke EndDialog,hWnd,eax
	jmp @r
@@INITDIALOG:
;GetHandles
	mov ebx,10
;	mov edi,hWnd
@@: 
	invoke GetDlgItem,hWnd,ebx
	mov hListBoxes[ebx*4][-40],eax
	inc ebx
	cmp ebx,13
	jne @B
	xor edi,edi
	
@@:
	mov ebx,32000
	mov esi,Procs[edi*4]
@nextcall:
	
	Scall dword ptr [esi],0,ebx
	test eax,eax
	je @nextid
	push eax
	invoke udw2str,ebx,offset number
	invoke SendMessage,hListBoxes[edi*4],LB_ADDSTRING,0,offset number
	pop ecx
	invoke SendMessage,hListBoxes[edi*4],LB_SETITEMDATA,eax,ecx
	
@nextid:
	cmp ebx,32999
	inc ebx
	jc @nextcall
	inc edi
	jnp @B
	xor eax,eax
	inc eax
	jmp @r

@@COMMAND:
	mov eax,wParam
	cmp eax,2	
	mov ebx,eax
	je @@CLOSE
	and ebx,0FFFFh
	shr eax,16
	sub ebx,10
	cmp ebx,3
	jnc @r	
	cmp eax,LBN_DBLCLK
@vk:
	mov esi,SendMessage
	mov edi,lParam
	je @dblclk
	cmp eax,LBN_SELCHANGE
	jne @r
	Scall esi,edi,LB_GETCURSEL,0,0
	cmp eax,bmSelected[ebx*4]
	je @r
	mov bmSelected[ebx*4],eax
	Scall esi,edi,LB_GETITEMDATA,eax,0
	lea ecx,[ebx][20]
	invoke SendDlgItemMessage,hWnd,ecx,STM_SETIMAGE,ebx,eax
	jmp @r
@dblclk:
	
	Scall esi,edi,LB_GETCURSEL,0,0
	Scall esi,edi,LB_GETTEXT,eax,ApiNum[ebx*4]
	invoke SetDlgItemText,hWnd,13,ApiTxt[ebx*4]
	or eax,-2
	jmp @r
@@VKEYTOITEM:
	or eax,-1
	cmp word ptr wParam,VK_SPACE
	jne @r
	xor ebx,ebx
	mov eax,lParam
@@:	cmp eax,hListBoxes[ebx*4]
	lea ebx,[ebx][1]
	jne @B
	dec ebx
	mov eax,hListBoxes[ebx*4]
	cmp eax,eax
	mov lParam,eax
	jmp @vk
	
DlgProc endp