Hi shankle,
Here is a GetWindowThreadProcessId example for you. The application FindProcess queries the table of processes to find the executable DlgBox.exe :
EnumWndProc PROC hWnd:DWORD,lParam:DWORD
LOCAL pid:DWORD
invoke GetWindowThreadProcessId,hWnd,ADDR pid
mov edx,lParam
mov eax,DWORD PTR [edx]
cmp eax,pid
je @f
mov eax,1
ret
@@:
push hWnd
pop DWORD PTR [edx]
xor eax,eax
ret
EnumWndProc ENDP