void CDFFDUseStruct::OnGetStructVar()
{
	if (ctl_struct_var_.m_nMenuResult != 0)
	{
		ctl_struct_.SetWindowText(get_menu_text(pstruct_menu_, ctl_struct_var_.m_nMenuResult));
		ctl_struct_.SetFocus();
		modified_ = true;
	}
}
Beispiel #2
0
void CDFFDJump::OnGetOffsetVar()
{
	if (ctl_offset_var_.m_nMenuResult != 0)
	{
		CString strVar = get_menu_text(poffset_menu_, ctl_offset_var_.m_nMenuResult);
		ASSERT(!strVar.IsEmpty());      // The selected menu item should be found in the menu tree

		// Put the var name into the "offset" control
		for (int ii = 0; ii < strVar.GetLength (); ii++)
			ctl_offset_.SendMessage(WM_CHAR, (TCHAR)strVar[ii]);
		ctl_offset_.SetFocus();
		modified_ = true;
	}
}
Beispiel #3
0
void CGeneralCRC::OnDelete()
{
	// First check that we selected from the list (using Select menu)
	// else we don't know what to delete
	if (last_selected_ < last_predefined_ || last_selected_ >= settings_.size())
	{
		assert(0);   // Code should prevent this from happening
		return;
	}

	// Delete from the Select menu
	CMenu menu;
	menu.Attach(select_menu_.m_hMenu);
	CString strName = get_menu_text(&menu, last_selected_);  // save mneu item name - used to delete reg value by name

	CString mess;
	mess.Format("Are you sure you want to delete the settings for %s", strName);
	if (TaskMessageBox("Delete CRC Settings", mess, MB_YESNO) != IDYES)
	{
		menu.Detach();
		return;
	}
	menu.DeleteMenu(last_selected_, MF_BYCOMMAND);  // Delete menu item with selected ID
	menu.Detach();

	// Delete from settings_ (where ID == last_selected_ is the index into the array)
	settings_[last_selected_] = CString("");  // clear but don't delete unused entries (else menu item ID's won't mathc array indices)

	// Remove the setting from the registry
	HKEY hkey;
	if (::RegCreateKey(HKEY_CURRENT_USER, reg_locn, &hkey) == ERROR_SUCCESS)
	{
		::RegDeleteValue(hkey, strName);
		::RegCloseKey(hkey);
	}

	// Disable Delete button now as we just deleted it
	GetDlgItem(IDC_CRC_DELETE)->EnableWindow(FALSE);
}
Beispiel #4
0
// Selection was made from the Select menu button of a predefined CRC settings
void CGeneralCRC::OnSelect()
{
	int id = select_menu_.m_nMenuResult;  // slected menu ID (= index into settings_)
	if (id > 0 && id < settings_.size())
	{
		// Get the param string associated with the select menu item and load it into member vars
		LoadParams(settings_[id]);

		// Update dlg controls from members variables
		UpdateData(FALSE);

		// Get the menu item text and load it into the name field
		CMenu menu;
		menu.Attach(select_menu_.m_hMenu);
		CString ss = get_menu_text(&menu, id);
		menu.Detach();
		SetDlgItemText(IDC_CRC_NAME, ss);

		// Enable the Delete button if this is a user defined setting
		GetDlgItem(IDC_CRC_DELETE)->EnableWindow(id >= last_predefined_);
		last_selected_ = id;
	}
}