ibool Preferences::OnCmdMenuColorChange(Param& param)
		{
			if (param.Button().Clicked())
			{
				static COLORREF customColors[16] = {0};

				Object::Pod<CHOOSECOLOR> cc;

				MenuColorWindow& type = menuColorWindows[param.Button().GetId() == IDC_PREFERENCES_MENUCOLOR_FULLSCREEN_CHANGE];

				cc.lStructSize  = sizeof(cc);
				cc.hwndOwner    = dialog;
				cc.lpCustColors = customColors;
				cc.rgbResult    = type.color;
				cc.Flags        = CC_FULLOPEN|CC_RGBINIT;

				if (::ChooseColor( &cc ))
				{
					type.color = cc.rgbResult;
					UpdateColors();
				}
			}

			return true;
		}
		ibool Launcher::List::Paths::OnCmdRemove(Param& param)
		{
			if (param.Button().Clicked())
				dialog.ListView( IDC_LAUNCHER_PATHS_LIST ).Selection().Delete();

			return true;
		}
		ibool Preferences::OnCmdStyle(Param& param)
		{
			if (param.Button().Clicked())
				UpdateIconStyle();

			return true;
		}
ibool Launcher::List::Columns::OnCmdOk(Param& param)
{
    if (param.Button().Clicked())
    {
        HeapString text;

        for (uint i=0; i < 2; ++i)
        {
            Control::ListBox list = dialog.ListBox
                                    (
                                        i ? IDC_LAUNCHER_COLUMNSELECT_SELECTED :
                                        IDC_LAUNCHER_COLUMNSELECT_AVAILABLE
                                    );

            Types& types = (i ? selected : available);
            types.Resize( list.Size() );

            for (uint j=0; j < types.Size(); ++j)
            {
                list[j].Text() >> text;

                for (uint k=0; k < NUM_TYPES; ++k)
                {
                    if (text == Resource::String( IDS_LAUNCHER_COLUMN_FILE + k))
                    {
                        types[j] = k;
                        break;
                    }
                }
            }
        }

        dialog.Close();
    }
ibool Launcher::List::Columns::OnCmdDefault(Param& param)
{
    if (param.Button().Clicked())
    {
        Control::ListBox list( dialog.ListBox(IDC_LAUNCHER_COLUMNSELECT_SELECTED) );

        list.Clear();

        for (uint i=0; i < NUM_DEFAULT_SELECTED_TYPES; ++i)
            list.Add( Resource::String( IDS_LAUNCHER_COLUMN_FILE + i) );

        list[0].Select();

        list = dialog.ListBox(IDC_LAUNCHER_COLUMNSELECT_AVAILABLE);
        list.Clear();

        for (uint i=0; i < NUM_DEFAULT_AVAILABLE_TYPES; ++i)
            list.Add( Resource::String( IDS_LAUNCHER_COLUMN_FILE + NUM_DEFAULT_SELECTED_TYPES + i) );

        list[0].Select();

        dialog.Control( IDC_LAUNCHER_COLUMNSELECT_REMOVE ).Enable();
        dialog.Control( IDC_LAUNCHER_COLUMNSELECT_ADD    ).Enable();
    }

    return true;
}
ibool Launcher::List::Columns::OnCmdRemove(Param& param)
{
    if (param.Button().Clicked())
        Add( IDC_LAUNCHER_COLUMNSELECT_AVAILABLE, IDC_LAUNCHER_COLUMNSELECT_SELECTED );

    return true;
}
		ibool Launcher::List::Paths::OnCmdOk(Param& param)
		{
			if (param.Button().Clicked())
			{
				settings.include[ Settings::Include::NES     ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_NES         ).Checked();
				settings.include[ Settings::Include::UNF     ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_UNF         ).Checked();
				settings.include[ Settings::Include::XML     ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_XML         ).Checked();
				settings.include[ Settings::Include::FDS     ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_FDS         ).Checked();
				settings.include[ Settings::Include::NSF     ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_NSF         ).Checked();
				settings.include[ Settings::Include::PATCH   ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_PATCH       ).Checked();
				settings.include[ Settings::Include::ARCHIVE ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_ARCHIVE     ).Checked();
				settings.include[ Settings::Include::ANY     ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_ALLFILES    ).Checked();
				settings.include[ Settings::Include::UNIQUE  ] = dialog.CheckBox( IDC_LAUNCHER_PATHS_UNIQUEFILES ).Checked();

				const Control::ListView listView( dialog.ListView(IDC_LAUNCHER_PATHS_LIST) );
				settings.folders.resize( listView.Size() );

				for (uint i=0, n=settings.folders.size(); i < n; ++i)
				{
					listView[i].Text() >> settings.folders[i].path;
					settings.folders[i].incSubDir = listView[i].Checked();
				}

				dialog.Close();
			}
		ibool Launcher::List::Paths::OnCmdClear(Param& param)
		{
			if (param.Button().Clicked())
				dialog.ListView( IDC_LAUNCHER_PATHS_LIST ).Clear();

			return true;
		}
		ibool Preferences::OnCmdMenuColorDefault(Param& param)
		{
			if (param.Button().Clicked())
			{
				uint id;

				if (param.Button().GetId() == IDC_PREFERENCES_MENUCOLOR_FULLSCREEN_DEFAULT)
					id = IDC_PREFERENCES_MENUCOLOR_FULLSCREEN_CHANGE;
				else
					id = IDC_PREFERENCES_MENUCOLOR_DESKTOP_CHANGE;

				dialog.Control( id ).Enable( dialog.CheckBox(param.Button().GetId()).Unchecked() );
			}

			return true;
		}
		ibool Netplay::OnFullscreen(Param& param)
		{
			if (param.Button().Clicked())
				doFullscreen = dialog.CheckBox( IDC_NETPLAY_PLAY_FULLSCREEN ).Checked();

			return true;
		}
		ibool Netplay::OnLaunch(Param& param)
		{
			if (param.Button().Clicked())
				dialog.Close( LAUNCH );

			return true;
		}
		ibool Netplay::OnClear(Param& param)
		{
			if (param.Button().Clicked())
				dialog.ListView( IDC_NETPLAY_GAMELIST ).Clear();

			return true;
		}
		ibool Netplay::OnRemove(Param& param)
		{
			if (param.Button().Clicked())
				dialog.ListView( IDC_NETPLAY_GAMELIST ).Selection().Delete();

			return true;
		}
		ibool Netplay::OnAdd(Param& param)
		{
			if (param.Button().Clicked())
				Add( paths.BrowseLoad(Managers::Paths::File::GAME|Managers::Paths::File::ARCHIVE) );

			return true;
		}
		ibool Netplay::OnDefault(Param& param)
		{
			if (param.Button().Clicked())
			{
				doFullscreen = false;
				dialog.CheckBox( IDC_NETPLAY_PLAY_FULLSCREEN ).Check( false );
			}

			return true;
		}
		ibool Launcher::List::Paths::OnCmdAdd(Param& param)
		{
			if (param.Button().Clicked() && dialog.ListView( IDC_LAUNCHER_PATHS_LIST ).Size() < LIMIT)
			{
				const Path dir( Browser::SelectDirectory() );

				if (dir.Length())
					dialog.ListView( IDC_LAUNCHER_PATHS_LIST ).Add( dir );
			}

			return true;
		}
		ibool Preferences::OnCmdOk(Param& param)
		{
			if (param.Button().Clicked())
			{
				for (uint i=0; i < NUM_SETTINGS; ++i)
				{
					if (i != SAVE_SETTINGS)
						settings[i] = dialog.CheckBox( IDC_PREFERENCES_STARTUP_FULLSCREEN + i ).Checked();
				}

				settings.priority = static_cast<Priority>(dialog.ComboBox( IDC_PREFERENCES_PRIORITY ).Selection().GetIndex());

				settings.menuLookDesktop.color = menuColorWindows[0].color;
				settings.menuLookFullscreen.color = menuColorWindows[1].color;

				settings.menuLookDesktop.enabled = dialog.CheckBox( IDC_PREFERENCES_MENUCOLOR_DESKTOP_DEFAULT ).Unchecked();
				settings.menuLookFullscreen.enabled = dialog.CheckBox( IDC_PREFERENCES_MENUCOLOR_FULLSCREEN_DEFAULT ).Unchecked();

				settings.favoredSystem =
				(
					dialog.RadioButton( IDC_PREFERENCES_FAVORED_NES_PAL ).Checked() ? Nes::Machine::FAVORED_NES_PAL :
					dialog.RadioButton( IDC_PREFERENCES_FAVORED_FAMICOM ).Checked() ? Nes::Machine::FAVORED_FAMICOM :
					dialog.RadioButton( IDC_PREFERENCES_FAVORED_DENDY   ).Checked() ? Nes::Machine::FAVORED_DENDY   :
                                                                                      Nes::Machine::FAVORED_NES_NTSC
				);

				settings.alwaysAskSystem = dialog.RadioButton( IDC_PREFERENCES_FAVORED_ALWAYS_ASK ).Checked();

				Application::Instance::SetIconStyle( dialog.RadioButton(IDC_PREFERENCES_STYLE_NES).Checked() ? Application::Instance::ICONSTYLE_NES : Application::Instance::ICONSTYLE_FAMICOM );

				{
					Association association( true );
					const uint iconOffset = (Application::Instance::GetIconStyle() == Application::Instance::ICONSTYLE_NES ? 3 : 4);

					for (uint i=0; i < Association::NUM_EXTENSIONS; ++i)
					{
						if (dialog.CheckBox( IDC_PREFERENCES_ASSOCIATE_NES + i ).Checked())
							association.Create( i, icons[i][iconOffset] );
						else
							association.Delete( i );
					}
				}

				dialog.Close();
			}

			return true;
		}