Пример #1
0
INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	char str[20];

	switch (msg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);
		CheckDlgButton(hwndDlg, IDC_UPDATEONSTARTUP, (int)UpdateOnStartup);
		CheckDlgButton(hwndDlg, IDC_ONLYONCEADAY, (int)OnlyOnceADay);
		EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), UpdateOnStartup);
		CheckDlgButton(hwndDlg, IDC_UPDATEONPERIOD, (int)UpdateOnPeriod);
		EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), UpdateOnPeriod);
		EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), UpdateOnPeriod);
		EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), UpdateOnPeriod);

		SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETRANGE, 0, MAKELONG(99, 1));
		SendDlgItemMessage(hwndDlg, IDC_PERIODSPIN, UDM_SETPOS, 0, (LPARAM)Period);

		Edit_LimitText(GetDlgItem(hwndDlg, IDC_PERIOD), 2);
		mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PERIOD), MyEditProc);

		ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 0, TranslateT("hours"));
		ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
		ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), PeriodMeasure);

		CheckDlgButton(hwndDlg, IDC_REMINDER, (int)Reminder);
		if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
			ShowWindow(GetDlgItem(hwndDlg, IDC_NOTIFY2), SW_HIDE);
			ShowWindow(GetDlgItem(hwndDlg, IDC_MSG_BOXES2), SW_HIDE);
			ShowWindow(GetDlgItem(hwndDlg, IDC_ERRORS2), SW_HIDE);
			ShowWindow(GetDlgItem(hwndDlg, IDC_INFO_MESSAGES2), SW_HIDE);
			ShowWindow(GetDlgItem(hwndDlg, IDC_PROGR_DLG2), SW_HIDE);
		}
		else {
			for (int i = 1; i < POPUPS; i++) {
				mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
				CheckDlgButton(hwndDlg, (i+1029), (db_get_b(NULL, MODNAME, str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED: BST_UNCHECKED);
			}
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_UPDATEONSTARTUP:
			SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
			break;

		case IDC_ONLYONCEADAY:
			SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;

		case IDC_UPDATEONPERIOD:
			{
				BOOL value = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);
				EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), value);
				EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), value);
				EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), value);
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			}
			break;

		case IDC_PERIODMEASURE:
			if (HIWORD(wParam) == CBN_SELCHANGE)
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;

		case IDC_REMINDER:
			SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;

		case IDC_LINK_HOTKEY:
			{
				OPENOPTIONSDIALOG ood = { sizeof(ood) };
				ood.pszGroup = "Customize";
				ood.pszPage = "Hotkeys";
				Options_Open(&ood);
			} 
			return true;

		case IDC_MSG_BOXES2:
		case IDC_ERRORS2:
		case IDC_INFO_MESSAGES2:
		case IDC_PROGR_DLG2:
			if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE) && (HWND)lParam == GetFocus())
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			break;
		}
		break;

	case WM_NOTIFY:
		{
			NMHDR *hdr = (NMHDR *)lParam;
			if(hdr && hdr->code == UDN_DELTAPOS)
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);

			if (hdr && hdr->code == PSN_APPLY) {
				UpdateOnStartup = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP);
				OnlyOnceADay = IsDlgButtonChecked(hwndDlg, IDC_ONLYONCEADAY);

				UpdateOnPeriod = IsDlgButtonChecked(hwndDlg, IDC_UPDATEONPERIOD);

				char buffer[3] = {0};
				Edit_GetText(GetDlgItem(hwndDlg, IDC_PERIOD), (LPWSTR)&buffer, 2);
				Period = atoi(buffer); 

				PeriodMeasure = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE));

				InitTimer();

				db_set_b(NULL, MODNAME, "UpdateOnStartup", UpdateOnStartup);
				db_set_b(NULL, MODNAME, "OnlyOnceADay", OnlyOnceADay);
				db_set_b(NULL, MODNAME, "UpdateOnPeriod", UpdateOnPeriod);
				db_set_dw(NULL, MODNAME, "Period", Period);
				db_set_b(NULL, MODNAME, "PeriodMeasure", PeriodMeasure);
				Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER);
				db_set_b(NULL, MODNAME, "Reminder", Reminder);
				if ( !ServiceExists(MS_POPUP_ADDPOPUPT)) {
					for (int i = 1; i < POPUPS; i++) {
						mir_snprintf(str, SIZEOF(str), "Popups%dM", i);
						db_set_b(NULL, MODNAME, str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i+1029))));
					}
				}
			}
			break;
		}
	}
	return FALSE;
}
Пример #2
0
static void populate_control(datamap *map, HWND control, windows_options *opts, datamap_entry *entry, const char *option_name)
{
	int i;
	BOOL bool_value;
	int int_value;
	float float_value;
	const char *string_value;
	const char *item_string;
	int selected_index;
	char buffer[128];
	int trackbar_range;
	int trackbar_pos;
	double trackbar_range_d;
	//int minval_int, maxval_int;
	//float minval_float, maxval_float;

	// use default populate control value
	switch(get_control_type(control))
	{
		case CT_BUTTON:
			assert(entry->type == DM_BOOL);
			bool_value = opts->bool_value(option_name);
			Button_SetCheck(control, bool_value);
			break;

		case CT_EDIT:
		case CT_STATIC:
			switch(entry->type)
			{
				case DM_STRING:
					string_value = opts->value(option_name);
					break;

				case DM_INT:
					int_value = opts->int_value(option_name);
					if (entry->int_format != NULL)
						snprintf(buffer, ARRAY_LENGTH(buffer), entry->int_format, int_value);
					else
						snprintf(buffer, ARRAY_LENGTH(buffer), "%d", int_value);
					string_value = buffer;
					break;

				case DM_FLOAT:
					float_value = opts->float_value(option_name);
					if (entry->float_format != NULL)
						snprintf(buffer, ARRAY_LENGTH(buffer), entry->float_format, float_value);
					else
						snprintf(buffer, ARRAY_LENGTH(buffer), "%f", float_value);
					string_value = buffer;
					break;

				default:
					string_value = "";
					break;
			}
			if (string_value == NULL)
				string_value = "";
			win_set_window_text_utf8(control, string_value);
			break;

		case CT_COMBOBOX:
			selected_index = 0;
			switch(entry->type)
			{
				case DM_INT:
					int_value = opts->int_value(option_name);
					for (i = 0; i < ComboBox_GetCount(control); i++)
					{
						if (int_value == (int) ComboBox_GetItemData(control, i))
						{
							selected_index = i;
							break;
						}
					}
					break;

				case DM_STRING:
					string_value = opts->value(option_name);
					for (i = 0; i < ComboBox_GetCount(control); i++)
					{
						item_string = (const char *) ComboBox_GetItemData(control, i);
						if (!core_stricmp(string_value, item_string ? item_string : ""))
						{
							selected_index = i;
							break;
						}
					}
					break;

				default:
					assert(FALSE);
					break;
			}
			(void)ComboBox_SetCurSel(control, selected_index);
			break;

		case CT_TRACKBAR:
			// do we need to set the trackbar options?
/*			if (!entry->use_trackbar_options)
			{
				switch(options_get_range_type(opts, option_name))
				{
					case OPTION_RANGE_NONE:
						// do nothing
						break;

					case OPTION_RANGE_INT:
						options_get_range_int(opts, option_name, &minval_int, &maxval_int);
						entry->use_trackbar_options = TRUE;
						entry->trackbar_min = minval_int;
						entry->trackbar_max = maxval_int;
						entry->trackbar_increments = 1;
						break;

					case OPTION_RANGE_FLOAT:
						options_get_range_float(opts, option_name, &minval_float, &maxval_float);
						entry->use_trackbar_options = TRUE;
						entry->trackbar_min = minval_float;
						entry->trackbar_max = maxval_float;
						entry->trackbar_increments = (float)0.05;
						break;
				}
			}
		*/

			// do we specify default options for this control?  if so, we need to specify
			// the range
			if (entry->use_trackbar_options)
			{
				trackbar_range_d = floor(((entry->trackbar_max - entry->trackbar_min)
					/ entry->trackbar_increments) + 0.5);
				trackbar_range = (int) trackbar_range_d;
				SendMessage(control, TBM_SETRANGEMIN, (WPARAM) FALSE, (LPARAM) 0);
				SendMessage(control, TBM_SETRANGEMAX, (WPARAM) FALSE, (LPARAM) trackbar_range);
			}

			switch(entry->type)
			{
				case DM_INT:
					int_value = opts->int_value(option_name);
					trackbar_pos = trackbar_position_from_value(entry, int_value);
					break;

				case DM_FLOAT:
					float_value = opts->float_value(option_name);
					trackbar_pos = trackbar_position_from_value(entry, float_value);
					break;

				default:
					trackbar_pos = 0;
					assert(FALSE);
					break;
			}
			SendMessage(control, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) trackbar_pos);
			break;

		case CT_LISTVIEW:
		case CT_UNKNOWN:
			// non applicable
			break;
	}
}
Пример #3
0
void tfeature::update_to_ui_feature_edit(HWND hdlgP) const
{
	HWND hctl = GetDlgItem(hdlgP, IDC_CMB_FEATUREEDIT_LEVEL);
	ComboBox_SetCurSel(hctl, level_);

	hctl = GetDlgItem(hdlgP, IDC_LV_FEATUREEDIT_CANDIDATE);
	std::stringstream strstr;
	std::string str;
	char text[_MAX_PATH];

	ListView_DeleteAllItems(hctl);
	// fill data
	LVITEM lvi;
	int iItem = 0;
	const std::vector<int>& features = hero::valid_features();
	for (std::vector<int>::const_iterator it = features.begin(); it != features.end(); ++ it) {
		if (ns::type == IDC_LV_FEATURE_ATOM) {
			break;
		}
		if (*it >= HEROS_BASE_FEATURE_COUNT) {
			break;
		}
		if (items_.find(*it) != items_.end()) {
			continue;
		}

		int index = 0;
		
		lvi.mask = LVIF_TEXT | LVIF_PARAM;
		// number
		lvi.iItem = iItem;
		lvi.iSubItem = index ++;
		strstr.str("");
		strstr << *it;
		strcpy(text, strstr.str().c_str());
		lvi.pszText = text;
		lvi.lParam = (LPARAM)*it;
		ListView_InsertItem(hctl, &lvi);

		// name
		lvi.mask = LVIF_TEXT;
		lvi.iSubItem = index ++;
		strstr.str("");
		strstr << hero::feature_str(*it);
		strcpy(text, utf8_2_ansi(strstr.str().c_str()));
		lvi.pszText = text;
		ListView_SetItem(hctl, &lvi);

		// description
		lvi.mask = LVIF_TEXT;
		lvi.iSubItem = index ++;
		strstr.str("");
		strstr << hero::feature_desc_str(*it);
		strcpy(text, utf8_2_ansi(strstr.str().c_str()));
		lvi.pszText = text;
		ListView_SetItem(hctl, &lvi);

		iItem ++;
	}

	hctl = GetDlgItem(hdlgP, IDC_LV_FEATUREEDIT_ITEMS);
	ListView_DeleteAllItems(hctl);
	iItem = 0;
	for (std::set<int>::const_iterator it = items_.begin(); it != items_.end(); ++ it, iItem ++) {
		int index = 0;
		
		lvi.mask = LVIF_TEXT | LVIF_PARAM;
		// number
		lvi.iItem = iItem;
		lvi.iSubItem = index ++;
		strstr.str("");
		strstr << *it;
		strcpy(text, strstr.str().c_str());
		lvi.pszText = text;
		lvi.lParam = (LPARAM)*it;
		ListView_InsertItem(hctl, &lvi);

		// name
		lvi.mask = LVIF_TEXT;
		lvi.iSubItem = index ++;
		strstr.str("");
		strstr << hero::feature_str(*it);
		strcpy(text, utf8_2_ansi(strstr.str().c_str()));
		lvi.pszText = text;
		ListView_SetItem(hctl, &lvi);

		// description
		lvi.mask = LVIF_TEXT;
		lvi.iSubItem = index ++;
		strstr.str("");
		strstr << hero::feature_desc_str(*it);
		strcpy(text, utf8_2_ansi(strstr.str().c_str()));
		lvi.pszText = text;
		ListView_SetItem(hctl, &lvi);
	}

	if (ns::type != IDC_LV_FEATURE_ATOM) {
		Button_Enable(GetDlgItem(hdlgP, IDOK), !items_.empty());
	}
}
Пример #4
0
Файл: swnd.c Проект: goriy/sif
// create window content #0 [Search in files ].
void create_wnd_content0(HWND parent)
{
    HWND wnd;
    LV_COLUMN col;

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

    wnd = CreateWindowEx(0x00000000, "Static", "", 0x50000300, 0, 28, 280, 20, parent, (HMENU) IDC_REALPATH, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000200, "Edit", "", 0x50010080, 32, 4, 248, 18, parent, (HMENU) IDC_MANPATH, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    oldManPathProc = (WNDPROC)SetWindowLongPtr(wnd, GWLP_WNDPROC, (LONG_PTR)manPathInputProc);
    wnd = CreateWindowEx(0x00000200, "ListBox", "", 0x50010002 | WS_VSCROLL | WS_HSCROLL | LBS_HASSTRINGS | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT, 0, 69, 130, 200, parent, (HMENU) IDC_DIRS, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "ComboBox", "", 0x50010303, 0, 48, 130, 121, parent, (HMENU) IDC_DRIVES, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000200, "ListBox", "", 0x50010002 | WS_VSCROLL | WS_HSCROLL | LBS_HASSTRINGS | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT, 130, 48, 150, 212, parent, (HMENU) IDC_FILES, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "Button", "&UPD", 0x50012F00, 224, 264, 44, 20, parent, (HMENU) IDC_UPD, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "Static", "Path:", 0x50000302, 0, 0, 30, 24, parent, (HMENU) IDC_STATIC2, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "Static", "File mask:", 0x50000302, 72, 264, 50, 20, parent, (HMENU) IDC_STATIC1, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000200, "Edit", "*.*", 0x50010000, 124, 264, 94, 20, parent, (HMENU) IDC_MASK, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    Edit_LimitText (wnd, MAX_MASK_LEN-1);
    oldMaskProc = (WNDPROC)SetWindowLongPtr(wnd, GWLP_WNDPROC, (LONG_PTR)mask_input_proc);
    wnd = CreateWindowEx(0x00000000, "Button", "&Recursive", 0x50010003, 4, 264, 70, 20, parent, (HMENU) IDC_RECURSIV, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);

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

    wnd = CreateWindowEx(0x00000000, "Button", "Save LF", 0x58012F00, 484, 264, 96, 20, parent, (HMENU) IDC_SAVELF, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "Button", "Save CRLF", 0x58012F00, 380, 264, 96, 20, parent, (HMENU) IDC_SAVECRLF, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "Edit", "", 0x50000800, 285, 264, 84, 20, parent, (HMENU) IDC_LFIND, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "Button", "Font", 0x50002F00, 684, 264, 60, 20, parent, (HMENU) IDC_FONT, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);

    wnd = CreateWindowEx(0x00000000, "ComboBox", "", 0x50010203, 588, 264, 90, 72, parent, (HMENU) IDC_SENCODING, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    SendMessage(wnd, CB_ADDSTRING, 0, (LPARAM) "Save: auto");
    SendMessage(wnd, CB_ADDSTRING, 0, (LPARAM) "Save: cp1251");
    SendMessage(wnd, CB_ADDSTRING, 0, (LPARAM) "Save: utf-8");
    ComboBox_SetCurSel (wnd, 0);

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

    wnd = CreateWindowEx(0x00000000, "ComboBox", "", 0x50010203 | WS_VSCROLL, 176, 316, 296, 121, parent, (HMENU) IDC_RECENT, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "Button", "R&e", 0x50010003, 60, 300, 48, 14, parent, (HMENU) IDC_RE, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "Static", "Search text:", 0x50000302, 100, 296, 64, 24, parent, (HMENU) IDC_STATIC0, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    wnd = CreateWindowEx(0x00000000, "Button", "&Case", 0x50010003, 4, 300, 52, 14, parent, (HMENU) IDC_CASE, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);

    wnd = CreateWindowEx(0x00000000, "Button", "&Search", 0x50010001 | BS_DEFPUSHBUTTON, 480, 296, 80, 24, parent, (HMENU) IDC_SEARCH, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    SendMessage(wnd, BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, TRUE);
    SendMessage(hMainWindow, DM_SETDEFID, (WPARAM)IDC_SEARCH, 0);

    wnd = CreateWindowEx(0x00000000, "ComboBox", "", 0x50010203, 568, 296, 110, 72, parent, (HMENU) IDC_ENCODING, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    SendMessage(wnd, CB_ADDSTRING, 0, (LPARAM) "Files: auto");
    SendMessage(wnd, CB_ADDSTRING, 0, (LPARAM) "Files: cp1251");
    SendMessage(wnd, CB_ADDSTRING, 0, (LPARAM) "Files: utf-8");
    ComboBox_SetCurSel (wnd, 0);

    wnd = CreateWindowEx(0x00000000, "Button", "Search", 0x50020007, 0, 284, 692, 60, parent, (HMENU) IDC_GROUP0, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    //wnd = CreateWindowEx(0x00000000, "ComboBox", "", 0x50010202, 164, 296, 314, 121, parent, (HMENU) IDC_TXT, instance, NULL);
    wnd = CreateWindowEx(0x00000200, "Edit", "", 0x50010000, 164, 296, 314, 21, parent, (HMENU) IDC_TXT, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    Edit_LimitText (wnd, LINE_LEN-1);
    oldsearchInputProc = (WNDPROC)SetWindowLongPtr(wnd, GWLP_WNDPROC, (LONG_PTR)searchInputProc);

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

    wnd = CreateWindowEx(0x00000200, "SysListView32", "", 0x5001800D | LVS_SINGLESEL | LVS_NOLABELWRAP | WS_VSCROLL, 0, 328, 692, 262, parent, (HMENU) IDC_LISTVIEW0, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font_code, TRUE);
    hResult = wnd;
    col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    col.fmt = LVCFMT_LEFT;
    col.iSubItem = 0;
    col.cx = 200;
    col.pszText = "File";
    ListView_InsertColumn (wnd, 0, &col);

    col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    col.fmt = LVCFMT_LEFT;
    col.iSubItem = 1;
    col.cx = 500;
    col.pszText = "Text";
    ListView_InsertColumn (wnd, 1, &col);

    col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    col.fmt = LVCFMT_LEFT;
    col.iSubItem = 2;
    col.cx = 50;
    col.pszText = "Offset";
    ListView_InsertColumn (wnd, 2, &col);

    col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
    col.fmt = LVCFMT_LEFT;
    col.iSubItem = 3;
    col.cx = 50;
    col.pszText = "File name";
    ListView_InsertColumn (wnd, 3, &col);

    ListView_SetExtendedListViewStyleEx (wnd, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
    //ListView_SetExtendedListViewStyleEx (wnd, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);

    wnd = CreateWindowEx(0x00000000, "msctls_statusbar32", "", 0x50000000, 0, 593, 692, 20, parent, (HMENU) IDC_STATUS0, instance, NULL);
    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font, TRUE);
    int nParts[2] = {550, -1};
    SendMessage(wnd,SB_SETPARTS,2,(LPARAM)&nParts);
    hStatus = wnd;

    //LoadLibrary(TEXT("riched32.dll"));
    LoadLibrary(TEXT("riched20.dll"));
    //LoadLibrary(TEXT("Msftedit.dll"));

    wnd = CreateWindowEx(WS_EX_CLIENTEDGE, RICHEDIT_CLASS, "",
        WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL |
        ES_MULTILINE/* | ES_NOHIDESEL*/ | ES_WANTRETURN | ES_DISABLENOSCROLL | ES_SELECTIONBAR,
        270, 0, 402, 282,
        parent, (HMENU) IDC_RTF, instance, NULL);

    SendMessage(wnd, WM_SETFONT, (WPARAM) h_font_code, TRUE);
    hRTF = wnd;
    set_rtf_font ();
    Edit_LimitText (wnd, -1);
}
Пример #5
0
/*
 * OnCommand()
 */
void m_OnCommand(HWND setupDlg, int cmdID, HWND control, UINT notify)
{
    MMRESULT error;

    switch (cmdID) {
        case IDC_MIDI_TEST_BTN:
            if (Midi_NoteOn(m_midi, 60, 100) == MMSYSERR_NOERROR) {
                SleepEx(500, FALSE);
                Midi_NoteOff(m_midi, 60);
                SleepEx(50, FALSE);
            }
            break;
        case IDOK:
            /*
             * Copy the port names into the MIDI structure.  The combo boxes
             * need to be set again in case a midi open error occurred and
             * wound up disabling one of the ports.
             */
            ComboBox_SetCurSel(m_inPortCbo, m_midi->inPort + 1);
            ComboBox_SetCurSel(m_outPortCbo, m_midi->outPort + 1);
            ComboBox_SetCurSel(m_masterInPortCbo, m_midi->masterInPort + 1);
            ComboBox_GetText(m_inPortCbo, m_midi->inPortName
                    , MIDI_PORT_NAME_MAX);
            ComboBox_GetText(m_outPortCbo, m_midi->outPortName
                    , MIDI_PORT_NAME_MAX);
            ComboBox_GetText(m_masterInPortCbo, m_midi->masterInPortName
                    , MIDI_PORT_NAME_MAX);
            /*
             * Fall through.
             */
        case IDCANCEL:
            /*
             * Close the midi setup dialog.
             */
            EndDialog(setupDlg, cmdID == IDOK);
            break;
        case IDC_MIDI_IN_PORT_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Close the midi in port.
                 */
                if (m_midi->midiIn) {
                    Midi_InClose(m_midi);
                }
                /*
                 * Get the port information from the in port combo box.
                 */
                m_midi->inPort = ComboBox_GetCurSel(m_inPortCbo) - 1;
                /*
                 * Disable/enable the channel combo box if the port is
                 * disabled/enabled.
                 */
                EnableWindow(m_inChannelCbo, m_midi->inPort == -1 ? FALSE
                        : TRUE);
                /*
                 * Reopen the midi in port with the new setting.
                 */
                if (error = Midi_InOpen(m_midi)) {
                    Error_MidiError(setupDlg, Error_cannotOpenMidiIn, error);
                    m_midi->inPort = -1;
                    ComboBox_SetCurSel(m_inPortCbo, 0);
                }
            }
            break;
        case IDC_MIDI_OUT_PORT_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Close the midi out port.
                 */
                if (m_midi->midiOut) {
                    Midi_OutClose(m_midi);
                }
                /*
                 * Get the output port from the out port combo box.
                 */
                m_midi->outPort = ComboBox_GetCurSel(m_outPortCbo) - 1;
                /*
                 * Disable/enable the output channel depending on the output
                 * port.
                 */
                EnableWindow(m_outChannelCbo, m_midi->outPort == -1 ? FALSE
                        : TRUE);
                /*
                 * Reopen the output port with the new setting.
                 */
                if (error = Midi_OutOpen(m_midi)) {
                    Error_MidiError(setupDlg, Error_cannotOpenMidiOut, error);
                    m_midi->outPort = -1;
                    ComboBox_SetCurSel(m_outPortCbo, 0);
                }
            }
            break;
        case IDC_MIDI_MASTER_PORT_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Close the master controller port.
                 */
                if (m_midi->midiMasterIn) {
                    Midi_MasterInClose(m_midi);
                }
                /*
                 * Get the new master controller port from the combo box.
                 */
                m_midi->masterInPort = ComboBox_GetCurSel(m_masterInPortCbo)
                    - 1;
                /*
                 * Open the master controller port with the new setting.
                 */
                if (error = Midi_MasterInOpen(m_midi)) {
                    Error_MidiError(setupDlg, Error_cannotOpenMidiMasterIn
                            , error);
                    m_midi->masterInPort = -1;
                    ComboBox_SetCurSel(m_masterInPortCbo, 0);
                }
            }
            break;
        case IDC_MIDI_IN_CHANNEL_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Store the midi in channel in the midi structure as the user
                 * changes it.
                 */
                m_midi->inChannel = ComboBox_GetCurSel(m_inChannelCbo);
            }
            break;
        case IDC_MIDI_OUT_CHANNEL_CBO:
            if (notify == CBN_SELCHANGE) {
                /*
                 * Store the midi out channel in the midi structure as the user
                 * changes it.
                 */
                m_midi->outChannel = ComboBox_GetCurSel(m_outChannelCbo);
            }
            break;
    }
}
Пример #6
0
//==============================================================================
BOOL CALLBACK Slot1Box_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
	switch(msg)
	{
		case WM_INITDIALOG: 
		{
			OKbutton_slot1 = GetDlgItem(dialog, IDOK);
			for(int i = 0; i < NDS_SLOT1_COUNT; i++)
				ComboBox_AddString(GetDlgItem(dialog, IDC_ADDONS_LIST), slot1_List[i]->info()->name());
			ComboBox_SetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST), temp_type_slot1);
			SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), slot1_List[temp_type_slot1]->info()->descr());

			_OKbutton_slot1 = false;
			wndConfigSlot1 = CreateDialogW(hAppInst, MAKEINTRESOURCEW(Slot1_IDDs[temp_type_slot1]), dialog, (DLGPROC)Slot1_Procs[temp_type_slot1]);
			//SetWindowPos(GetDlgItem(dialog, IDC_ADDONS_INFO),HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
			//EnableWindow(GetDlgItem(dialog, IDC_ADDONS_INFO),FALSE);
			//EnableWindow(GetDlgItem(dialog, IDC_ADDONS_INFO),TRUE);
			if ( (temp_type_slot1 == 0) || (_OKbutton_slot1) )
				EnableWindow(OKbutton_slot1, TRUE);
			else
				EnableWindow(OKbutton_slot1, FALSE);
			return TRUE;
		}
	
		case WM_COMMAND:
		{
			switch (LOWORD(wparam))
			{
				case IDOK:
					{
						int Msg = IDYES;
						//zero 30-aug-2012 - do we really need to reset whenever we change the slot 1 device? why should resetting matter? if thats what you want to do, then do it.
						//if (romloaded && (needReset_slot1 || (temp_type_slot1!=slot1_device_type)) )
						//{
						//	Msg = MessageBox(dialog, 
						//			"After change slot1 device game will reset!\nAre you sure to continue?", "DeSmuME",
						//			MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2);
						//}
						if (Msg == IDYES)
						{
							if (wndConfigSlot1) DestroyWindow(wndConfigSlot1);
							EndDialog(dialog, TRUE);
						}
					}
				return TRUE;
				case IDCANCEL:
					if (wndConfigSlot1) DestroyWindow(wndConfigSlot1);
					EndDialog(dialog, FALSE);
				return TRUE;

				case IDC_ADDONS_LIST:
					if (HIWORD(wparam) == CBN_SELENDOK)
					{
						temp_type_slot1 = (NDS_SLOT1_TYPE)ComboBox_GetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST));
						if (temp_type_slot1 != last_type_slot1)
						{
							if (wndConfigSlot1) 
							{
								DestroyWindow(wndConfigSlot1);
								wndConfigSlot1 = NULL;
							}
							_OKbutton_slot1 = false;
							wndConfigSlot1=CreateDialogW(hAppInst, 
								MAKEINTRESOURCEW(Slot1_IDDs[temp_type_slot1]), dialog, 
								(DLGPROC)Slot1_Procs[temp_type_slot1]);
							if ( (temp_type_slot1 == 0) || (_OKbutton_slot1) )
								EnableWindow(OKbutton_slot1, TRUE);
							else
								EnableWindow(OKbutton_slot1, FALSE);
							SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), slot1_List[temp_type_slot1]->info()->descr());
							last_type_slot1 = temp_type_slot1;
						}
					}
				return TRUE;
			}
			break;
		}
	}
	return FALSE;
}
Пример #7
0
/*------------------------------------------------
  Dialog procedure
--------------------------------------------------*/
INT_PTR CALLBACK Page_Color(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message) {
	case WM_INITDIALOG:
		OnInit(hDlg);
		return TRUE;
	case WM_DESTROY:{
		HFONT hfontb=(HFONT)SendDlgItemMessage(hDlg,IDC_BOLD,WM_GETFONT,0,0);
		HFONT hfonti=(HFONT)SendDlgItemMessage(hDlg,IDC_ITALIC,WM_GETFONT,0,0);
		SendDlgItemMessage(hDlg,IDC_BOLD,WM_SETFONT,0,0);
		SendDlgItemMessage(hDlg,IDC_ITALIC,WM_SETFONT,0,0);
		DeleteObject(hfontb);
		DeleteObject(hfonti);
		break;}
	case WM_MEASUREITEM:
		return ColorBox_OnMeasureItem(wParam, lParam);
	case WM_DRAWITEM:
		return ColorBox_OnDrawItem(wParam, lParam);
	case WM_COMMAND: {
		WORD id=LOWORD(wParam);
		switch(HIWORD(wParam)){
		case CBN_SELCHANGE:
			if(id==IDC_COLFORE || id==IDC_COLBACK || id==IDC_FONT || id==IDC_FONTQUAL || id==IDC_FONTSIZE){
				if(id==IDC_FONT) SetComboFontSize(hDlg, FALSE);
				SendPSChanged(hDlg);
			} break;
		case CBN_EDITCHANGE:
			if(id==IDC_FONTSIZE)
				SendPSChanged(hDlg);
			break;
		case EN_CHANGE:
			if(id==IDC_CLOCKHEIGHT || id==IDC_CLOCKWIDTH || id==IDC_ALPHATB || id==IDC_VERTPOS || id==IDC_LINEHEIGHT || id==IDC_HORIZPOS || id==IDC_ANGLE){
				SendPSChanged(hDlg);
			} break;
		default:
			if(id==IDC_COLFORE_BTN || id==IDC_COLBACK_BTN){
				ColorBox_ChooseColor((HWND)lParam);
			}else if(id==IDC_CHOOSEFONT){
				HWND hwndCombo;
				HDC hdc;
				wchar_t size[8];
				LOGFONT lf = {0};
				CHOOSEFONT chosenfont = {sizeof(CHOOSEFONT)};
				chosenfont.hwndOwner = hDlg;
				chosenfont.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_PRINTERFONTS | CF_SCREENFONTS;
				chosenfont.lpLogFont = &lf;
				hwndCombo = GetDlgItem(hDlg,IDC_FONTSIZE);
				ComboBox_GetText(hwndCombo, size, _countof(size));
				hdc = GetDC(NULL);
				lf.lfWeight = IsDlgButtonChecked(hDlg, IDC_BOLD) ? FW_BOLD : FW_REGULAR;
				lf.lfItalic = (BYTE)IsDlgButtonChecked(hDlg, IDC_ITALIC);
				lf.lfHeight = -MulDiv(_wtoi(size), GetDeviceCaps(hdc,LOGPIXELSY), 72);
				ReleaseDC(NULL, hdc);
				hwndCombo = GetDlgItem(hDlg,IDC_FONT);
				ComboBox_GetText(hwndCombo, lf.lfFaceName, _countof(lf.lfFaceName));
				if(ChooseFont(&chosenfont)){
					int sel;
					CheckDlgButton(hDlg, IDC_BOLD, (chosenfont.lpLogFont->lfWeight >= FW_SEMIBOLD));
					CheckDlgButton(hDlg, IDC_ITALIC, chosenfont.lpLogFont->lfItalic);
					ComboBox_SelectString(hwndCombo, -1, chosenfont.lpLogFont->lfFaceName);
					hwndCombo = GetDlgItem(hDlg,IDC_FONTSIZE);
					wsprintf(size, FMT("%d"), chosenfont.iPointSize/10);
					sel = ComboBox_FindStringExact(hwndCombo, -1, size);
					if(sel != CB_ERR)
						ComboBox_SetCurSel(hwndCombo, sel);
					else
						ComboBox_SetText(hwndCombo, size);
					SendPSChanged(hDlg);
				}
			}else if(id==IDC_BOLD || id==IDC_ITALIC)
				SendPSChanged(hDlg);
		}
		return TRUE;}
	case WM_NOTIFY:{
		PSHNOTIFY* notify=(PSHNOTIFY*)lParam;
		switch(notify->hdr.code) {
		case PSN_APPLY:
			OnApply(hDlg,0);
			if(notify->lParam)
				m_transition=-1;
			break;
		case PSN_RESET:
			if(m_transition==1){
				SendMessage(g_hwndClock, CLOCKM_REFRESHCLOCK, 0, 0);
				SendMessage(g_hwndClock, CLOCKM_REFRESHTASKBAR, 0, 0);
				api.DelKey(L"Preview");
			}
			m_transition=-1;
			break;
		}
		return TRUE;}
	}
	return FALSE;
}
Пример #8
0
/*
 * Refresh the list of USB devices
 */
BOOL GetUSBDevices(DWORD devnum)
{
	// The first two are standard Microsoft drivers (including the Windows 8 UASP one).
	// The rest are the vendor UASP drivers I know of so far - list may be incomplete!
	const char* storage_name[] = { "USBSTOR", "UASPSTOR", "VUSBSTOR", "ETRONSTOR", "ASUSSTPT" };
	const char* scsi_name = "SCSI";
	const char* usb_speed_name[USB_SPEED_MAX] = { "USB", "USB 1.0", "USB 1.1", "USB 2.0", "USB 3.0" };
	// Hash table and String Array used to match a Device ID with the parent hub's Device Interface Path
	htab_table htab_devid = HTAB_EMPTY;
	StrArray dev_if_path;
	char letter_name[] = " (?:)";
	char uefi_togo_check[] = "?:\\EFI\\Rufus\\ntfs_x64.efi";
	BOOL r = FALSE, found = FALSE, is_SCSI, post_backslash;
	HDEVINFO dev_info = NULL;
	SP_DEVINFO_DATA dev_info_data;
	SP_DEVICE_INTERFACE_DATA devint_data;
	PSP_DEVICE_INTERFACE_DETAIL_DATA_A devint_detail_data;
	DEVINST parent_inst, grandparent_inst, device_inst;
	DWORD size, i, j, k, l, datatype, drive_index;
	ULONG list_size[ARRAYSIZE(storage_name)] = { 0 }, list_start[ARRAYSIZE(storage_name)] = { 0 }, full_list_size, ulFlags;
	HANDLE hDrive;
	LONG maxwidth = 0;
	int s, score, drive_number, remove_drive;
	char drive_letters[27], *device_id, *devid_list = NULL, entry_msg[128];
	char *label, *entry, buffer[MAX_PATH], str[MAX_PATH], *method_str;
	usb_device_props props;

	IGNORE_RETVAL(ComboBox_ResetContent(hDeviceList));
	StrArrayClear(&DriveID);
	StrArrayClear(&DriveLabel);
	StrArrayCreate(&dev_if_path, 128);
	// Add a dummy for string index zero, as this is what non matching hashes will point to
	StrArrayAdd(&dev_if_path, "");

	device_id = (char*)malloc(MAX_PATH);
	if (device_id == NULL)
		goto out;

	// Build a hash table associating a CM Device ID of an USB device with the SetupDI Device Interface Path
	// of its parent hub - this is needed to retrieve the device speed
	dev_info = SetupDiGetClassDevsA(&_GUID_DEVINTERFACE_USB_HUB, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE);
	if (dev_info != INVALID_HANDLE_VALUE) {
		if (htab_create(DEVID_HTAB_SIZE, &htab_devid)) {
			dev_info_data.cbSize = sizeof(dev_info_data);
			for (i=0; SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data); i++) {
				uuprintf("Processing Hub %d:", i + 1);
				devint_detail_data = NULL;
				devint_data.cbSize = sizeof(devint_data);
				// Only care about the first interface (MemberIndex 0)
				if ( (SetupDiEnumDeviceInterfaces(dev_info, &dev_info_data, &_GUID_DEVINTERFACE_USB_HUB, 0, &devint_data))
				  && (!SetupDiGetDeviceInterfaceDetailA(dev_info, &devint_data, NULL, 0, &size, NULL))
				  && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
				  && ((devint_detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA_A)calloc(1, size)) != NULL) ) {
					devint_detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
					if (SetupDiGetDeviceInterfaceDetailA(dev_info, &devint_data, devint_detail_data, size, &size, NULL)) {

						// Find the Device IDs for all the children of this hub
						if (CM_Get_Child(&device_inst, dev_info_data.DevInst, 0) == CR_SUCCESS) {
							device_id[0] = 0;
							s = StrArrayAdd(&dev_if_path, devint_detail_data->DevicePath);
							uuprintf("  Hub[%d] = '%s'", s, devint_detail_data->DevicePath);
							if ((s>= 0) && (CM_Get_Device_IDA(device_inst, device_id, MAX_PATH, 0) == CR_SUCCESS)) {
								if ((k = htab_hash(device_id, &htab_devid)) != 0) {
									htab_devid.table[k].data = (void*)(uintptr_t)s;
								}
								uuprintf("  Found ID[%03d]: %s", k, device_id);
								while (CM_Get_Sibling(&device_inst, device_inst, 0) == CR_SUCCESS) {
									device_id[0] = 0;
									if (CM_Get_Device_IDA(device_inst, device_id, MAX_PATH, 0) == CR_SUCCESS) {
										if ((k = htab_hash(device_id, &htab_devid)) != 0) {
											htab_devid.table[k].data = (void*)(uintptr_t)s;
										}
										uuprintf("  Found ID[%03d]: %s", k, device_id);
									}
								}
							}
						}
					}
					free(devint_detail_data);
				}
			}
		}
		SetupDiDestroyDeviceInfoList(dev_info);
	}
	free(device_id);

	// Build a single list of Device IDs from all the storage enumerators we know of
	full_list_size = 0;
	ulFlags = CM_GETIDLIST_FILTER_SERVICE;
	if (nWindowsVersion >= WINDOWS_7)
		ulFlags |= CM_GETIDLIST_FILTER_PRESENT;
	for (s=0; s<ARRAYSIZE(storage_name); s++) {
		// Get a list of device IDs for all USB storage devices
		// This will be used to find if a device is UASP
		if (CM_Get_Device_ID_List_SizeA(&list_size[s], storage_name[s], ulFlags) != CR_SUCCESS)
			list_size[s] = 0;
		if (list_size[s] != 0)
			full_list_size += list_size[s]-1;	// remove extra NUL terminator
	}
	devid_list = NULL;
	if (full_list_size != 0) {
		full_list_size += 1;	// add extra NUL terminator
		devid_list = (char*)malloc(full_list_size);
		if (devid_list == NULL) {
			uprintf("Could not allocate Device ID list\n");
			return FALSE;
		}
		for (s=0, i=0; s<ARRAYSIZE(storage_name); s++) {
			list_start[s] = i;
			if (list_size[s] > 1) {
				if (CM_Get_Device_ID_ListA(storage_name[s], &devid_list[i], list_size[s], ulFlags) != CR_SUCCESS)
					continue;
				if (usb_debug) {
					uprintf("Processing IDs belonging to %s:", storage_name[s]);
					for (device_id = &devid_list[i]; *device_id != 0; device_id += strlen(device_id) + 1)
						uprintf("  %s", device_id);
				}
				// The list_size is sometimes larger than required thus we need to find the real end
				for (i += list_size[s]; i > 2; i--) {
					if ((devid_list[i-2] != '\0') && (devid_list[i-1] == '\0') && (devid_list[i] == '\0'))
						break;
				}
			}
		}
	}

	// Now use SetupDi to enumerate all our storage devices
	dev_info = SetupDiGetClassDevsA(&_GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE);
	if (dev_info == INVALID_HANDLE_VALUE) {
		uprintf("SetupDiGetClassDevs (Interface) failed: %s\n", WindowsErrorString());
		goto out;
	}
	dev_info_data.cbSize = sizeof(dev_info_data);
	for (i=0; SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data); i++) {
		memset(buffer, 0, sizeof(buffer));
		method_str = "";
		if (!SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_ENUMERATOR_NAME,
				&datatype, (LPBYTE)buffer, sizeof(buffer), &size)) {
			uprintf("SetupDiGetDeviceRegistryProperty (Enumerator Name) failed: %s\n", WindowsErrorString());
			continue;
		}
		// UASP drives are listed under SCSI (along with regular SYSTEM drives => "DANGER, WILL ROBINSON!!!")
		is_SCSI = (safe_stricmp(buffer, scsi_name) == 0);
		if ((safe_stricmp(buffer, storage_name[0]) != 0) && (!is_SCSI))
			continue;

		// We can't use the friendly name to find if a drive is a VHD, as friendly name string gets translated
		// according to your locale, so we poke the Hardware ID
		memset(&props, 0, sizeof(props));
		memset(buffer, 0, sizeof(buffer));
		props.is_VHD = SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_HARDWAREID,
			&datatype, (LPBYTE)buffer, sizeof(buffer), &size) && IsVHD(buffer);
		uuprintf("Processing Device: '%s'", buffer);

		memset(buffer, 0, sizeof(buffer));
		if (!SetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_FRIENDLYNAME,
				&datatype, (LPBYTE)buffer, sizeof(buffer), &size)) {
			uprintf("SetupDiGetDeviceRegistryProperty (Friendly Name) failed: %s\n", WindowsErrorString());
			// We can afford a failure on this call - just replace the name with "USB Storage Device (Generic)"
			safe_strcpy(buffer, sizeof(buffer), lmprintf(MSG_045));
		} else if ((!props.is_VHD) && (devid_list != NULL)) {
			// Get the properties of the device. We could avoid doing this lookup every time by keeping
			// a lookup table, but there shouldn't be that many USB storage devices connected...
			// NB: Each of these Device IDs have an _only_ child, from which we get the Device Instance match.
			for (device_id = devid_list; *device_id != 0; device_id += strlen(device_id) + 1) {
				if ( (CM_Locate_DevNodeA(&parent_inst, device_id, 0) == CR_SUCCESS)
				  && (CM_Get_Child(&device_inst, parent_inst, 0) == CR_SUCCESS)
				  && (device_inst == dev_info_data.DevInst) ) {
					post_backslash = FALSE;
					method_str = "";

					// If we're not dealing with the USBSTOR part of our list, then this is an UASP device
					props.is_UASP = ((((uintptr_t)device_id)+2) >= ((uintptr_t)devid_list)+list_start[1]);
					// Now get the properties of the device, and its Device ID, which we need to populate the properties
					j = htab_hash(device_id, &htab_devid);
					uuprintf("  Matched with ID[%03d]: %s", j, device_id);

					// Try to parse the current device_id string for VID:PID
					// We'll use that if we can't get anything better
					for (k = 0, l = 0; (k<strlen(device_id)) && (l<2); k++) {
						// The ID is in the form USB_VENDOR_BUSID\VID_xxxx&PID_xxxx\...
						if (device_id[k] == '\\')
							post_backslash = TRUE;
						if (!post_backslash)
							continue;
						if (device_id[k] == '_') {
							props.pid = (uint16_t)strtoul(&device_id[k + 1], NULL, 16);
							if (l++ == 0)
								props.vid = props.pid;
						}
					}
					if (props.vid != 0)
						method_str = "[ID]";

					// If the hash didn't match a populated string in dev_if_path[] (htab_devid.table[j].data > 0),
					// we might have an extra vendor driver in between (e.g. "ASUS USB 3.0 Boost Storage Driver"
					// for UASP devices in ASUS "Turbo Mode" or "Apple Mobile Device USB Driver" for iPods)
					// so try to see if we can match the grandparent.
					if ( ((uintptr_t)htab_devid.table[j].data == 0)
					  && (CM_Get_Parent(&grandparent_inst, parent_inst, 0) == CR_SUCCESS)
					  && (CM_Get_Device_IDA(grandparent_inst, str, MAX_PATH, 0) == CR_SUCCESS) ) {
						device_id = str;
						method_str = "[GP]";
						j = htab_hash(device_id, &htab_devid);
						uuprintf("  Matched with (GP) ID[%03d]: %s", j, device_id);
					}
					if ((uintptr_t)htab_devid.table[j].data > 0) {
						uuprintf("  Matched with Hub[%d]: '%s'", (uintptr_t)htab_devid.table[j].data,
								dev_if_path.String[(uintptr_t)htab_devid.table[j].data]);
						if (GetUSBProperties(dev_if_path.String[(uintptr_t)htab_devid.table[j].data], device_id, &props))
							method_str = "";
#ifdef FORCED_DEVICE
						props.vid = FORCED_VID;
						props.pid = FORCED_PID;
						safe_strcpy(buffer, sizeof(buffer), FORCED_NAME);
#endif
					}
					break;
				}
			}
		}
		if (props.is_VHD) {
			uprintf("Found VHD device '%s'", buffer);
		} else {
			if ((props.vid == 0) && (props.pid == 0)) {
				if (is_SCSI) {
					// If we have an SCSI drive and couldn't get a VID:PID, we are most likely
					// dealing with a system drive => eliminate it!
					uuprintf("  Non USB => Eliminated");
					continue;
				}
				safe_strcpy(str, sizeof(str), "????:????");	// Couldn't figure VID:PID
			} else {
				static_sprintf(str, "%04X:%04X", props.vid, props.pid);
			}
			if (props.speed >= USB_SPEED_MAX)
				props.speed = 0;
			uprintf("Found %s%s%s device '%s' (%s) %s\n", props.is_UASP?"UAS (":"",
				usb_speed_name[props.speed], props.is_UASP?")":"", buffer, str, method_str);
			if (props.is_LowerSpeed)
				uprintf("NOTE: This device is an USB 3.0 device operating at lower speed...");
		}
		devint_data.cbSize = sizeof(devint_data);
		hDrive = INVALID_HANDLE_VALUE;
		devint_detail_data = NULL;
		for (j=0; ;j++) {
			safe_closehandle(hDrive);
			safe_free(devint_detail_data);

			if (!SetupDiEnumDeviceInterfaces(dev_info, &dev_info_data, &_GUID_DEVINTERFACE_DISK, j, &devint_data)) {
				if(GetLastError() != ERROR_NO_MORE_ITEMS) {
					uprintf("SetupDiEnumDeviceInterfaces failed: %s\n", WindowsErrorString());
				} else {
					uprintf("A device was eliminated because it didn't report itself as a disk\n");
				}
				break;
			}

			if (!SetupDiGetDeviceInterfaceDetailA(dev_info, &devint_data, NULL, 0, &size, NULL)) {
				if(GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
					devint_detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA_A)calloc(1, size);
					if (devint_detail_data == NULL) {
						uprintf("Unable to allocate data for SP_DEVICE_INTERFACE_DETAIL_DATA\n");
						continue;
					}
					devint_detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
				} else {
					uprintf("SetupDiGetDeviceInterfaceDetail (dummy) failed: %s\n", WindowsErrorString());
					continue;
				}
			}
			if (devint_detail_data == NULL) {
				uprintf("SetupDiGetDeviceInterfaceDetail (dummy) - no data was allocated\n");
				continue;
			}
			if(!SetupDiGetDeviceInterfaceDetailA(dev_info, &devint_data, devint_detail_data, size, &size, NULL)) {
				uprintf("SetupDiGetDeviceInterfaceDetail (actual) failed: %s\n", WindowsErrorString());
				continue;
			}

			hDrive = CreateFileA(devint_detail_data->DevicePath, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ,
				NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
			if(hDrive == INVALID_HANDLE_VALUE) {
				uprintf("Could not open '%s': %s\n", devint_detail_data->DevicePath, WindowsErrorString());
				continue;
			}

			drive_number = GetDriveNumber(hDrive, devint_detail_data->DevicePath);
			if (drive_number < 0)
				continue;

			drive_index = drive_number + DRIVE_INDEX_MIN;
			if (!IsMediaPresent(drive_index)) {
				uprintf("Device eliminated because it appears to contain no media\n");
				safe_closehandle(hDrive);
				safe_free(devint_detail_data);
				break;
			}

			if (GetDriveLabel(drive_index, drive_letters, &label)) {
				if ((!enable_HDDs) && (!props.is_VHD) &&
					((score = IsHDD(drive_index, (uint16_t)props.vid, (uint16_t)props.pid, buffer)) > 0)) {
					uprintf("Device eliminated because it was detected as an USB Hard Drive (score %d > 0)\n", score);
					uprintf("If this device is not an USB Hard Drive, please e-mail the author of this application\n");
					uprintf("NOTE: You can enable the listing of USB Hard Drives in 'Advanced Options' (after clicking the white triangle)");
					safe_closehandle(hDrive);
					safe_free(devint_detail_data);
					break;
				}

				// The empty string is returned for drives that don't have any volumes assigned
				if (drive_letters[0] == 0) {
					entry = lmprintf(MSG_046, label, drive_number,
						SizeToHumanReadable(GetDriveSize(drive_index), FALSE, use_fake_units));
				} else {
					// Find the UEFI:TOGO partition(s) (and eliminate them form our listing)
					for (k=0; drive_letters[k]; k++) {
						uefi_togo_check[0] = drive_letters[k];
						if (PathFileExistsA(uefi_togo_check)) {
							for (l=k; drive_letters[l]; l++)
								drive_letters[l] = drive_letters[l+1];
							k--;
						}
					}
					// We have multiple volumes assigned to the same device (multiple partitions)
					// If that is the case, use "Multiple Volumes" instead of the label
					safe_strcpy(entry_msg, sizeof(entry_msg), (((drive_letters[0] != 0) && (drive_letters[1] != 0))?
						lmprintf(MSG_047):label));
					for (k=0, remove_drive=0; drive_letters[k] && (!remove_drive); k++) {
						// Append all the drive letters we detected
						letter_name[2] = drive_letters[k];
						if (right_to_left_mode)
							safe_strcat(entry_msg, sizeof(entry_msg), RIGHT_TO_LEFT_MARK);
						safe_strcat(entry_msg, sizeof(entry_msg), letter_name);
						if (drive_letters[k] == (PathGetDriveNumberU(app_dir) + 'A'))
							remove_drive = 1;
						if (drive_letters[k] == (PathGetDriveNumberU(system_dir) + 'A'))
							remove_drive = 2;
					}
					// Make sure that we don't list any drive that should not be listed
					if (remove_drive) {
						uprintf("Removing %C: from the list: This is the %s!", drive_letters[--k],
							(remove_drive==1)?"disk from which " APPLICATION_NAME " is running":"system disk");
						safe_closehandle(hDrive);
						safe_free(devint_detail_data);
						break;
					}
					safe_sprintf(&entry_msg[strlen(entry_msg)], sizeof(entry_msg) - strlen(entry_msg),
						"%s [%s]", (right_to_left_mode)?RIGHT_TO_LEFT_MARK:"", SizeToHumanReadable(GetDriveSize(drive_index), FALSE, use_fake_units));
					entry = entry_msg;
				}

				// Must ensure that the combo box is UNSORTED for indexes to be the same
				StrArrayAdd(&DriveID, buffer);
				StrArrayAdd(&DriveLabel, label);

				IGNORE_RETVAL(ComboBox_SetItemData(hDeviceList, ComboBox_AddStringU(hDeviceList, entry), drive_index));
				maxwidth = max(maxwidth, GetEntryWidth(hDeviceList, entry));
				safe_closehandle(hDrive);
				safe_free(devint_detail_data);
				break;
			}
		}
	}
	SetupDiDestroyDeviceInfoList(dev_info);

	// Adjust the Dropdown width to the maximum text size
	SendMessage(hDeviceList, CB_SETDROPPEDWIDTH, (WPARAM)maxwidth, 0);

	if (devnum >= DRIVE_INDEX_MIN) {
		for (i=0; i<ComboBox_GetCount(hDeviceList); i++) {
			if ((DWORD)ComboBox_GetItemData(hDeviceList, i) == devnum) {
				found = TRUE;
				break;
			}
		}
	}
	if (!found)
		i = 0;
	IGNORE_RETVAL(ComboBox_SetCurSel(hDeviceList, i));
	SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_DEVICE, 0);
	SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
		ComboBox_GetCurSel(hFileSystem));
	r = TRUE;

out:
	// Set 'Start' as the selected button, so that tab selection works
	SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE);
	safe_free(devid_list);
	StrArrayDestroy(&dev_if_path);
	htab_destroy(&htab_devid);
	return r;
}
INT_PTR CALLBACK TrackingUIProc(HWND hwndTrk, UINT message, WPARAM wParam, LPARAM lParam)
{ 	
	switch (message)
	{ 
    case WM_INITDIALOG:
		{
			g_hWndTrack = hwndTrk;
		
			LVCOLUMN column;
			column.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH;
			column.cx = 50;
			column.iSubItem = 0;
			column.pszText = L"ID";
			ListView_InsertColumn(GetControl(IDC_MODELS), 0, &column);
			column.cx = 400;
			column.iSubItem = 1;
			column.pszText = L"File";
			ListView_InsertColumn(GetControl(IDC_MODELS), 1, &column);
				
			HIMAGELIST imgList = ImageList_Create(16, 16, 0, 2, 0);
		
			HBITMAP trackingBmp	   = LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_TRACKING_OK));
			HBITMAP notTrackingBmp = LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_NOT_TRACKING));
				
			ImageList_Add(imgList, notTrackingBmp, NULL);
			ImageList_Add(imgList, trackingBmp, NULL);

			TreeView_SetImageList(GetControl(IDC_MODELS), imgList, TVSIL_NORMAL);

			DeleteObject(trackingBmp);
			DeleteObject(notTrackingBmp);
		
			// Initialize combo tracking box	
			ComboBox_AddString(GetControl(IDC_TRACKINGTYPE), L"3D Tracking");
			ComboBox_SetItemData(GetControl(IDC_TRACKINGTYPE), 0, TRACKING_3D);
			ComboBox_AddString(GetControl(IDC_TRACKINGTYPE), L"2D Tracking");
			ComboBox_SetItemData(GetControl(IDC_TRACKINGTYPE), 1, TRACKING_2D);
			ComboBox_AddString(GetControl(IDC_TRACKINGTYPE), L"3D Instant");
			ComboBox_SetItemData(GetControl(IDC_TRACKINGTYPE), 2, TRACKING_INSTANT);
			ComboBox_SetCurSel(GetControl(IDC_TRACKINGTYPE), 0);
		
			return TRUE; 
		}

	case WM_COMMAND:
        switch (LOWORD(wParam))
		{		
		case IDC_LOADMODEL:
			AddTargetFile();
			return TRUE;
		case IDC_CLEARMODELS:
			ClearModelTree();
			return TRUE;
        }
		
		if (HIWORD(wParam) == CBN_SELCHANGE)
		{
			HWND comboBox = (HWND) lParam;
			int selIndex = ComboBox_GetCurSel(comboBox);
			TrackingType type = (TrackingType) ComboBox_GetItemData(comboBox, selIndex);

			switch (type)
			{
			case TRACKING_2D:
				Button_Enable(GetControl(IDC_START), false);
				Button_Enable(GetControl(IDC_LOADMODEL), true);
				Button_Enable(GetControl(IDC_CLEARMODELS), false);
				Button_Enable(GetControl(IDC_ROI), false);
				Button_SetCheck(GetControl(IDC_ROI), false);
				ClearModelTree();
				return TRUE;		
			case TRACKING_3D:				
				Button_Enable(GetControl(IDC_START), false);
				Button_Enable(GetControl(IDC_LOADMODEL), true);
				Button_Enable(GetControl(IDC_CLEARMODELS), false);
				Button_Enable(GetControl(IDC_ROI), false);
				Button_SetCheck(GetControl(IDC_ROI), false);
				ClearModelTree();			
				return TRUE;
			case TRACKING_INSTANT:				
				ClearModelTree();
				Button_Enable(GetControl(IDC_START),true);
				Button_Enable(GetControl(IDC_LOADMODEL),false);
				Button_Enable(GetControl(IDC_CLEARMODELS), false);
				Button_Enable(GetControl(IDC_ROI), true);
				Button_SetCheck(GetControl(IDC_ROI), false);

				if (!showedMessage)
				{
					showedMessage = true;
					MessageBoxExW(GetParent(hwndTrk), L"Please be aware that instant tracking needs special scene/background setup. Refer to the reference manual for details.", L"Note", MB_OK | MB_ICONINFORMATION, 0);
				}
				return TRUE;
			}
		}
		break;
	case WM_NOTIFY:		
		switch ( ((LPNMHDR) lParam)->code)
		{
			case TVN_GETDISPINFO:
			{
				NMTVDISPINFO *dispInfo = (NMTVDISPINFO*) lParam;			
		
				if (dispInfo->item.mask & LVIF_IMAGE)
				{				
					int targetIndex = dispInfo->item.lParam & 0xFF;
					int cosIDIndex  = (dispInfo->item.lParam & 0xFF00) >> 8;

					if (g_targets[targetIndex].cosIDs[cosIDIndex].isTracking)
					{
						dispInfo->item.iImage = 1;
					}
					else
					{
						dispInfo->item.iImage = 0;
					}				
				}
				return TRUE;
			}			
		}
		break;	
    } 
Пример #10
0
INT_PTR CALLBACK OptionsDlgProc(
    _In_ HWND hwndDlg,
    _In_ UINT uMsg,
    _In_ WPARAM wParam,
    _In_ LPARAM lParam
    )
{
    switch (uMsg)
    {
    case WM_INITDIALOG:
        {
            HWND toolbarCombo = GetDlgItem(hwndDlg, IDC_DISPLAYSTYLECOMBO);
            HWND searchboxCombo = GetDlgItem(hwndDlg, IDC_SEARCHBOX_DISPLAYSTYLECOMBO);

            ComboBox_AddString(toolbarCombo, L"No Text Labels"); // Displays no text label for the toolbar buttons.
            ComboBox_AddString(toolbarCombo, L"Selective Text"); // (Selective Text On Right) Displays text for just the Refresh, Options, Find Handles and Sysinfo toolbar buttons.
            ComboBox_AddString(toolbarCombo, L"Show Text Labels"); // Displays text labels for the toolbar buttons.
            ComboBox_SetCurSel(toolbarCombo, PhGetIntegerSetting(SETTING_NAME_TOOLBARDISPLAYSTYLE));
            
            ComboBox_AddString(searchboxCombo, L"Always show");
            ComboBox_AddString(searchboxCombo, L"Hide when inactive");
            //ComboBox_AddString(searchboxCombo, L"Auto-hide");
            ComboBox_SetCurSel(searchboxCombo, PhGetIntegerSetting(SETTING_NAME_SEARCHBOXDISPLAYMODE));

            Button_SetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_TOOLBAR),
                PhGetIntegerSetting(SETTING_NAME_ENABLE_TOOLBAR) ? BST_CHECKED : BST_UNCHECKED);
            Button_SetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_SEARCHBOX),
                PhGetIntegerSetting(SETTING_NAME_ENABLE_SEARCHBOX) ? BST_CHECKED : BST_UNCHECKED);
            Button_SetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_STATUSBAR),
                PhGetIntegerSetting(SETTING_NAME_ENABLE_STATUSBAR) ? BST_CHECKED : BST_UNCHECKED);
            Button_SetCheck(GetDlgItem(hwndDlg, IDC_RESOLVEGHOSTWINDOWS),
                PhGetIntegerSetting(SETTING_NAME_ENABLE_RESOLVEGHOSTWINDOWS) ? BST_CHECKED : BST_UNCHECKED);
        }
        break;
    case WM_COMMAND:
        {
            switch (GET_WM_COMMAND_ID(wParam, lParam))
            {
            case IDCANCEL:
                EndDialog(hwndDlg, IDCANCEL);
                break;
            case IDC_CUSTOMIZETOOLBAR:
                PostMessage(ToolBarHandle, TB_CUSTOMIZE, 0, 0);
                break;
            case IDOK:
                {
                    PhSetIntegerSetting(SETTING_NAME_TOOLBARDISPLAYSTYLE,
                        (DisplayStyle = (TOOLBAR_DISPLAY_STYLE)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_DISPLAYSTYLECOMBO))));
                    PhSetIntegerSetting(SETTING_NAME_SEARCHBOXDISPLAYMODE,
                        (SearchBoxDisplayMode = (SEARCHBOX_DISPLAY_MODE)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_SEARCHBOX_DISPLAYSTYLECOMBO))));
                    PhSetIntegerSetting(SETTING_NAME_ENABLE_TOOLBAR,
                        (EnableToolBar = Button_GetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_TOOLBAR)) == BST_CHECKED));
                    PhSetIntegerSetting(SETTING_NAME_ENABLE_SEARCHBOX,
                        (EnableSearchBox = Button_GetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_SEARCHBOX)) == BST_CHECKED));
                    PhSetIntegerSetting(SETTING_NAME_ENABLE_STATUSBAR,
                        (EnableStatusBar = Button_GetCheck(GetDlgItem(hwndDlg, IDC_ENABLE_STATUSBAR)) == BST_CHECKED));
                    PhSetIntegerSetting(SETTING_NAME_ENABLE_RESOLVEGHOSTWINDOWS,
                        Button_GetCheck(GetDlgItem(hwndDlg, IDC_RESOLVEGHOSTWINDOWS)) == BST_CHECKED);

                    LoadToolbarSettings();
                    InvalidateRect(ToolBarHandle, NULL, TRUE);

                    EndDialog(hwndDlg, IDOK);
                }
                break;
            }
        }
        break;
    }

    return FALSE;
}
Пример #11
0
static BOOL CALLBACK SpectrumPopupProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{
	switch(msg)
	{
	case WM_INITDIALOG:
		uSetWindowLong(wnd,DWL_USER,lp);
		{
			spec_param * ptr = reinterpret_cast<spec_param*>(lp);
			ptr->m_scope.initialize(FindOwningPopup(wnd));
			uSendDlgItemMessage(wnd, IDC_BARS, BM_SETCHECK, ptr->ptr->mode == MODE_BARS, 0);
			HWND wnd_combo = GetDlgItem(wnd, IDC_FRAME_COMBO);
			EnableWindow(wnd_combo, ptr->b_show_frame);
			if (ptr->b_show_frame)
			{
				ComboBox_AddString(wnd_combo, _T("None"));
				ComboBox_AddString(wnd_combo, _T("Sunken"));
				ComboBox_AddString(wnd_combo, _T("Grey"));
				ComboBox_SetCurSel(wnd_combo, ptr->frame);
			}
			wnd_combo = GetDlgItem(wnd, IDC_SCALE);
			ComboBox_AddString(wnd_combo, _T("Linear"));
			ComboBox_AddString(wnd_combo, _T("Logarithmic"));
			ComboBox_SetCurSel(wnd_combo, ptr->m_scale);

			wnd_combo = GetDlgItem(wnd, IDC_VERTICAL_SCALE);
			ComboBox_AddString(wnd_combo, _T("Linear"));
			ComboBox_AddString(wnd_combo, _T("Logarithmic"));
			ComboBox_SetCurSel(wnd_combo, ptr->m_vertical_scale);
		}
		return TRUE;
	case WM_ERASEBKGND:
		SetWindowLongPtr(wnd, DWL_MSGRESULT, TRUE);
		return TRUE;
	case WM_PAINT:
		ui_helpers::innerWMPaintModernBackground(wnd, GetDlgItem(wnd, IDOK));
		return TRUE;
	case WM_CTLCOLORSTATIC:
		{
			spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
			if (GetDlgItem(wnd, IDC_PATCH_FORE) == (HWND)lp) {
				HDC dc =(HDC)wp;
				if (!ptr->br_fore) 
				{
					ptr->br_fore = CreateSolidBrush(ptr->cr_fore);
				}
				return (BOOL)ptr->br_fore;
			} 
			else if (GetDlgItem(wnd, IDC_PATCH_BACK) == (HWND)lp) 
			{
				HDC dc =(HDC)wp;
				if (!ptr->br_back) 
				{
					ptr->br_back = CreateSolidBrush(ptr->cr_back);
				}
				return (BOOL)ptr->br_back;
			}
			else
			return (BOOL)GetSysColorBrush(COLOR_3DHIGHLIGHT);
		}
		break;
	case WM_COMMAND:
		switch(wp)
		{
		case IDCANCEL:
			EndDialog(wnd,0);
			return TRUE;
		case IDC_CHANGE_BACK:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				COLORREF COLOR = ptr->cr_back;
				COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_BACK),GetSysColor(COLOR_3DFACE),0,0,0,0,0,0,0,0,0,0,0,0,0,0};
				if (uChooseColor(&COLOR, wnd, &COLORS[0]))
				{
					ptr->cr_back = COLOR;
					ptr->flush_back();
					RedrawWindow(GetDlgItem(wnd, IDC_PATCH_BACK), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW);
				}
			}
			break;
		case IDC_CHANGE_FORE:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				COLORREF COLOR = ptr->cr_fore;
				COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_TEXT),GetSysColor(COLOR_3DSHADOW),0,0,0,0,0,0,0,0,0,0,0,0,0,0};
				if (uChooseColor(&COLOR, wnd, &COLORS[0]))
				{
					ptr->cr_fore = COLOR;
					ptr->flush_fore();
					RedrawWindow(GetDlgItem(wnd, IDC_PATCH_FORE), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW);
				}
			}
			break;
		case IDC_BARS:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				ptr->mode = (uSendMessage((HWND)lp, BM_GETCHECK, 0, 0) != TRUE ? MODE_STANDARD : MODE_BARS);
			}
			break;
		case IDC_FRAME_COMBO|(CBN_SELCHANGE<<16):
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				ptr->frame = ComboBox_GetCurSel(HWND(lp));
			}
			break;
		case IDC_SCALE|(CBN_SELCHANGE<<16):
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				ptr->m_scale = ComboBox_GetCurSel(HWND(lp));
			}
			break;
		case IDC_VERTICAL_SCALE|(CBN_SELCHANGE<<16):
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				ptr->m_vertical_scale = ComboBox_GetCurSel(HWND(lp));
			}
			break;
		case IDOK:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				EndDialog(wnd,1);
			}
			return TRUE;
		default:
			return FALSE;
		}
	default:
		return FALSE;
	}
}
Пример #12
0
static BOOL Directories_OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam)
{
    RECT        rectClient;
    LVCOLUMN    LVCol;
    char*       token;
    char        buf[MAX_PATH * MAX_DIRS];
	int			i;

    pDirInfo = (struct tDirInfo*) malloc(sizeof(struct tDirInfo));
    if (pDirInfo == NULL) /* bummer */
    {
        EndDialog(hDlg, -1);
        return FALSE;
    }

	for (i = LASTDIR - 1; i >= 0; i--)
	{
		ComboBox_InsertString(GetDlgItem(hDlg, IDC_DIR_COMBO), 0, dir_names[i]);
	}

    ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_DIR_COMBO), 0);

    GetClientRect(GetDlgItem(hDlg, IDC_DIR_LIST), &rectClient);

    memset(&LVCol, 0, sizeof(LVCOLUMN));
    LVCol.mask    = LVCF_WIDTH;
    LVCol.cx      = rectClient.right - rectClient.left - GetSystemMetrics(SM_CXHSCROLL);
    
    ListView_InsertColumn(GetDlgItem(hDlg, IDC_DIR_LIST), 0, &LVCol);


    /* Keep a temporary copy of the directory strings in pDirInfo. */
    memset(pDirInfo, 0, sizeof(struct tDirInfo));

    strcpy(buf, GetRomDirs());

    pDirInfo->m_Paths[ROM].m_NumDirectories = 0;
    token = strtok(buf, ";");
    while ((DirInfo_NumDir(pDirInfo, ROM) < MAX_DIRS) && token)
    {
        strcpy(DirInfo_Path(pDirInfo, ROM, DirInfo_NumDir(pDirInfo, ROM)), token);
        DirInfo_NumDir(pDirInfo, ROM)++;
        token = strtok(NULL, ";");
    }
    pDirInfo->m_Paths[ROM].m_bModified = FALSE;

    strcpy(buf, GetSampleDirs());

    pDirInfo->m_Paths[SAMPLE].m_NumDirectories = 0;
    token = strtok(buf, ";");
    while ((DirInfo_NumDir(pDirInfo, SAMPLE) < MAX_DIRS) && token)
    {
        strcpy(DirInfo_Path(pDirInfo, SAMPLE, DirInfo_NumDir(pDirInfo, SAMPLE)), token);
        DirInfo_NumDir(pDirInfo, SAMPLE)++;
        token = strtok(NULL, ";");
    }
    pDirInfo->m_Paths[SAMPLE].m_bModified = FALSE;

    strcpy(DirInfo_Dir(pDirInfo, CFG),		GetCfgDir());
    strcpy(DirInfo_Dir(pDirInfo, HI),		GetHiDir());
    strcpy(DirInfo_Dir(pDirInfo, IMG),		GetImgDir());
    strcpy(DirInfo_Dir(pDirInfo, INP),		GetInpDir());
    strcpy(DirInfo_Dir(pDirInfo, STATE),	GetStateDir());
    strcpy(DirInfo_Dir(pDirInfo, ART),		GetArtDir());
	strcpy(DirInfo_Dir(pDirInfo, MEMCARD),	GetMemcardDir());
	strcpy(DirInfo_Dir(pDirInfo, FLYER),	GetFlyerDir());
	strcpy(DirInfo_Dir(pDirInfo, CABINET),	GetCabinetDir());
	strcpy(DirInfo_Dir(pDirInfo, NVRAM),	GetNvramDir());

    UpdateDirectoryList(hDlg);

    return TRUE;
}
Пример #13
0
//控件消息响应函数
void Mini_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
	switch(id)
	{
		//播放/继续按钮响应
		case IDC__btnPLAY:
		{
			//向主窗口发送播放消息
			PostMessage(minphwnd,MINI_CONTROL,MINI_PLAY,0);//
		}
		break;//

		//暂停按钮响应
		case IDC__btnPAUSE:
		{
			//向主窗口发送暂停消息
			PostMessage(minphwnd,MINI_CONTROL,MINI_PAUSE,0);//
		}
		break;//

		//停止按钮响应
		case IDC__btnSTOP:
		{
			//向主窗口发送停止消息
			PostMessage(minphwnd,MINI_CONTROL,MINI_STOP,0);//
		}
		break;//

		//上曲按钮响应
		case IDC__btnLAST:
		{
			//向主窗口发送上一曲消息
			PostMessage(minphwnd,MINI_CONTROL,MINI_LAST,0);//
		}
		break;//

		//下曲按钮响应
		case IDC__btnNEXT:
		{
			//向主窗口发送下一曲消息
			PostMessage(minphwnd,MINI_CONTROL,MINI_NEXT,0);//
		}
		break;//

		//静音复选框响应
		case IDC__SOF:
		{
			//向主窗口发送静音消息
			PostMessage(minphwnd,MINI_CONTROL,MINI_SOF,0);//
		}
		break;//

		//更改播放顺序组合框选中选项响应
		case IDC__COMBOSX:
		{
			if (CBN_SELCHANGE==codeNotify)
			{
				//获取主窗口播放顺序组合框选中选项设置到迷你窗口中
				int i = ComboBox_GetCurSel(GetDlgItem(hwnd,IDC__COMBOSX));
				ComboBox_SetCurSel(GetDlgItem(minphwnd,IDC_COMBOSX),i);// 
			}

			if (CBN_DROPDOWN==codeNotify)
				_isOpen = TRUE; 

			if (CBN_CLOSEUP==codeNotify)
				_isOpen = FALSE; 
		}
		break;//

		default:
		break;
	}
}//
Пример #14
0
//初始化窗口函数
BOOL Mini_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
	//设置透明风格
	COLORREF color = RGB(0,0,0);
	SetWindowLong(hwnd,GWL_EXSTYLE,GetWindowLong(hwnd, GWL_EXSTYLE)|WS_EX_LAYERED);
	SetLayeredWindowAttributes(hwnd,color,255*75/100,LWA_ALPHA);//
	
	//获取主窗口句柄
	minphwnd = (HWND)lParam;//
	//向主窗口发送句柄
	PostMessage(minphwnd,MINI_OPEN,0,(LPARAM)hwnd);//

	//获取窗口坐标
	GetWindowRect(hwnd,&_size);//
	//设置窗口总在最前
	SetWindowPos(hwnd,HWND_TOPMOST,0,0,_ORIGIN_WIDTH,_ORIGIN_HEIGHT,SWP_NOMOVE);//
	//窗口状态为未隐藏
	_isHide = FALSE;//
	//窗口为未吸附边缘状态
	_shouldHide = FALSE;//

	//初始化组合框显示
	//播放顺序组合框初始化
	HWND CBSX = GetDlgItem(hwnd,IDC__COMBOSX);
	ComboBox_InsertString(CBSX,-1,TEXT("单曲循环"));
	ComboBox_InsertString(CBSX,-1,TEXT("列表循环"));
	ComboBox_InsertString(CBSX,-1,TEXT("随机播放"));
	//获取主窗口播放顺序组合框选中选项设置到迷你窗口中
	int i = ComboBox_GetCurSel(GetDlgItem(minphwnd,IDC_COMBOSX));
	ComboBox_SetCurSel(CBSX,i);//

	//静音复选框初始化
	CheckDlgButton(hwnd,IDC__SOF,IsDlgButtonChecked(minphwnd,IDC_SOF));//

	//音量滚动条初始化
	HWND VHK = GetDlgItem(hwnd,IDC__SOUND_SLIDER);
	//设置滚动条最小值为0
	SendMessage(VHK,TBM_SETRANGEMIN,(WPARAM)TRUE,0);//
	//设置滚动条最大值为640 /6.4
	SendMessage(VHK,TBM_SETRANGEMAX,(WPARAM)TRUE,640);//
	//设置按←键时,减小32 /6.4
	SendMessage(VHK,TBM_SETPAGESIZE,0, (LPARAM)32);//
	//设置按→键时,增大32 /6.4
	SendMessage(VHK,TBM_SETLINESIZE,0, (LPARAM)32);//
	//获取主窗口音量滚动条位置设置到迷你窗口音量滚动条上
	int Voice = (int)SendMessage(GetDlgItem(minphwnd,IDC_SOUND_SLIDER),TBM_GETPOS,0,0);
	SendMessage(GetDlgItem(hwnd,IDC__SOUND_SLIDER),TBM_SETPOS,(unsigned long)TRUE,Voice);//

	TCHAR TT[15],*p;
	//获取主窗口时间编辑框中内容
	GetDlgItemText(minphwnd,IDC_EDITTIME,TT,sizeof(TT));//
	p = TT;
	while (*p)
		p++;
	while (*p != '/')
		p--;
	p++;
	//获取总长分数
	int time = atoi(p);//
	p += 3;
	//获取总长秒数并与分数一起转化为毫秒
	time = time*60000 + (atoi(p)-1)*1000;//

	//播放进度滚动条初始化
	HWND MHK = GetDlgItem(hwnd,IDC__MUSIC_SLIDER);
	//设置滚动条最小值为0
	SendMessage(MHK,TBM_SETRANGEMIN,(WPARAM)TRUE,0);//
	//设置滚动条最大值为1000
	SendMessage(MHK,TBM_SETRANGEMAX,(WPARAM)TRUE,time);//
	//设置按←键时,减小25
	SendMessage(MHK,TBM_SETPAGESIZE,0, (LPARAM)(time/40));//
	//设置按→键时,增大25 
	SendMessage(MHK,TBM_SETLINESIZE,0, (LPARAM)(time/40));//
	//获取主窗口进度滚动条位置设置到迷你窗口进度滚动条上
	int Time = (int)SendMessage(GetDlgItem(minphwnd,IDC_MUSIC_SLIDER),TBM_GETPOS,0,0);
	SendMessage(GetDlgItem(hwnd,IDC__MUSIC_SLIDER),TBM_SETPOS,(unsigned long)TRUE,Time);//

	TCHAR Name[MAX_PATH];
	//获取主窗口正在播放编辑框中文件路径
	GetDlgItemText(minphwnd,IDC_EDITNOW,Name,sizeof(Name));//
	//将主窗口正在播放编辑框中文件路径设置到迷你窗口中
	SetDlgItemText(hwnd,IDC__EDITNOW,Name);//

	//设置检测吸附窗口及刷新进度滚动条位置定时器
	SetTimer(hwnd,TIMER_MTEST,TIMER_MTEST_TIME,(TIMERPROC)MINITimer);//

	return TRUE;
}//
Пример #15
0
/* Resets and fills the given combobox with a list of current
 * drives.  The type of drive is stored with the item data.
 */
void FASTCALL DriveListInitialize(HWND hList, HWND hTempList, UINT iCurDrive )
{
   UINT i, iItem;
   UINT cch;
   UINT cItems;
   UINT iDrive, iType;
   char szDrive[ 10 ];
   char szNet[ 64 ];
   char szItem[ 68 ];

   if( NULL == hList )
      return;

   /* Clear out all the lists. */
   ComboBox_ResetContent( hList );
   ListBox_ResetContent( hTempList );

   /* Get available drive letters in the temp list */
   ListBox_Dir( hTempList, DDL_DRIVES | DDL_EXCLUSIVE, "*" );
   iCurDrive -= 1;       /* Fix for zero-based drive indexing */

   /* Walk through the list of drives, parsing off the "[-" and "-]"
    * For each drive letter parsed, add a string to the combobox
    * composed of the drive letter and the volume label.  We then
    * determine the drive type and add that information as the item data.
    */
   cItems = ListBox_GetCount( hTempList );
   for( i = 0; i < cItems; i++ )
      {
      ListBox_GetText( hTempList, i, szDrive );

      /* Ensure lowercase drive letters */
      AnsiLower(szDrive);
      iDrive = szDrive[ 2 ] - 'a';
      iType = AmDriveType( szDrive );        /* See Below */
      if( iType < 2 )                  /* Skip non-existent drive B's */
         continue;

      /* Start the item string with the drive letter, color, and two spaces */
      wsprintf( szItem, "%c%s", szDrive[ 2 ], (LPSTR)":  " );

      /* For fixed or ram disks, append the volume label which we find
       * using _dos_findfirst and attribute _A_VOLID.
       */
      if( DRIVE_FIXED == iType || DRIVE_RAMDISK == iType )
         {
      #ifdef WIN32
         wsprintf( szDrive, "%c:\\", szDrive[ 2 ] );
         GetVolumeInformation( szDrive, szItem + strlen( szItem ), 20, NULL, NULL, NULL, NULL, 0 );
      #else
         FINDDATA fi;
         HFIND hFind;
         char ch;

         wsprintf( szDrive, "%c:\\*.*", szDrive[ 2 ] );
         if( ( hFind = Amuser_FindFirst( szDrive, _A_VOLID, &fi ) ) != -1 )
            {
            /* Convert volume to lowercase and strip any '.' in the name. */
            AnsiLower( fi.name );

            /* If a period exists, it has to be in position 8, so clear it. */
            ch = fi.name[ 8 ];
            fi.name[ 8 ] = 0;
            strcat( szItem, fi.name );

            /* If we did have a broken volume name, append the last 3 chars */
            if( '.' == ch )
               strcat( szItem, &fi.name[ 9 ] );
            }
         Amuser_FindClose( hFind );
      #endif
         }

      /* For network drives, go grab the \\server\share for it. */
      if( DRIVE_REMOTE == iType )
         {
         szNet[ 0 ] = 0;
         cch = sizeof( szNet );

         wsprintf( szDrive, "%c:", szDrive[ 2 ] );
         AnsiUpper(szDrive);

//       if( WNetGetConnection( (LPSTR)szDrive, (LPSTR)szNet, &cch ) == NO_ERROR )
//          {
//          AnsiLower(szNet);
//          strcat( szItem, szNet );
//          }
         }
      iItem = ComboBox_AddString( hList, szItem );
      ComboBox_SetItemData( hList, iItem, MAKELONG( iDrive, iType ) );
      if( iDrive == iCurDrive )
         ComboBox_SetCurSel( hList, iItem );
      }
}
Пример #16
0
INT_PTR CALLBACK PinCtrlDlgProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
    case WM_CLOSE:
    {
        RECT rc;
        GetWindowRect(hWndDlg, &rc);
        axisx = rc.left;
        axisy = rc.top;
        hWndPinCtrl = NULL;
        EndDialog(hWndDlg, 0);
        return 0;
    }
    case WM_COMMAND:
    {
        switch(LOWORD(wParam))
        {
        case IDC_PINCTRL_OK:
            if(HIWORD(wParam) != BN_CLICKED)
                return 0;
            if(msg.hComPort == INVALID_HANDLE_VALUE)
            {
                MessageBox(hWndDlg, "没有串口设备被打开!", COMMON_NAME, MB_ICONINFORMATION);
                return 0;
            }
            cconfig.dcb.fDtrControl = dtr[ComboBox_GetCurSel(hDtr)];
            cconfig.dcb.fRtsControl = rts[ComboBox_GetCurSel(hRts)];
            if(!SetCommConfig(msg.hComPort, &cconfig, sizeof(cconfig)))
            {
                utils.msgerr("设置DTR/RTS时错误!");
                return 0;
            }
            EnableWindow(GetDlgItem(hWndDlg, IDC_PINCTRL_OK), FALSE);
            break;
        case IDC_CBO_PINCTRL_DTR:
        case IDC_CBO_PINCTRL_RTS:
            if(HIWORD(wParam) == CBN_SELENDOK)
            {
                EnableWindow(GetDlgItem(hWndDlg, IDC_PINCTRL_OK), TRUE);
                return 0;
            }
            break;
        }
        return 0;
    }
    case WM_INITDIALOG:
    {
        DWORD size = sizeof(cconfig);
        if(msg.hComPort == INVALID_HANDLE_VALUE)
        {
            utils.msgbox(MB_ICONEXCLAMATION, COMMON_NAME, "请先打开一个串口设备!");
            EndDialog(hWndDlg, 0);
            return 0;
        }
        if(!GetCommConfig(msg.hComPort, &cconfig, &size))
        {
            utils.msgerr("获取串口配置时错误");
            EndDialog(hWndDlg, 0);
            return 0;
        }
        hDtr = GetDlgItem(hWndDlg, IDC_CBO_PINCTRL_DTR);
        hRts = GetDlgItem(hWndDlg, IDC_CBO_PINCTRL_RTS);
        for(;;)
        {
            int i;
            for(i = 0; i < 3; i++)
            {
                ComboBox_AddString(hDtr, sdtr[i]);
                ComboBox_AddString(hRts, srts[i]);
            }
            ComboBox_SetCurSel(hDtr, cconfig.dcb.fDtrControl);
            ComboBox_SetCurSel(hRts, cconfig.dcb.fRtsControl);
            break;
        }
        //...
        hWndPinCtrl = hWndDlg;
        SetWindowPos(hWndDlg, 0, axisx, axisy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
        return 0;
    }
    }
    UNREFERENCED_PARAMETER(lParam);
    return 0;
}
Пример #17
0
static int OnInitDialog(HWND hDlg, LPARAM lParam)
{
    TFileTestData * pData;
    PROPSHEETPAGE * pPage = (PROPSHEETPAGE *)lParam;
    HWND hCombo = GetDlgItem(hDlg, IDC_CREATE_DISPOSITION);

    SetDialogData(hDlg, pPage->lParam);
    pData = (TFileTestData *)pPage->lParam;

    // Configure dialog resizing
    if(pData->bEnableResizing)
    {
        pAnchors = new TAnchors();
        pAnchors->AddAnchor(hDlg, IDC_MAIN_FRAME, akAll);
        pAnchors->AddAnchor(hDlg, IDC_DIRECTORY_NAME, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_DIRECTORY_NAME_BROWSE, akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_FILE_NAME, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_FILE_NAME_BROWSE, akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_OBJ_ATTR_FLAGS, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_OBJ_ATTR_FLAGS_BROWSE, akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_DESIRED_ACCESS, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_DESIRED_ACCESS_BROWSE, akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_ALLOCATION_SIZE, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_ALLOCATION_SIZE_UPDOWN, akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_FILE_ATTRIBUTES, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_FILE_ATTRIBUTES_BROWSE, akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_SHARE_ACCESS, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_SHARE_ACCESS_BROWSE, akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_CREATE_DISPOSITION, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_CREATE_OPTIONS, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_CREATE_OPTIONS_BROWSE, akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_EXTENDED_ATTRIBUTES, akLeft | akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_EXTENDED_ATTRIBUTES_EDIT, akTop | akRight);
        pAnchors->AddAnchor(hDlg, IDC_TRANSACTED, akLeft | akRight | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_VIRTUALIZATION, akLeft | akRight | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_BREAKPOINT, akLeft | akRight | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_PRIVILEGES, akLeft | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_MAKE_DIRECTORY, akLeft | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_CREATE_FILE, akRight | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_CLOSE_HANDLE, akRight | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_RESULT_FRAME, akLeft | akRight | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_RESULT_STATUS_TITLE, akLeft | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_RESULT_STATUS, akLeft | akRight | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_HANDLE_TITLE, akLeft | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_HANDLE, akLeft | akRight | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_NTCREATE_RESULT_TITLE, akLeft | akBottom);
        pAnchors->AddAnchor(hDlg, IDC_NTCREATE_RESULT, akLeft | akRight | akBottom);
    }

    // Initialize the "Relative File" hyperlink
    InitURLButton(hDlg, IDC_RELATIVE_FILE_HELP, FALSE);

    // Initialize the combo box
    InitDialogControls(hDlg, MAKEINTRESOURCE(IDD_PAGE02_NTCREATE));
    if(hCombo != NULL)
        ComboBox_SetCurSel(hCombo, pData->dwCreateDisposition2);

    // If we have a tooltip window, init tooltips 
    g_Tooltip.AddToolTip(hDlg, IDC_OBJ_ATTR_FLAGS, ObjAttrFlagsValues);
    g_Tooltip.AddToolTip(hDlg, IDC_DESIRED_ACCESS, DesiredAccessValues);
    g_Tooltip.AddToolTip(hDlg, IDC_FILE_ATTRIBUTES, FileAttributesValues);
    g_Tooltip.AddToolTip(hDlg, IDC_SHARE_ACCESS, ShareAccessValues);
    g_Tooltip.AddToolTip(hDlg, IDC_CREATE_OPTIONS, CreateOptionsValues);

    // On post-Vista, enable the virtualization button
    if(GetTokenVirtualizationEnabled(NULL))
        EnableDlgItems(hDlg, TRUE, IDC_VIRTUALIZATION, 0);

    return TRUE;
}
Пример #18
0
BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	//if (!m_hDlg) return FALSE;
	switch(message)
	{
	case WM_INITDIALOG:
		{
			return TRUE;
		}
		break;

	case WM_TIMER:
		{
			int iPage = TabCtrl_GetCurSel (GetDlgItem(m_hDlg, IDC_LEFTTABS));
			ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE);
			ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST),      iPage?SW_HIDE:SW_NORMAL);
		}
		break;

	case WM_NOTIFY:
		switch (wParam)
		{
		case IDC_LEFTTABS:
			{
				HWND tabs = GetDlgItem(m_hDlg, IDC_LEFTTABS);
				NMHDR* pNotifyMessage = NULL;
				pNotifyMessage = (LPNMHDR)lParam; 		
				if (pNotifyMessage->hwndFrom == tabs)
				{
					int iPage = TabCtrl_GetCurSel (tabs);
					ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE);
					ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST),      iPage?SW_HIDE:SW_NORMAL);
				}
			}
			break;
		case IDC_BREAKPOINTLIST:
			breakpointList->HandleNotify(lParam);
			break;
		case IDC_THREADLIST:
			threadList->HandleNotify(lParam);
			break;
		case IDC_STACKFRAMES:
			stackTraceView->HandleNotify(lParam);
			break;
		}
		break;
	case WM_COMMAND:
		{
			CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
			CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST));
			switch(LOWORD(wParam))
			{
			case ID_TOGGLE_PAUSE:
				SendMessage(MainWindow::GetHWND(),WM_COMMAND,ID_TOGGLE_PAUSE,0);
				break;
				
			case ID_DEBUG_DISPLAYMEMVIEW:
				changeSubWindow(SUBWIN_MEM);
				break;

			case ID_DEBUG_DISPLAYBREAKPOINTLIST:
				changeSubWindow(SUBWIN_BREAKPOINT);
				break;

			case ID_DEBUG_DISPLAYTHREADLIST:
				changeSubWindow(SUBWIN_THREADS);
				break;

			case ID_DEBUG_DISPLAYSTACKFRAMELIST:
				changeSubWindow(SUBWIN_STACKFRAMES);
				break;

			case ID_DEBUG_DSIPLAYREGISTERLIST:
				TabCtrl_SetCurSel(GetDlgItem(m_hDlg, IDC_LEFTTABS),0);
				ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), SW_NORMAL);
				ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), SW_HIDE);
				break;
				
			case ID_DEBUG_DSIPLAYFUNCTIONLIST:
				TabCtrl_SetCurSel(GetDlgItem(m_hDlg, IDC_LEFTTABS),1);
				ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), SW_HIDE);
				ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), SW_NORMAL);
				break;

			case ID_DEBUG_ADDBREAKPOINT:
				{
					keepStatusBarText = true;
					bool isRunning = Core_IsActive();
					if (isRunning)
					{
						SetDebugMode(true, false);
						Core_EnableStepping(true);
						Core_WaitInactive(200);
					}

					BreakpointWindow bpw(m_hDlg,cpu);
					if (bpw.exec()) bpw.addBreakpoint();

					if (isRunning)
					{
						SetDebugMode(false, false);
						Core_EnableStepping(false);
					}
					keepStatusBarText = false;
				}
				break;

			case ID_DEBUG_STEPOVER:
				if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOver();
				break;

			case ID_DEBUG_STEPINTO:
				if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepInto();
				break;

			case ID_DEBUG_RUNTOLINE:
				if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) runToLine();
				break;

			case ID_DEBUG_STEPOUT:
				if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOut();
				break;

			case IDC_SHOWVFPU:
				vfpudlg->Show(true);
				break;

			case IDC_FUNCTIONLIST: 
				switch (HIWORD(wParam))
				{
				case CBN_DBLCLK:
					{
						HWND lb = GetDlgItem(m_hDlg,LOWORD(wParam));
						int n = ListBox_GetCurSel(lb);
						if (n!=-1)
						{
							unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n);
							ptr->gotoAddr(addr);
							SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
						}
					}
					break;
				};
				break;

			case IDC_GOTOINT:
				switch (HIWORD(wParam))
				{
				case LBN_SELCHANGE:
					{
						HWND lb =GetDlgItem(m_hDlg,LOWORD(wParam));
						int n = ComboBox_GetCurSel(lb);
						unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n);
						if (addr != 0xFFFFFFFF)
						{
							ptr->gotoAddr(addr);
							SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
						}
					}
					break;
				};
				break;

			case IDC_STOPGO:
				{
					if (!Core_IsStepping())		// stop
					{
						ptr->setDontRedraw(false);
						SetDebugMode(true, true);
						Core_EnableStepping(true);
						_dbg_update_();
						Sleep(1); //let cpu catch up
						ptr->gotoPC();
						UpdateDialog();
						vfpudlg->Update();
					} else {					// go
						lastTicks = CoreTiming::GetTicks();

						// If the current PC is on a breakpoint, the user doesn't want to do nothing.
						CBreakPoints::SetSkipFirst(currentMIPS->pc);

						SetDebugMode(false, true);
						Core_EnableStepping(false);
					}
				}
				break;

			case IDC_STEP:
				stepInto();
				break;

			case IDC_STEPOVER:
				stepOver();
				break;

			case IDC_STEPOUT:
				stepOut();
				break;
				
			case IDC_STEPHLE:
				{
					if (Core_IsActive())
						break;
					lastTicks = CoreTiming::GetTicks();

					// If the current PC is on a breakpoint, the user doesn't want to do nothing.
					CBreakPoints::SetSkipFirst(currentMIPS->pc);

					hleDebugBreak();
					SetDebugMode(false, true);
					_dbg_update_();
					Core_EnableStepping(false);
				}
				break;

			case IDC_MEMCHECK:
				SendMessage(m_hDlg,WM_COMMAND,ID_DEBUG_ADDBREAKPOINT,0);
				break;
			case IDC_UPDATECALLSTACK:
				{
					HWND hDlg = m_hDlg;
					HWND list = GetDlgItem(hDlg,IDC_CALLSTACK);
					ComboBox_ResetContent(list);
					
					u32 pc = currentMIPS->pc;
					u32 ra = currentMIPS->r[MIPS_REG_RA];
					DWORD addr = Memory::ReadUnchecked_U32(pc);
					int count=1;
					ComboBox_SetItemData(list, ComboBox_AddString(list, ConvertUTF8ToWString(symbolMap.GetDescription(pc)).c_str()), pc);
					if (symbolMap.GetDescription(pc) != symbolMap.GetDescription(ra))
					{
						ComboBox_SetItemData(list, ComboBox_AddString(list, ConvertUTF8ToWString(symbolMap.GetDescription(ra)).c_str()), ra);
						count++;
					}
					//walk the stack chain
					while (addr != 0xFFFFFFFF && addr!=0 && count++<20)
					{
						DWORD fun = Memory::ReadUnchecked_U32(addr+4);
						const wchar_t *str = ConvertUTF8ToWString(symbolMap.GetDescription(fun)).c_str();
						if (wcslen(str) == 0)
							str = L"(unknown)";
						ComboBox_SetItemData(list, ComboBox_AddString(list,str), fun);
						addr = Memory::ReadUnchecked_U32(addr);
					}
					ComboBox_SetCurSel(list,0);
				}
				break;

			case IDC_GOTOPC:
				{
					ptr->gotoPC();	
					SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
					UpdateDialog();
				}
				break;
			case IDC_GOTOLR:
				{
					ptr->gotoAddr(cpu->GetLR());
					SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
				}
				break;

			case IDC_BACKWARDLINKS:
				{
					HWND box = GetDlgItem(m_hDlg, IDC_FUNCTIONLIST); 
					int funcnum = symbolMap.GetSymbolNum(ListBox_GetItemData(box,ListBox_GetCurSel(box)));
					if (funcnum!=-1)
						symbolMap.FillListBoxBLinks(box,funcnum);
					break;
				}

			case IDC_ALLFUNCTIONS:
				{
					symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION);
					break;
				}
			default:
				return FALSE;
			}
			return TRUE;
		}

	case WM_DEB_MAPLOADED:
		NotifyMapLoaded();
		break;

	case WM_DEB_GOTOWPARAM:
	{
		CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
		ptr->gotoAddr(wParam);
		SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
		break;
	}
	case WM_DEB_GOTOADDRESSEDIT:
		{
			wchar_t szBuffer[256];
			CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
			GetWindowText(GetDlgItem(m_hDlg,IDC_ADDRESS),szBuffer,256);

			u32 addr;
			if (parseExpression(ConvertWStringToUTF8(szBuffer).c_str(),cpu,addr) == false)
			{
				displayExpressionError(GetDlgItem(m_hDlg,IDC_ADDRESS));
			} else {
				ptr->gotoAddr(addr);
				SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
			}
			UpdateDialog();
		}
		break;

	case WM_DEB_SETDEBUGLPARAM:
		SetDebugMode(lParam != 0, true);
		return TRUE;

	case WM_DEB_UPDATE:
		Update();
		return TRUE;

	case WM_DEB_TABPRESSED:
		changeSubWindow(SUBWIN_NEXT);
		break;
	case WM_DEB_SETSTATUSBARTEXT:
		if (!keepStatusBarText)
			SendMessage(statusBarWnd,WM_SETTEXT,0,(LPARAM)ConvertUTF8ToWString((const char *)lParam).c_str());
		break;
	case WM_DEB_GOTOHEXEDIT:
		{
			CtrlMemView *memory = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW));
			memory->gotoAddr(wParam);
			
			// display the memory viewer too
			HWND bp = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST);
			HWND mem = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW);
			HWND threads = GetDlgItem(m_hDlg, IDC_THREADLIST);
			ShowWindow(bp,SW_HIDE);
			ShowWindow(mem,SW_NORMAL);
			ShowWindow(threads,SW_HIDE);
		}
		break;
	case WM_SIZE:
		{
			UpdateSize(LOWORD(lParam), HIWORD(lParam));
			SendMessage(statusBarWnd,WM_SIZE,0,10);
			SavePosition();
			return TRUE;
		}

	case WM_MOVE:
		SavePosition();
		break;
	case WM_GETMINMAXINFO:
		{
			MINMAXINFO *m = (MINMAXINFO *)lParam;
			// Reduce the minimum size slightly, so they can size it however they like.
			m->ptMinTrackSize.x = defaultRect.right - defaultRect.left - 100;
			//m->ptMaxTrackSize.x = m->ptMinTrackSize.x;
			m->ptMinTrackSize.y = defaultRect.bottom - defaultRect.top - 200;
		}
		return TRUE;
	case WM_CLOSE:
		Show(false);
		return TRUE;
	case WM_ACTIVATE:
		if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE)
		{
			g_activeWindow = WINDOW_CPUDEBUGGER;
		}
		break;
	}
	return FALSE;
}
Пример #19
0
/*------------------------------------------------
  Initialize
--------------------------------------------------*/
void OnInit(HWND hDlg)
{
	ColorBox colors[2];
	HWND quality_cb = GetDlgItem(hDlg, IDC_FONTQUAL);
	HDC hdc;
	LOGFONT logfont;
	HFONT hfont;
	m_transition=-1; // start transition lock
	// setting of "background" and "text"
	colors[0].hwnd = GetDlgItem(hDlg, IDC_COLFORE);
	colors[0].color = api.GetInt(L"Clock",L"ForeColor",TCOLOR(TCOLOR_DEFAULT));
	colors[1].hwnd = GetDlgItem(hDlg, IDC_COLBACK);
	colors[1].color = api.GetInt(L"Clock",L"BackColor",TCOLOR(TCOLOR_DEFAULT));
	ColorBox_Setup(colors, 2);
	
	// if color depth is 256 or less
	hdc = CreateICA("DISPLAY", NULL, NULL, NULL);
	if(GetDeviceCaps(hdc, BITSPIXEL) <= 8) {
		EnableDlgItem(hDlg, IDC_COLFORE_BTN, FALSE);
		EnableDlgItem(hDlg, IDC_COLBACK_BTN, FALSE);
	}
	DeleteDC(hdc);
	
	InitComboFont(hDlg);
	
	SetComboFontSize(hDlg, TRUE);
	
	
	CheckDlgButton(hDlg, IDC_BOLD, api.GetInt(L"Clock", L"Bold", 0));
	CheckDlgButton(hDlg, IDC_ITALIC, api.GetInt(L"Clock", L"Italic", 0));
	
	hfont = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0);
	GetObject(hfont, sizeof(LOGFONT), &logfont);
	logfont.lfWeight = FW_BOLD;
	hfont = CreateFontIndirect(&logfont);
	SendDlgItemMessage(hDlg, IDC_BOLD, WM_SETFONT, (WPARAM)hfont, 0);
	
	logfont.lfWeight = FW_NORMAL;
	logfont.lfItalic = 1;
	hfont = CreateFontIndirect(&logfont);
	SendDlgItemMessage(hDlg, IDC_ITALIC, WM_SETFONT, (WPARAM)hfont, 0);
	
	SendDlgItemMessage(hDlg, IDC_SPINCHEIGHT, UDM_SETRANGE32, (WPARAM)-999,999);
	SendDlgItemMessage(hDlg, IDC_SPINCHEIGHT, UDM_SETPOS32, 0, api.GetInt(L"Clock", L"ClockHeight", 0));
	
	SendDlgItemMessage(hDlg, IDC_SPINCWIDTH, UDM_SETRANGE32, (WPARAM)-999,999);
	SendDlgItemMessage(hDlg, IDC_SPINCWIDTH, UDM_SETPOS32, 0, api.GetInt(L"Clock", L"ClockWidth", 0));
	
	SendDlgItemMessage(hDlg, IDC_SPINLHEIGHT, UDM_SETRANGE32, (WPARAM)-64,64);
	SendDlgItemMessage(hDlg, IDC_SPINLHEIGHT, UDM_SETPOS32, 0, api.GetInt(L"Clock", L"LineHeight", 0));
	
	SendDlgItemMessage(hDlg, IDC_SPINVPOS, UDM_SETRANGE32, (WPARAM)-200,200);
	SendDlgItemMessage(hDlg, IDC_SPINVPOS, UDM_SETPOS32, 0, api.GetInt(L"Clock", L"VertPos", 0));
	
	SendDlgItemMessage(hDlg, IDC_SPINHPOS, UDM_SETRANGE32, (WPARAM)-200,200);
	SendDlgItemMessage(hDlg, IDC_SPINHPOS, UDM_SETPOS32, 0, api.GetInt(L"Clock", L"HorizPos", 0));
	
	SendDlgItemMessage(hDlg, IDC_SPINANGLE, UDM_SETRANGE32, (WPARAM)-360,360);
	SendDlgItemMessage(hDlg, IDC_SPINANGLE, UDM_SETPOS32, 0, api.GetInt(L"Clock", L"Angle", 0));
	
	SendDlgItemMessage(hDlg, IDC_SPINALPHA, UDM_SETRANGE32, 0,100);
	SendDlgItemMessage(hDlg, IDC_SPINALPHA, UDM_SETPOS32, 0, api.GetInt(L"Taskbar", L"AlphaTaskbar", 0));
	
	ComboBox_AddString(quality_cb, L"Default");            // 0 = DEFAULT_QUALITY
	ComboBox_AddString(quality_cb, L"Draft");              // 1 = DRAFT_QUALITY
	ComboBox_AddString(quality_cb, L"Proof");              // 2 = PROOF_QUALITY
	ComboBox_AddString(quality_cb, L"NonAntiAliased");     // 3 = NONANTIALIASED_QUALITY
	ComboBox_AddString(quality_cb, L"AntiAliased (Win7)"); // 4 = ANTIALIASED_QUALITY
	ComboBox_AddString(quality_cb, L"ClearType (WinXP+)"); // 5 = CLEARTYPE_QUALITY
	ComboBox_AddString(quality_cb, L"ClearType Natural");  // 6 = CLEARTYPE_NATURAL_QUALITY
	ComboBox_SetCurSel(quality_cb,api.GetInt(L"Clock",L"FontQuality",CLEARTYPE_QUALITY));
	m_transition=0; // end transition lock, ready to go
}
Пример #20
0
static void PopulateForm(int pgs)
{
	HWND hwnd;
	char buf[256];
	int i,j;

	if (pgs & POPULATE_VIDEO) {
		int mode;

		hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE);

		mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.fullscreen, 1);
		if (mode < 0) {
			int cd[] = { 32, 24, 16, 15, 8, 0 };
			for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp) i++; else break; }
			for ( ; cd[i]; i++) {
				mode = checkvideomode(&settings.xdim, &settings.ydim, cd[i], settings.fullscreen, 1);
				if (mode < 0) continue;
				settings.bpp = cd[i];
				break;
			}
		}

		Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED));
		ComboBox_ResetContent(hwnd);
		for (i=0; i<validmodecnt; i++) {
			if (validmode[i].fs != settings.fullscreen) continue;

			// all modes get added to the 3D mode list
			Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
			j = ComboBox_AddString(hwnd, buf);
			ComboBox_SetItemData(hwnd, j, i);
			if (i == mode) ComboBox_SetCurSel(hwnd, j);
		}
	}

	if (pgs & POPULATE_CONFIG) {
        int curidx = -1;
        
		Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED));

		Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), (settings.usemouse ? BST_CHECKED : BST_UNCHECKED));
		Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), (settings.usejoy ? BST_CHECKED : BST_UNCHECKED));
		
		hwnd = GetDlgItem(pages[TAB_CONFIG], IDCSOUNDQUAL);
		
		ComboBox_ResetContent(hwnd);
        for (i = 0; soundQualities[i].frequency > 0; i++) {
            j = addSoundQualityItem(&soundQualities[i], hwnd);
            ComboBox_SetItemData(hwnd, j, i);

            if (soundQualities[i].frequency == settings.samplerate &&
                soundQualities[i].samplesize == settings.bitspersample &&
                soundQualities[i].channels == settings.channels) {
                ComboBox_SetCurSel(hwnd, j);
            }
        }
        
        if (curidx < 0) {
            soundQualities[i].frequency = settings.samplerate;
            soundQualities[i].samplesize = settings.bitspersample;
            soundQualities[i].channels = settings.channels;
            
            j = addSoundQualityItem(&soundQualities[i], hwnd);
            ComboBox_SetItemData(hwnd, j, i);

            i++;
            soundQualities[i].frequency = -1;
        }
	}

	if (pgs & POPULATE_GAME) {
		struct grpfile *fg;
		int i, j;
		char buf[128+BMAX_PATH];

		hwnd = GetDlgItem(pages[TAB_GAME], IDGDATA);

		for (fg = foundgrps; fg; fg=fg->next) {
			for (i = 0; i<numgrpfiles; i++) if (fg->crcval == grpfiles[i].crcval) break;
			if (i == numgrpfiles) continue;	// unrecognised grp file
			Bsprintf(buf, "%s\t%s", grpfiles[i].name, fg->name);
			j = ListBox_AddString(hwnd, buf);
			ListBox_SetItemData(hwnd, j, (LPARAM)fg);
			if (!Bstrcasecmp(fg->name, settings.selectedgrp)) ListBox_SetCurSel(hwnd, j);
		}
	}
}
Пример #21
0
        void execute( HINSTANCE hInstance, dcx::dcxCPUFeatures* cpuFeatures ) {
            myMainWindow = createMainDialog( hInstance );

            dcx::dcxIniFileWriter ini_file_writer;
            DisplayModeList display_mode_list;
            {
              dcx::dcxIniFileReader ini_file_reader;
              ini_file_reader.read("config.ini");
              ini_file_writer.scan(&ini_file_reader);
              DWORD current_display_mode_index = 
                EnumDisplayModes(ini_file_reader.getSetting("Graphics", "ResolutionX", 0),
                                 ini_file_reader.getSetting("Graphics", "ResolutionY", 0),
                                 ini_file_reader.getSetting("Graphics", "ColorDepth", 0),
                                 ini_file_reader.getSetting("Graphics", "Fullscreen", 0) == 0, display_mode_list);

              { // re-sort
                DisplayMode current;
                if (current_display_mode_index < display_mode_list.size()) current = display_mode_list.at(current_display_mode_index);
                qsort(&display_mode_list.at(0), display_mode_list.size(), sizeof(DisplayModeList::value_type), CompareDisplayMode);
                DWORD index = 0;
                for (DisplayModeList::iterator i = display_mode_list.begin(); i != display_mode_list.end(); ++i, ++index) {
                  DisplayMode& dm = *i;
                  if (dm.width == current.width &&
                      dm.height == current.height &&
                      dm.windowed == current.windowed &&
                      (current.windowed == true || dm.bpp == current.bpp)) {
                    current_display_mode_index = index; break;
                  }
                }
              }


              HWND hDisplayModeCombo = getDisplayModeCombo();
              DWORD index = 0;
              for (DisplayModeList::iterator i = display_mode_list.begin(); i != display_mode_list.end(); ++i, ++index) {
                int k = ComboBox_AddString(hDisplayModeCombo, i->text.c_str());
                ComboBox_SetItemData(hDisplayModeCombo, k, index);
              }
              ComboBox_SetCurSel(hDisplayModeCombo, current_display_mode_index);
            }

            Evidyon::UpdateFile update_file;
            std::list<EvidyonUpdateFile> files_to_update;
            if (!Evidyon::DownloadUpdateFile(Evidyon::ONLINE_CLIENT_UPDATE_FILE, &update_file)) {
                errorMessageBox( "Couldn't contact the update server; please try again later" );
                goto EXIT;
            }

            if (update_file.major != MAJOR_VERSION) {
              // download the full installer
              MessageBox(myMainWindow, "The game has been significantly updated and you\n"
                                       "should re-download from www.unseenstudios.com", "Major Update!", MB_OK);
              goto EXIT;
            } else {
              ShowWindow( getEditboxStatus(), SW_SHOW);
              for (std::map<std::string, Evidyon::UpdateFileData>::const_iterator i = update_file.files.begin();
                   i != update_file.files.end(); ++i) {
                const std::string& filename = i->first;
                md5wrapper wrappy;
                std::string local_md5 = wrappy.getHashFromFile(filename);
                if (local_md5.compare(i->second.md5) != 0) {  // this file needs to be updated
                  EvidyonUpdateFile file;
                  file.file_name = filename;
                  file.file_size = i->second.file_bytes;
                  files_to_update.push_back(file);
                }
              }
            }

            // Add the update text to the output
            {
              std::string updateText = "--";
              appendStatusLine( updateText.c_str() );
            }

            // Update the client
            bool allowGameStart = false;
            if (files_to_update.size() > 0) {
              if (downloadUpdates(Evidyon::ONLINE_CLIENT_UPDATE_FOLDER, files_to_update)) {
                allowGameStart = true;
              } else {
                appendStatusLine( "ERROR!  Unable to download updates at this time.  If you are running Vista, this could "\
                                  "be due to the permissions for the directory in which Evidyon is installed being set to read-only." );
              }
            }
            else
                allowGameStart = true;

            if (allowGameStart) {
                // Re-enable the "launch" button
                Button_Enable( getStartgameButton(), TRUE );
            }

            ShowWindow(getStartgameButton(), SW_SHOW);
            ShowWindow(getProgressBar(), SW_HIDE);

            // Wait for the user to do something
            myLaunchGameFlag = false;
            ComboBox_Enable(getDisplayModeCombo(), TRUE);
            while( dcx::dcxWin32StdMessagePump( myMainWindow ) && !myLaunchGameFlag );

            // Get the display mode selection
            int current_sel = ComboBox_GetCurSel(getDisplayModeCombo());
            current_sel = min(current_sel, display_mode_list.size() - 1);
            current_sel = max(current_sel, 0);
            DisplayMode& dm = display_mode_list.at(current_sel);
            ini_file_writer.setSetting("Graphics", "ResolutionX", dm.width),
            ini_file_writer.setSetting("Graphics", "ResolutionY", dm.height),
            ini_file_writer.setSetting("Graphics", "ColorDepth", dm.bpp),
            ini_file_writer.setSetting("Graphics", "Fullscreen", dm.windowed ? 0 : 1);
            {
              dc::dcFileStream ini_fs;
              ini_fs.open("config.ini", STREAM_OVERWRITE|STREAM_TEXT);
              ini_file_writer.write(&ini_fs);
              ini_fs.close();
            }

            // Close the window
            if( IsWindow( myMainWindow ) )
            {
                EndDialog( myMainWindow, 0 );
                DestroyWindow( myMainWindow );
                dcx::dcxWin32StdMessagePump( 0 );

                // Launch the client
                std::string exeFile = "evidyon";

                STARTUPINFO startupInfo;
                ZeroMemory( &startupInfo, sizeof(startupInfo) );

                PROCESS_INFORMATION processInfo;
/*
                // Build the version to run based on the computer's capabilities
                if( cpuFeatures->sse2 )
                {
                    exeFile.append( "_sse2" );
                }
                else if( cpuFeatures->sse )
                {
                    exeFile.append( "_sse" );
                }*/

                exeFile.append( ".exe" );
                
                // Start the server
                if( !CreateProcessA( exeFile.c_str(), NULL, NULL, NULL, FALSE, CREATE_NEW_CONSOLE|ABOVE_NORMAL_PRIORITY_CLASS,
                                     NULL, NULL, &startupInfo, &processInfo ) )
                {
                    DWORD error = GetLastError();
                    MessageBox( NULL, "Failed to launch Evidyon", "Error", MB_OK );
                    goto EXIT;
                }

                // Run the client
                WaitForSingleObject( processInfo.hProcess, INFINITE );

                // Free the process and exit
                CloseHandle( processInfo.hProcess );
                CloseHandle( processInfo.hThread );
            }

EXIT:
            DestroyWindow( myMainWindow );
        }
Пример #22
0
INT_PTR CALLBACK InterfaceDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{

	switch (Msg)
	{
		case WM_INITDIALOG:
		{
			char buffer[200];
			int value = 0;
			CenterWindow(hDlg);
			hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAMEUI_ICON));
			SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
			hBrush = CreateSolidBrush(RGB(240, 240, 240));
			DisableVisualStylesInterface(hDlg);
			Button_SetCheck(GetDlgItem(hDlg, IDC_JOY_GUI), GetJoyGUI());
			Button_SetCheck(GetDlgItem(hDlg, IDC_DISABLE_TRAY_ICON), GetMinimizeTrayIcon());
			Button_SetCheck(GetDlgItem(hDlg, IDC_DISPLAY_NO_ROMS), GetDisplayNoRomsGames());
			Button_SetCheck(GetDlgItem(hDlg, IDC_EXIT_DIALOG), GetExitDialog());
			Button_SetCheck(GetDlgItem(hDlg, IDC_USE_BROKEN_ICON), GetUseBrokenIcon());
			Button_SetCheck(GetDlgItem(hDlg, IDC_STRETCH_SCREENSHOT_LARGER), GetStretchScreenShotLarger());
			Button_SetCheck(GetDlgItem(hDlg, IDC_FILTER_INHERIT), GetFilterInherit());
			Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_FASTAUDIT), GetEnableFastAudit());
			Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP), GetEnableSevenZip());
			Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_DATAFILES), GetEnableDatafiles());
			Button_SetCheck(GetDlgItem(hDlg, IDC_SKIP_BIOS), GetSkipBiosMenu());
			// Get the current value of the control
			SendMessage(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TBM_SETRANGE, true, MAKELPARAM(0, 60)); /* [0, 60] */
			SendMessage(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TBM_SETTICFREQ, 5, 0);
			value = GetCycleScreenshot();
			SendMessage(GetDlgItem(hDlg, IDC_CYCLETIMESEC), TBM_SETPOS, true, value);
			snprintf(buffer, WINUI_ARRAY_LENGTH(buffer), "%d", value);		
			win_set_window_text_utf8(GetDlgItem(hDlg, IDC_CYCLETIMESECTXT), buffer);

			for (int i = 0; i < NUMHISTORYTAB; i++)
			{
				(void)ComboBox_InsertString(GetDlgItem(hDlg, IDC_HISTORY_TAB), i, g_ComboBoxHistoryTab[i].m_pText);
				(void)ComboBox_SetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), i, g_ComboBoxHistoryTab[i].m_pData);
			}

			if (GetHistoryTab() < MAX_TAB_TYPES) 
				(void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab());
			else 
				(void)ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB), GetHistoryTab() - TAB_SUBTRACT);

			SendMessage(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZE), TBM_SETRANGE, true, MAKELPARAM(0, 50)); /* [0, 50] */
			SendMessage(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZE), TBM_SETTICFREQ, 5, 0);
			value = GetScreenshotBorderSize();
			SendMessage(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZE), TBM_SETPOS, true, value);
			snprintf(buffer, WINUI_ARRAY_LENGTH(buffer), "%d", value);		
			win_set_window_text_utf8(GetDlgItem(hDlg, IDC_SCREENSHOT_BORDERSIZETXT), buffer);
			EnableWindow(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP), GetEnableFastAudit() ? true : false);
			break;
		}

		case WM_CTLCOLORDLG:
			return (LRESULT) hBrush;	

		case WM_CTLCOLORSTATIC:
		case WM_CTLCOLORBTN:
			hDC = (HDC)wParam;
			SetBkMode(hDC, TRANSPARENT);
			SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
			return (LRESULT) hBrush;

		case WM_HSCROLL:
			HANDLE_WM_HSCROLL(hDlg, wParam, lParam, OnHScroll);
			break;

		case WM_COMMAND:
			switch (GET_WM_COMMAND_ID(wParam, lParam))
			{
				case IDC_SCREENSHOT_BORDERCOLOR:
				{
					CHOOSECOLOR cc;
					COLORREF choice_colors[16];			

					for (int i = 0; i < 16; i++)
						choice_colors[i] = GetCustomColor(i);

					cc.lStructSize = sizeof(CHOOSECOLOR);
					cc.hwndOwner = hDlg;
					cc.lpfnHook = &CCHookProc;
					cc.rgbResult = GetScreenshotBorderColor();
					cc.lpCustColors = choice_colors;
					cc.Flags = CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK;

					if (!ChooseColor(&cc))
						return true;

					for (int i = 0; i < 16; i++)
						SetCustomColor(i,choice_colors[i]);

					SetScreenshotBorderColor(cc.rgbResult);
					UpdateScreenShot();
					return true;
				}

				case IDC_ENABLE_FASTAUDIT:
				{
					bool enabled = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_FASTAUDIT));
					EnableWindow(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP), enabled ? true : false);
					return true;
				}

				case IDOK:
				{
					bool bRedrawList = false;
					bool checked = false;
					int value = 0;

					SetJoyGUI(Button_GetCheck(GetDlgItem(hDlg, IDC_JOY_GUI)));
					SetMinimizeTrayIcon(Button_GetCheck(GetDlgItem(hDlg, IDC_DISABLE_TRAY_ICON)));
					SetExitDialog(Button_GetCheck(GetDlgItem(hDlg, IDC_EXIT_DIALOG)));
					SetEnableFastAudit(Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_FASTAUDIT)));
					SetEnableSevenZip(Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_SEVENZIP)));
					SetEnableDatafiles(Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_DATAFILES)));
					SetSkipBiosMenu(Button_GetCheck(GetDlgItem(hDlg, IDC_SKIP_BIOS)));

					if (Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_PLAYCOUNT)))
					{
						for (int i = 0; i < driver_list::total(); i++)
							ResetPlayCount(i);

						bRedrawList = true;
					}

					if (Button_GetCheck(GetDlgItem(hDlg, IDC_RESET_PLAYTIME)))
					{
						for (int i = 0; i < driver_list::total(); i++)
							ResetPlayTime(i);

						bRedrawList = true;
					}

					value = SendDlgItemMessage(hDlg, IDC_CYCLETIMESEC, TBM_GETPOS, 0, 0);

					if (GetCycleScreenshot() != value)
						SetCycleScreenshot(value);

					value = SendDlgItemMessage(hDlg, IDC_SCREENSHOT_BORDERSIZE, TBM_GETPOS, 0, 0);

					if (GetScreenshotBorderSize() != value)
					{
						SetScreenshotBorderSize(value);
						UpdateScreenShot();
					}

					checked = Button_GetCheck(GetDlgItem(hDlg, IDC_STRETCH_SCREENSHOT_LARGER));

					if (checked != GetStretchScreenShotLarger())
					{
						SetStretchScreenShotLarger(checked);
						UpdateScreenShot();
					}

					checked = Button_GetCheck(GetDlgItem(hDlg, IDC_FILTER_INHERIT));

					if (checked != GetFilterInherit())
					{
						SetFilterInherit(checked);
						bRedrawList = true;
					}

					checked = Button_GetCheck(GetDlgItem(hDlg, IDC_USE_BROKEN_ICON));

					if (checked != GetUseBrokenIcon())
					{
						SetUseBrokenIcon(checked);
						bRedrawList = true;
					}

					checked = Button_GetCheck(GetDlgItem(hDlg, IDC_DISPLAY_NO_ROMS));

					if (checked != GetDisplayNoRomsGames())
					{
						SetDisplayNoRomsGames(checked);
						bRedrawList = true;
					}

					int nCurSelection = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_HISTORY_TAB));
					int nHistoryTab = 0;

					if (nCurSelection != CB_ERR)
						nHistoryTab = ComboBox_GetItemData(GetDlgItem(hDlg, IDC_HISTORY_TAB), nCurSelection);

					DestroyIcon(hIcon);
					DeleteObject(hBrush);
					EndDialog(hDlg, 0);

					if(GetHistoryTab() != nHistoryTab)
					{
						SetHistoryTab(nHistoryTab, true);
						ResizePickerControls(GetMainWindow());
						UpdateScreenShot();
					}

					if(bRedrawList)
						UpdateListView();

					SaveInternalUI();
					return true;
				}

				case IDCANCEL:
					DestroyIcon(hIcon);
					DeleteObject(hBrush);
					EndDialog(hDlg, 0);
					return true;
			}

			break;
	}

	return false;
}
void ProjectConfigDialog::onInitDialog(HWND hwndDialog)
{
    SimulatorConfig *defaults = SimulatorConfig::sharedDefaults();
    m_hwndDialog = hwndDialog;
    HWND list = GetDlgItem(m_hwndDialog, IDC_COMBO_SCREEN_SIZE);

    updateProjectDir();
    updateScriptFile();
    updatePackagePath();

    BOOL isLandscape = FALSE;
    int currentSizeIndex = defaults->checkScreenSize(m_project.getFrameSize());
    if (currentSizeIndex < 0)
    {
        currentSizeIndex = 0;
    }
    else
    {
        isLandscape = m_project.isLandscapeFrame();
    }

    for (int i = 0; i < defaults->numScreenSize(); ++i)
    {
        const SimulatorScreenSize &size = defaults->getScreenSize(i);
        wstring title;
        title.assign(size.title.begin(), size.title.end());
        ComboBox_AddString(list, title.c_str());

        if (i == currentSizeIndex)
        {
            char buff[32];
            sprintf_s(buff, "%d", isLandscape ? size.height : size.width);
            SetDlgItemTextA(m_hwndDialog, IDC_EDIT_SCREEN_WIDTH, buff);
            sprintf_s(buff, "%d", isLandscape ? size.width : size.height);
            SetDlgItemTextA(m_hwndDialog, IDC_EDIT_SCREEN_HEIGHT, buff);
        }
    }
    ComboBox_AddString(list, L"Custom Size");
    ComboBox_SetCurSel(list, currentSizeIndex);

    Edit_LimitText(GetDlgItem(m_hwndDialog, IDC_EDIT_SCREEN_WIDTH), 4);
    Edit_LimitText(GetDlgItem(m_hwndDialog, IDC_EDIT_SCREEN_HEIGHT), 4);

    HWND direction = GetDlgItem(m_hwndDialog, IDC_RADIO_PORTRAIT);
    CheckRadioButton(m_hwndDialog, IDC_RADIO_PORTRAIT, IDC_RADIO_LANDSCAPE, isLandscape ? IDC_RADIO_LANDSCAPE : IDC_RADIO_PORTRAIT);

    Button_SetCheck(GetDlgItem(m_hwndDialog, IDC_CHECK_SHOW_DEBUG_CONSOLE), m_project.isShowConsole());

    // set dialog caption, button caption
    SetWindowTextA(m_hwndDialog, m_dialogCaption.c_str());
    SetDlgItemTextA(m_hwndDialog, IDOK, m_buttonCaption.c_str());
    
    // center a dialog box within its owner window
    RECT rc, rcOwner, rcDlg;
    GetWindowRect(m_hwnd, &rcOwner); 
    GetWindowRect(m_hwndDialog, &rcDlg); 
    CopyRect(&rc, &rcOwner); 

    OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top); 
    OffsetRect(&rc, -rc.left, -rc.top); 
    OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom); 

    SetWindowPos(m_hwndDialog,
                 HWND_TOP,
                 rcOwner.left + (rc.right / 2),
                 rcOwner.top + (rc.bottom / 2),
                 0, 0,          // Ignores size arguments. 
                 SWP_NOSIZE);
}
Пример #24
0
//--------------------------------------------------------------------
void CWrapperConfigDialog::OnInitDialog(HWND p_hWndDialog)
{
	CSimulatorConfig *defaults = CSimulatorConfig::GetInstance();
	m_hWndDialog = p_hWndDialog;
	HWND list = GetDlgItem(m_hWndDialog, IDC_COMBO_SCREEN_SIZE);

	BOOL isLandscape = FALSE;
	int currentSizeIndex = defaults->CheckScreenSize(m_tagAppConfig.GetFrameSize());
	if (currentSizeIndex < 0)
	{
		currentSizeIndex = 0;
	}
	else
	{
		isLandscape = m_tagAppConfig.IsLandscapeFrame();
	}

	for (int i = 0; i < defaults->GetScreenSizeCount(); ++i)
	{
		const SSimulatorScreenSize &size = defaults->GetScreenSize(i);
		wstring title;
		title.assign(size.m_szTitle.begin(), size.m_szTitle.end());
		ComboBox_AddString(list, title.c_str());

		if (i == currentSizeIndex)
		{
			char buff[32];
			sprintf_s(buff, "%d", isLandscape ? size.m_nHeight : size.m_nWidth);
			SetDlgItemTextA(m_hWndDialog, IDC_EDIT_SCREEN_WIDTH, buff);
			sprintf_s(buff, "%d", isLandscape ? size.m_nWidth : size.m_nHeight);
			SetDlgItemTextA(m_hWndDialog, IDC_EDIT_SCREEN_HEIGHT, buff);
		}
	}
	ComboBox_AddString(list, L"Custom Size");
	ComboBox_SetCurSel(list, currentSizeIndex);

	Edit_LimitText(GetDlgItem(m_hWndDialog, IDC_EDIT_SCREEN_WIDTH), 4);
	Edit_LimitText(GetDlgItem(m_hWndDialog, IDC_EDIT_SCREEN_HEIGHT), 4);

	HWND direction = GetDlgItem(m_hWndDialog, IDC_RADIO_PORTRAIT);
	CheckRadioButton(m_hWndDialog, IDC_RADIO_PORTRAIT, IDC_RADIO_LANDSCAPE, isLandscape ? IDC_RADIO_LANDSCAPE : IDC_RADIO_PORTRAIT);

	Button_SetCheck(GetDlgItem(m_hWndDialog, IDC_CHECK_SHOW_DEBUG_CONSOLE), m_tagAppConfig.IsShowConsole());
	Button_SetCheck(GetDlgItem(m_hWndDialog, IDC_CHECK_WRITE_DEBUG_LOG_TO_FILE), m_tagAppConfig.IsWriteDebugLogToFile());
	Button_SetCheck(GetDlgItem(m_hWndDialog, IDC_CHECK_LOAD_PRECOMPILED_FRAMEWORK), m_tagAppConfig.IsLoadPrecompiledFramework());

	// center a dialog box within its owner window
	RECT rc, rcOwner, rcDlg;
	GetWindowRect(m_hWnd, &rcOwner); 
	GetWindowRect(m_hWndDialog, &rcDlg); 
	CopyRect(&rc, &rcOwner); 

	OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top); 
	OffsetRect(&rc, -rc.left, -rc.top); 
	OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom); 

	SetWindowPos(m_hWndDialog,
		HWND_TOP,
		rcOwner.left + (rc.right / 2),
		rcOwner.top + (rc.bottom / 2),
		0, 0,          // Ignores size arguments. 
		SWP_NOSIZE);
}
Пример #25
0
/*
 * OnInitDialog()
 */
BOOL m_OnInitDialog(HWND setupDlg, HWND focusCtrl, LPARAM lParam)
{
    DLGPARAMS *dlgParams = (DLGPARAMS *) lParam;
    HWND msgLabel = GetDlgItem(setupDlg, IDC_MSG_LBL);
    int midiInDevCnt, midiOutDevCnt;
    int i;

    /*
     * Center the window.
     */
    Window_Center(setupDlg, dlgParams->parentWnd);
    /*
     * Cache control handles.
     */
    m_inPortCbo = GetDlgItem(setupDlg, IDC_MIDI_IN_PORT_CBO);
    m_inChannelCbo = GetDlgItem(setupDlg, IDC_MIDI_IN_CHANNEL_CBO);
    m_outPortCbo = GetDlgItem(setupDlg, IDC_MIDI_OUT_PORT_CBO);
    m_outChannelCbo = GetDlgItem(setupDlg, IDC_MIDI_OUT_CHANNEL_CBO);
    m_masterInPortCbo = GetDlgItem(setupDlg, IDC_MIDI_MASTER_PORT_CBO);
    /*
     * Set the window caption and general message text.
     */
    if (dlgParams->caption) {
        SetWindowText(setupDlg, dlgParams->caption);
    }
    if (dlgParams->msg) {
        SetWindowText(msgLabel, dlgParams->msg);
    }
    /*
     * Init the In Port and Master Port combos.
     */
    midiInDevCnt = midiInGetNumDevs();
    ComboBox_AddString(m_inPortCbo, m_disabledStr);
    ComboBox_AddString(m_masterInPortCbo, m_disabledStr);
    for (i = 0; i < midiInDevCnt; i++) {
        MIDIINCAPS midiDevInfo;

        midiInGetDevCaps(i, &midiDevInfo, sizeof midiDevInfo);
        ComboBox_AddString(m_inPortCbo, midiDevInfo.szPname);
        ComboBox_AddString(m_masterInPortCbo, midiDevInfo.szPname);
    }
    ComboBox_SetCurSel(m_inPortCbo, m_midi->inPort + 1);
    ComboBox_SetCurSel(m_masterInPortCbo, m_midi->masterInPort + 1);
    /*
     * Init the In Channel combo.
     */
    for (i = 1; i <= 16; i++) {
        _TUCHAR chanStr[3];

        _stprintf(chanStr, _T("%d"), i);
        ComboBox_AddString(m_inChannelCbo, chanStr);
    }
    if (dlgParams->options & MDO_ALLOW_OMNI_IN) {
        ComboBox_AddString(m_inChannelCbo, m_omniStr);
    }
    ComboBox_SetCurSel(m_inChannelCbo, m_midi->inChannel);
    EnableWindow(m_inChannelCbo, m_midi->inPort == -1 ? FALSE : TRUE);
    /*
     * Init the Out Port combo.
     */
    midiOutDevCnt = midiOutGetNumDevs();
    ComboBox_AddString(m_outPortCbo, m_disabledStr);
    for (i = 0; i < midiOutDevCnt; i++) {
        MIDIOUTCAPS midiDevInfo;

        midiOutGetDevCaps(i, &midiDevInfo, sizeof midiDevInfo);
        ComboBox_AddString(m_outPortCbo, midiDevInfo.szPname);
    }
    ComboBox_SetCurSel(m_outPortCbo, m_midi->outPort + 1);
    /*
     * Init the Out Channel combo.
     */
    for (i = 1; i <= 16; i++) {
        _TUCHAR chanStr[3];

        _stprintf(chanStr, _T("%d"), i);
        ComboBox_AddString(m_outChannelCbo, chanStr);
    }
    if (dlgParams->options & MDO_ALLOW_OMNI_OUT) {
        ComboBox_AddString(m_outChannelCbo, m_omniStr);
    }
    ComboBox_SetCurSel(m_outChannelCbo, m_midi->outChannel);
    EnableWindow(m_outChannelCbo, m_midi->outPort == -1 ? FALSE : TRUE);

    return TRUE;
}
Пример #26
0
KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
                                    module_config_t *p_item,
                                    HWND parent, HINSTANCE hInst,
                                    int * py_pos )
  : ConfigControl( p_this, p_item, parent, hInst )
{
    // Number of keys descriptions
    unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t);

    // Init the keys decriptions array
    if( m_keysList == NULL )
    {
        m_keysList = new string[i_keys];
        for( unsigned int i = 0; i < i_keys; i++ )
        {
            m_keysList[i] = vlc_keys[i].psz_key_string;
        }
    }

    label = CreateWindow( _T("STATIC"), _FROMMB(p_item->psz_text),
                WS_CHILD | WS_VISIBLE | SS_LEFT, 5, *py_pos, 200, 15,
                parent, NULL, hInst, NULL );

    *py_pos += 15 + 10;

    alt = CreateWindow( _T("BUTTON"), _T("Alt"),
                        WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
                        20, *py_pos, 15, 15, parent, NULL, hInst, NULL );
    Button_SetCheck( alt, p_item->i_value & KEY_MODIFIER_ALT ? BST_CHECKED :
                     BST_UNCHECKED );

    alt_label = CreateWindow( _T("STATIC"), _T("Alt"),
                WS_CHILD | WS_VISIBLE | SS_LEFT, 20 + 15 + 5, *py_pos, 30, 15,
                parent, NULL, hInst, NULL );

    ctrl = CreateWindow( _T("BUTTON"), _T("Ctrl"),
                WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
                20 + 15 + 5 + 30 + 5, *py_pos, 15, 15,
                parent, NULL, hInst, NULL );
    Button_SetCheck( ctrl, p_item->i_value & KEY_MODIFIER_CTRL ? BST_CHECKED :
                     BST_UNCHECKED );

    ctrl_label = CreateWindow( _T("STATIC"), _T("Ctrl"),
                WS_CHILD | WS_VISIBLE | SS_LEFT,
                20 + 15 + 5 + 30 + 5 + 15 + 5, *py_pos, 30, 15,
                parent, NULL, hInst, NULL );

    shift = CreateWindow( _T("BUTTON"), _T("Shift"),
                WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
                20 + 15 + 5 + 2*(30 + 5) + 15 + 5, *py_pos, 15, 15,
                parent, NULL, hInst, NULL );
    Button_SetCheck( shift, p_item->i_value & KEY_MODIFIER_SHIFT ?
                     BST_CHECKED : BST_UNCHECKED );

    shift_label = CreateWindow( _T("STATIC"), _T("Shift"),
                WS_CHILD | WS_VISIBLE | SS_LEFT,
                20 + 15 + 5 + 2*(30 + 5) + 2*(15 + 5), *py_pos, 30, 15,
                parent, NULL, hInst, NULL );

    *py_pos += 15 + 10;

    combo = CreateWindow( _T("COMBOBOX"), _T(""),
                WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST |
                CBS_SORT | WS_VSCROLL, 20, *py_pos, 130, 5*15 + 6,
                parent, NULL, hInst, NULL );

    *py_pos += 15 + 10;

    for( unsigned int i = 0; i < i_keys ; i++ )
    {
        ComboBox_AddString( combo, _FROMMB(m_keysList[i].c_str()) );
        ComboBox_SetItemData( combo, i, (void*)vlc_keys[i].i_key_code );
        if( (unsigned int)vlc_keys[i].i_key_code ==
            ( ((unsigned int)p_item->i_value) & ~KEY_MODIFIER ) )
        {
            ComboBox_SetCurSel( combo, i );
            ComboBox_SetText( combo, _FROMMB(m_keysList[i].c_str()) );
        }
    }
}
Пример #27
0
BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	//if (!m_hDlg) return FALSE;
	switch(message)
	{
	case WM_INITDIALOG:
		{
			return TRUE;
		}
		break;

	case WM_TIMER:
		{
			int iPage = TabCtrl_GetCurSel (GetDlgItem(m_hDlg, IDC_LEFTTABS));
			ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE);
			ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST),      iPage?SW_HIDE:SW_NORMAL);
		}
		break;

	case WM_NOTIFY:
		switch (wParam)
		{
		case IDC_LEFTTABS:
			{
				HWND tabs = GetDlgItem(m_hDlg, IDC_LEFTTABS);
				NMHDR* pNotifyMessage = NULL;
				pNotifyMessage = (LPNMHDR)lParam; 		
				if (pNotifyMessage->hwndFrom == tabs)
				{
					int iPage = TabCtrl_GetCurSel (tabs);
					ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE);
					ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST),      iPage?SW_HIDE:SW_NORMAL);
				}
			}
			break;
		case IDC_BREAKPOINTLIST:
			handleBreakpointNotify(lParam);
			break;
		case IDC_THREADLIST:
			threadList->handleNotify(lParam);
			break;
		}
		break;
	case WM_COMMAND:
		{
			CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
			CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST));
			switch(LOWORD(wParam))
			{
			case IDC_SHOWVFPU:
				vfpudlg->Show(true);
				break;

			case IDC_FUNCTIONLIST: 
				switch (HIWORD(wParam))
				{
				case CBN_DBLCLK:
					{
						HWND lb = GetDlgItem(m_hDlg,LOWORD(wParam));
						int n = ListBox_GetCurSel(lb);
						if (n!=-1)
						{
							unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n);
							ptr->gotoAddr(addr);
							SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
						}
					}
					break;
				};
				break;

			case IDC_GOTOINT:
				switch (HIWORD(wParam))
				{
				case LBN_SELCHANGE:
					{
						HWND lb =GetDlgItem(m_hDlg,LOWORD(wParam));
						int n = ComboBox_GetCurSel(lb);
						unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n);
						if (addr != 0xFFFFFFFF)
						{
							ptr->gotoAddr(addr);
							SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
						}
					}
					break;
				};
				break;

			case IDC_GO:
				{
					lastTicks = CoreTiming::GetTicks();

					// If the current PC is on a breakpoint, the user doesn't want to do nothing.
					CBreakPoints::SetSkipFirst(currentMIPS->pc);

					SetDebugMode(false);
					Core_EnableStepping(false);
				}
				break;

			case IDC_STEP:
				{
					if (Core_IsActive()) break;
					lastTicks = CoreTiming::GetTicks();

					// If the current PC is on a breakpoint, the user doesn't want to do nothing.
					CBreakPoints::SetSkipFirst(currentMIPS->pc);

					Core_DoSingleStep();		
					Sleep(1);
					_dbg_update_();
					ptr->gotoPC();
					UpdateDialog();
					vfpudlg->Update();

					CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW))->redraw();
					threadList->reloadThreads();
					updateThreadLabel(false);
				}
				break;

			case IDC_STEPOVER:
				{
					if (Core_IsActive()) break;
					lastTicks = CoreTiming::GetTicks();

					// If the current PC is on a breakpoint, the user doesn't want to do nothing.
					CBreakPoints::SetSkipFirst(currentMIPS->pc);

					const char* dis = cpu->disasm(cpu->GetPC(),4);
					const char* pos = strstr(dis,"->$");
					const char* reg = strstr(dis,"->");
					
					ptr->setDontRedraw(true);
					u32 breakpointAddress = cpu->GetPC()+cpu->getInstructionSize(0);
					if (memcmp(dis,"jal\t",4) == 0 || memcmp(dis,"jalr\t",5) == 0)
					{
						// it's a function call with a delay slot - skip that too
						breakpointAddress += cpu->getInstructionSize(0);
					} else if (memcmp(dis,"j\t",2) == 0 || memcmp(dis,"b\t",2) == 0)
					{
						// in case of absolute branches, set the breakpoint at the branch target
						sscanf(pos+3,"%08x",&breakpointAddress);
					} else if (memcmp(dis,"jr\t",3) == 0)
					{
						// the same for jumps to registers
						int regNum = -1;
						for (int i = 0; i < 32; i++)
						{
							if (strcasecmp(reg+2,cpu->GetRegName(0,i)) == 0)
							{
								regNum = i;
								break;
							}
						}
						if (regNum == -1) break;
						breakpointAddress = cpu->GetRegValue(0,regNum);
					} else if (pos != NULL)
					{
						// get branch target
						sscanf(pos+3,"%08x",&breakpointAddress);
						CBreakPoints::AddBreakPoint(breakpointAddress,true);

						// also add a breakpoint after the delay slot
						breakpointAddress = cpu->GetPC()+2*cpu->getInstructionSize(0);						
					}

					SetDebugMode(false);
					CBreakPoints::AddBreakPoint(breakpointAddress,true);
					_dbg_update_();
					Core_EnableStepping(false);
					Sleep(1);
					ptr->gotoAddr(breakpointAddress);
					UpdateDialog();
				}
				break;
				
			case IDC_STEPHLE:
				{
					if (Core_IsActive())
						break;
					lastTicks = CoreTiming::GetTicks();

					// If the current PC is on a breakpoint, the user doesn't want to do nothing.
					CBreakPoints::SetSkipFirst(currentMIPS->pc);

					hleDebugBreak();
					SetDebugMode(false);
					_dbg_update_();
					Core_EnableStepping(false);
				}
				break;

			case IDC_STOP:
				{				
					ptr->setDontRedraw(false);
					SetDebugMode(true);
					Core_EnableStepping(true);
					_dbg_update_();
					Sleep(1); //let cpu catch up
					ptr->gotoPC();
					UpdateDialog();
					vfpudlg->Update();
				}
				break;

			case IDC_SKIP:
				{
					cpu->SetPC(cpu->GetPC() + cpu->getInstructionSize(0));
					Sleep(1);
					ptr->gotoPC();
					UpdateDialog();
				}
				break;

			case IDC_MEMCHECK:
				{
					bool isRunning = Core_IsActive();
					if (isRunning)
					{
						SetDebugMode(true);
						Core_EnableStepping(true);
						Core_WaitInactive(200);
					}

					BreakpointWindow bpw(m_hDlg,cpu);
					if (bpw.exec()) bpw.addBreakpoint();

					if (isRunning)
					{
						SetDebugMode(false);
						Core_EnableStepping(false);
					}
				}
				break;
			case IDC_UPDATECALLSTACK:
				{
					HWND hDlg = m_hDlg;
					HWND list = GetDlgItem(hDlg,IDC_CALLSTACK);
					ComboBox_ResetContent(list);
					
					u32 pc = currentMIPS->pc;
					u32 ra = currentMIPS->r[MIPS_REG_RA];
					DWORD addr = Memory::ReadUnchecked_U32(pc);
					int count=1;
					ComboBox_SetItemData(list,ComboBox_AddString(list,symbolMap.GetDescription(pc)),pc);
					if (symbolMap.GetDescription(pc) != symbolMap.GetDescription(ra))
					{
						ComboBox_SetItemData(list,ComboBox_AddString(list,symbolMap.GetDescription(ra)),ra);
						count++;
					}
					//walk the stack chain
					while (addr != 0xFFFFFFFF && addr!=0 && count++<20)
					{
						DWORD fun = Memory::ReadUnchecked_U32(addr+4);
						const char *str = symbolMap.GetDescription(fun);
						if (strlen(str)==0)
							str = "(unknown)";
						ComboBox_SetItemData(list, ComboBox_AddString(list,str), fun);
						addr = Memory::ReadUnchecked_U32(addr);
					}
					ComboBox_SetCurSel(list,0);
				}
				break;

			case IDC_GOTOPC:
				{
					ptr->gotoPC();	
					SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
					UpdateDialog();
				}
				break;
			case IDC_GOTOLR:
				{
					ptr->gotoAddr(cpu->GetLR());
					SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
				}
				break;

			case IDC_BACKWARDLINKS:
				{
					HWND box = GetDlgItem(m_hDlg, IDC_FUNCTIONLIST); 
					int funcnum = symbolMap.GetSymbolNum(ListBox_GetItemData(box,ListBox_GetCurSel(box)));
					if (funcnum!=-1)
						symbolMap.FillListBoxBLinks(box,funcnum);
					break;
				}

			case IDC_ALLFUNCTIONS:
				{
					symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION);
					break;
				}
			default:
				return FALSE;
			}
			return TRUE;
		}

	case WM_DEB_MAPLOADED:
		NotifyMapLoaded();
		break;
	case WM_DEB_RUNTOWPARAM:
	{
		lastTicks = CoreTiming::GetTicks();
		CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
		ptr->setDontRedraw(true);
		SetDebugMode(false);
		CBreakPoints::AddBreakPoint(wParam,true);
		_dbg_update_();
		Core_EnableStepping(false);
		break;
	}
	case WM_DEB_GOTOWPARAM:
	{
		CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
		ptr->gotoAddr(wParam);
		SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
		break;
	}
	case WM_DEB_GOTOBREAKPOINT:
		gotoBreakpointAddress(wParam);
		break;
	case WM_DEB_REMOVEBREAKPOINT:
		removeBreakpoint(wParam);
		break;
	case WM_DEB_GOTOADDRESSEDIT:
		{
			char szBuffer[256];
			CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
			GetWindowText(GetDlgItem(m_hDlg,IDC_ADDRESS),szBuffer,256);

			u32 addr;
			if (parseExpression(szBuffer,cpu,addr) == false)
			{
				displayExpressionError(GetDlgItem(m_hDlg,IDC_ADDRESS));
			} else {
				ptr->gotoAddr(addr);
				SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
			}
			UpdateDialog();
		}
		break;

	case WM_DEB_SETDEBUGLPARAM:
		SetDebugMode(lParam != 0);
		return TRUE;

	case WM_DEB_UPDATE:
		Update();
		return TRUE;

	case WM_DEB_TABPRESSED:
		{
			HWND bp = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST);
			HWND mem = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW);
			HWND threads = GetDlgItem(m_hDlg, IDC_THREADLIST);
			
			if (IsWindowVisible(bp))
			{
				ShowWindow(bp,SW_HIDE);
				ShowWindow(mem,SW_HIDE);
				ShowWindow(threads,SW_NORMAL);
				SetFocus(threads);
			} else if (IsWindowVisible(threads))
			{
				ShowWindow(bp,SW_HIDE);
				ShowWindow(mem,SW_NORMAL);
				ShowWindow(threads,SW_HIDE);
				SetFocus(mem);
			} else {
				ShowWindow(bp,SW_NORMAL);
				ShowWindow(mem,SW_HIDE);
				ShowWindow(threads,SW_HIDE);
				SetFocus(bp);
			}
		}
		break;
	case WM_SIZE:
		{
			UpdateSize(LOWORD(lParam), HIWORD(lParam));
			SavePosition();
			return TRUE;
		}

	case WM_MOVE:
		SavePosition();
		break;
	case WM_GETMINMAXINFO:
		{
			MINMAXINFO *m = (MINMAXINFO *)lParam;
			// Reduce the minimum size slightly, so they can size it however they like.
			m->ptMinTrackSize.x = defaultRect.right - defaultRect.left - 100;
			//m->ptMaxTrackSize.x = m->ptMinTrackSize.x;
			m->ptMinTrackSize.y = defaultRect.bottom - defaultRect.top - 200;
		}
		return TRUE;
	case WM_CLOSE:
		Show(false);
		return TRUE;
	}
	return FALSE;
}
Пример #28
0
INT_PTR CALLBACK GameTitleProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	//RECT r;
	//RECT r2;
	//int dx1, dy1, dx2, dy2;

	static bool bUpdatingTextboxTitle = false;

 	switch(uMsg)
 	{
 	case WM_INITDIALOG:
	{
		HWND hKnownGamesCbo = GetDlgItem( hDlg, IDC_RA_KNOWNGAMES );
		char sGameTitleTidy[64];
		char buffer[65535];
		char* pBuffer = &buffer[0];
		int nSel = 0;
		const char* NewLine = "\n";
		char* pNextTitle = NULL;

		strcpy_s( sGameTitleTidy, 64, g_GameTitleDialog.m_sEstimatedGameTitle );
		Dlg_GameTitle::CleanRomName( sGameTitleTidy, 64 );

		SetDlgItemText( hDlg, IDC_RA_GAMETITLE, sGameTitleTidy );

		if( strlen( g_pActiveAchievements->m_sPreferredGameTitle ) < 2 )
		{
		}
		else
		{
			//	Why would you ever want this one?
			//SetDlgItemText( hDlg, IDC_RA_GAMETITLE, g_pActiveAchievements->m_sPreferredGameTitle );
		}

		//	Load in the checksum
		SetDlgItemText( hDlg, IDC_RA_CHECKSUM, g_GameTitleDialog.m_sMD5 );


		//	Populate the dropdown
		//	***Do blocking fetch of all game titles.***
		ZeroMemory( buffer, 65535 );
		
		nSel = ComboBox_AddString( hKnownGamesCbo, "<New Title>" );
		ComboBox_SetCurSel( hKnownGamesCbo, nSel );

		{
			char postBuffer[256];
			sprintf_s( postBuffer, 256, "c=%d", g_ConsoleID );
			DWORD nBytesRead = 0;
			if( DoBlockingHttpPost( "requestallgametitles.php", postBuffer, pBuffer, 65535, &nBytesRead ) )
			{
				if( strncmp( pBuffer, "OK:", 3 ) == 0 )
				{
					pBuffer += 3;

					pNextTitle = strtok_s( pBuffer, NewLine, &pBuffer );
					while( pNextTitle != NULL )
					{
						nSel = ComboBox_AddString( hKnownGamesCbo, pNextTitle );

						if( _stricmp( sGameTitleTidy, pNextTitle ) == 0 )
							ComboBox_SetCurSel( hKnownGamesCbo, nSel );

						pNextTitle = strtok_s( pBuffer, NewLine, &pBuffer );
					}
				}
			}
		}

		return TRUE;
	}
	break;
 
 	case WM_COMMAND:
 		switch( LOWORD(wParam) )
 		{
 		case IDOK:
 			{
				//	Fetch input data:
				char sSelectedTitle[512];
 				char sRequest[512];
 				char sResponse[4096];
				const char* sDestPage = NULL;
 				DWORD nBytesRead = 0;
  				
				HWND hKnownGamesCbo = GetDlgItem( hDlg, IDC_RA_KNOWNGAMES );

				ComboBox_GetText( hKnownGamesCbo, sSelectedTitle, 512 );

				if( strcmp( sSelectedTitle, "<New Title>" ) == 0 )
				{
					//	Add a new title!
 					GetDlgItemText( hDlg, IDC_RA_GAMETITLE, sSelectedTitle, 512 );
 					sDestPage = "requestsubmitgametitle.php";
				}
				else
				{
					//	Add an alt!
					sDestPage = "requestsubmitalt.php";
				}
				
				//	Pack query string:
 				sprintf_s( sRequest, 512, "u=%s&t=%s&m=%s&g=%s&c=%d", 
					g_LocalUser.m_sUsername, g_LocalUser.m_sToken, g_GameTitleDialog.m_sMD5, sSelectedTitle, g_ConsoleID );

				//	Send request:
				ZeroMemory( sResponse, 4096 );

 				if( DoBlockingHttpPost( sDestPage, sRequest, sResponse, 4096, &nBytesRead ) &&
					strncmp( sResponse, "OK:", 3 ) == 0 )
 				{
 					//g_pActiveAchievements->SetGameTitle( sSelectedTitle );
					CoreAchievements->SetGameTitle( sSelectedTitle );
					UnofficialAchievements->SetGameTitle( sSelectedTitle );
					LocalAchievements->SetGameTitle( sSelectedTitle );
 
					g_GameTitleDialog.m_nReturnedGameID = strtol( sResponse+3, NULL, 10 );

 					//	Close this dialog
 					EndDialog( hDlg, TRUE );
 					return TRUE;
 				}
 				else
 				{
					char bufferFeedback[2048];
 					sprintf_s( bufferFeedback, 2048, "Failed!\n\nResponse From Server:\n\n%s", sResponse );
 					MessageBox( hDlg, bufferFeedback, "Error from server!", MB_OK );
 
 					return TRUE;
 				}
 			}
 		case IDCANCEL:
 			EndDialog( hDlg, TRUE );
 			return TRUE;
 			break;
		case IDC_RA_GAMETITLE:
			switch( HIWORD(wParam) )
			{
				case EN_CHANGE:
				{
					if( !bUpdatingTextboxTitle )	//	Note: use barrier to prevent automatic switching off.
					{
						//	If the user has started to enter a value, set the upper combo to 'new entry'
						HWND hKnownGamesCbo = GetDlgItem( hDlg, IDC_RA_KNOWNGAMES );
						ComboBox_SetCurSel( hKnownGamesCbo, 0 );
					}
				}
				break;
			}
			break;
		case IDC_RA_KNOWNGAMES:
			switch( HIWORD(wParam) )
			{
				case CBN_SELCHANGE:
				{
					//	If the user has selected a value, copy this text to the bottom textbox.
					bUpdatingTextboxTitle = TRUE;

					char sSelectedTitle[512];
 					GetDlgItemText( hDlg, IDC_RA_KNOWNGAMES, sSelectedTitle, 512 );
					SetDlgItemText( hDlg, IDC_RA_GAMETITLE, sSelectedTitle );
					
					bUpdatingTextboxTitle = FALSE;
				}
				break;
			}
			break;
 		}
 		break;
 	case WM_KEYDOWN:
		//IDC_RA_GAMETITLE
		wParam;
		break;
 	case WM_CLOSE:
 		// 		if (Full_Screen)
 		// 		{
 		// 			while (ShowCursor(true) < 0);
 		// 			while (ShowCursor(false) >= 0);
 		// 		}
 
 		EndDialog( hDlg, FALSE );
 		return TRUE;
 		break;
 	}

	return FALSE;
}