//Simplest Dialog-based Application by Justin Todd

#include <windows.h>
#include "resource.h"

LRESULT CALLBACK MainDialogProc(HWND hDlg,UINT Message,WPARAM wParam,LPARAM lParam);

HINSTANCE	hInst;
HWND		hDlg;

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpcmdline,int ncmdshow){
	hInst=hInstance;
	MSG msg;
	hDlg=CreateDialog(hInst,MAKEINTRESOURCE(IDD_DIALOG),NULL,(DLGPROC)MainDialogProc);
	ShowWindow(hDlg,SW_SHOWNORMAL);
	while(GetMessage(&msg,NULL,0,0)) IsDialogMessage(hDlg,&msg);
	return(msg.wParam);
}

LRESULT CALLBACK MainDialogProc(HWND hDlg,UINT Message,WPARAM wParam,LPARAM lParam){ //MAIN DIALOG. THIS PROCESSES MESSAGES
	switch(Message){
	case WM_COMMAND:
		switch(LOWORD(wParam)){
		case IDB_CLOSE:
			EndDialog(hDlg,0);
			PostQuitMessage(0);
			break;
		default:
			break;
		}
	}
	return 0;
}