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

extern char favCommand[COMMAND_SIZE];

/* Procedura dialogu Add/Change command */
INT_PTR CALLBACK DialogAdd(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg)
	{
		case WM_COMMAND:
			switch (LOWORD(wParam))
			{
				case IDCANCEL:
					EndDialog(hwndDlg, IDCANCEL);
					break;
				case IDOK:
					GetDlgItemText(hwndDlg, IDC_EDIT_ADD, favCommand, COMMAND_SIZE-1);
					EndDialog(hwndDlg, IDOK);
					break;
			}
			break;
		case WM_INITDIALOG:
			SetDlgItemText(hwndDlg, IDC_EDIT_ADD, favCommand);
			SetFocus(GetDlgItem(hwndDlg, IDC_EDIT_ADD));
			SendDlgItemMessage(hwndDlg, IDC_EDIT_ADD, EM_SETSEL, 0, (LPARAM)-1); // Nastaveni karetu
			SendDlgItemMessage(hwndDlg, IDC_EDIT_ADD, EM_SETSEL, (WPARAM)-1, 0); // Nastaveni karetu
			break;
	}
	return FALSE;
}
