/*************************************************************************

nport\window.cpp

	-by Miles Chen (stainboyx@hotmail.com) 2009-2-22

*************************************************************************/

#include "iris-int.h"


INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg)
	{
	case WM_INITDIALOG:
		{
			Window::SetIcon(hDlg, IDI_APP);
			Injection::EnableDebugPrivilege();
			InitialListUI(GetDlgItem(hDlg, IDC_LIST_PORT));

			SendDlgItemMessageW(hDlg, IDC_BUTTON_REFRESH, BM_CLICK, 0, 0);
		}
		break;
	case WM_COMMAND: 
		switch (LOWORD(wParam)) 
		{ 
		case IDC_BUTTON_REFRESH:
			{
				UpdatePortList(GetDlgItem(hDlg, IDC_LIST_PORT));
			}
			break;
		case IDC_BUTTON_EXIT:
			{
				SendMessageW(hDlg, WM_CLOSE, NULL, NULL);
			}
			break;
		} 
		break;
	case WM_CLOSE:
		{
			EndDialog(hDlg, wParam); 
		}
		break;
	}
	return FALSE;
}