⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config_page1.cpp.svn-base

📁 vc环境下编译的一个对USB设备进行烧录的驱动程序
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
			m_list_file.SetItemText(i, 2, "U-DISK");
			m_list_file.SetItemText(i, 4, config.download_files[i].file_flash_path);
		}

		str.Format("0x%x", config.download_files[i].file_run_address);
		m_list_file.SetItemText(i, 5, str);
		
	}

	for(i = 0; i < config.set_register_count; i++)
	{
		CString strIndex;
		strIndex.Format("%d", i+1);
		m_list_register.InsertItem(i, strIndex);

		str.Format("0x%x", config.set_registers[i].address);
		m_list_register.SetItemText(i, 1, str);
		str.Format("0x%x", config.set_registers[i].value);
		m_list_register.SetItemText(i, 2, str);
	}

	for(i  = 0; i< config.erase_count; i++)
	{
		CString strIndex;
		strIndex.Format("%d", i + 1);
		m_list_erase.InsertItem(i, strIndex);

        if(config.erases[i].type == ERASE_NORFLASH)
            m_list_erase.SetItemText(i, 1, __T("NORFLASH"));
        else if(config.erases[i].type == ERASE_NANDFLASH)
            m_list_erase.SetItemText(i, 1, __T("NANDFLASH"));
        else
            m_list_erase.SetItemText(i, 1, __T("S-FLASH"));

		str.Format("0x%x", config.erases[i].Start_Address);
		m_list_erase.SetItemText(i, 2, str);
		str.Format("0x%x", config.erases[i].End_Address);
		m_list_erase.SetItemText(i, 3, str);
	}

	for(i = 0; i< config.format_count; i++)
	{
		CString strIndex;
		strIndex.Format("%d", i + 1);
		m_list_format.InsertItem(i, strIndex);

		str.Format("%c", config.formats[i].Disk_Name);
        str.MakeUpper();
		m_list_format.SetItemText(i, 1, str);

        if(config.formats[i].bOpenZone)
        {
            m_list_format.SetItemText(i, 2, "是");
        }
        else
        {
            m_list_format.SetItemText(i, 2, "否");
        }

        if(config.formats[i].ProtectType == MEDIUM_PORTECT_LEVEL_NORMAL)
        {
            m_list_format.SetItemText(i, 3, "NORMAL");
        }
        else if(config.formats[i].ProtectType == MEDIUM_PORTECT_LEVEL_CHECK)
        {
            m_list_format.SetItemText(i, 3, "CHECK");
        }
        else if(config.formats[i].ProtectType == MEDIUM_PORTECT_LEVEL_READONLY)
        {
            m_list_format.SetItemText(i, 3, "READONLY");
        }

        if(config.formats[i].ZoneType == ZT_MMI)
        {
            m_list_format.SetItemText(i, 4, "MMI");
        }
        else if(config.formats[i].ZoneType == ZT_MMI_BK)
        {
            m_list_format.SetItemText(i, 4, "MMIBACKUP");
        }
        else if(config.formats[i].ZoneType == ZT_UNSTANDARD)
        {
            m_list_format.SetItemText(i, 4, "UNSTANDARD");
        }
        else if(config.formats[i].ZoneType == ZT_UNSTANDARD_BK)
        {
            m_list_format.SetItemText(i, 4, "UNSTANDARDBACKUP");
        }
        else if(config.formats[i].ZoneType == ZT_STANDARD)
        {
            m_list_format.SetItemText(i, 4, "STANDARD");
        }
        else
        {
            m_list_format.SetItemText(i, 4, "FAKE");
        }


		str.Format("0x%x", config.formats[i].Start_Address);
		m_list_format.SetItemText(i, 5, str);
		str.Format("0x%x", config.formats[i].End_Address);
		m_list_format.SetItemText(i, 6, str);

	}

	for(i = 0; i< config.download_fat_image_count; i++)
	{
		CString strIndex;
		strIndex.Format("%d", i + 1);
		m_list_image.InsertItem(i, strIndex);

		str.Format("%c", config.images[i].Disk_Name);
		m_list_image.SetItemText(i, 1, str);

		TCHAR * relative_path = config.images[i].file_pc_path;


		if((relative_path = strstr(config.images[i].file_pc_path, Current_DirectoryBuffer)) != NULL)
		{
			relative_path = config.images[i].file_pc_path + strlen(Current_DirectoryBuffer) + 1;
			m_list_image.SetItemText(i, 2, relative_path);
		}
		else
		{
			m_list_image.SetItemText(i, 2, config.images[i].file_pc_path);
		}

		str.Format("0x%x", config.images[i].File_Size);
		m_list_image.SetItemText(i, 3, str);
	}

}


void CConfig_Page1::OnButtonBrowseNandboot() 
{
	// TODO: Add your control notification handler code here
	extern HINSTANCE _hInstance;
				
	OPENFILENAME ofn;
	TCHAR pstrFileName[260] = {0}, pstrTitleName[260] = {0};
	
	TCHAR szFilter[] =	TEXT ("BIN Files (*.bin;*.nb0)\0*.bin;*.nb0\0")  \
		TEXT ("All Files (*.*)\0*.*\0\0") ;
	
	memset ( &ofn, 0, sizeof ( ofn ) );
	
	ofn.lStructSize       = sizeof (OPENFILENAME) ;
	ofn.hInstance         = _hInstance ;
	ofn.hwndOwner         = GetSafeHwnd();
	ofn.lpstrFilter       = szFilter;
	ofn.nMaxFile          = MAX_PATH ;
	ofn.lpstrDefExt       = TEXT ("bin") ;
	ofn.lpstrFile         = pstrFileName ;
	ofn.Flags             = OFN_FILEMUSTEXIST; 
	
	
	if(GetOpenFileName (&ofn))
	{
		TCHAR * relative_path = pstrFileName;

		if((relative_path = strstr(pstrFileName, Current_DirectoryBuffer)) != NULL)
		{
			relative_path = pstrFileName + strlen(Current_DirectoryBuffer) + 1;
			SetDlgItemText(IDC_EDIT_NANDBOOT_PATH, relative_path);
		}
		else
			SetDlgItemText(IDC_EDIT_NANDBOOT_PATH, pstrFileName);				
	}
	
}

void CConfig_Page1::OnCheckNandboot() 
{
	// TODO: Add your control notification handler code here
	CString str;
	
	int check = ((CButton *)GetDlgItem(IDC_CHECK_NANDBOOT))->GetCheck();
	
	if(check == 1)//button is unchecked
	{
		//((CButton *)GetDlgItem(IDC_CHECK_NANDBOOT))->SetCheck(BST_CHECKED);

		config.bNandBoot = true;

		SetDlgItemText(IDC_EDIT_NANDBOOT_PATH, config.nandboot_path);

        SetDlgItemText(IDC_EDIT_BIOS_PATH, config.bios_path);

		//str.Format("%d", config.bios_main_version);
        str.Format("%d", 1);
		SetDlgItemText(IDC_EDIT_MAIN_VERSION, str);

		//str.Format("%d", config.bios_sub_version);
        str.Format("%d", 0);
		SetDlgItemText(IDC_EDIT_SUB_VERSION, str);

		str.Format("0x%x", config.bios_start_address);
		SetDlgItemText(IDC_EDIT_BIOS_START_ADDRESS, str);

		str.Format("0x%x", config.bios_end_address);
		SetDlgItemText(IDC_EDIT_BIOS_END_ADDRESS, str);

        str.Format("0x%x", config.bios_backup_start_address);
		SetDlgItemText(IDC_EDIT_BIOS_BACKUP_START_ADDRESS, str);

        str.Format("0x%x", config.bios_backup_end_address);
		SetDlgItemText(IDC_EDIT_BIOS_BACKUP_END_ADDRESS, str);        

		str.Format("0x%x", config.bios_run_address);
		SetDlgItemText(IDC_EDIT_BIOS_RUN_ADDRESS, str);

		GetDlgItem(IDC_BUTTON_BROWSE_NANDBOOT)->EnableWindow(TRUE);
        GetDlgItem(IDC_BUTTON_BROWSE_BIOS)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_NANDBOOT_PATH)->EnableWindow(TRUE);
        GetDlgItem(IDC_EDIT_BIOS_PATH)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_MAIN_VERSION)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_SUB_VERSION)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BIOS_START_ADDRESS)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BIOS_END_ADDRESS)->EnableWindow(TRUE);
        GetDlgItem(IDC_EDIT_BIOS_BACKUP_START_ADDRESS)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BIOS_BACKUP_END_ADDRESS)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BIOS_RUN_ADDRESS)->EnableWindow(TRUE);

	}
	else
	{
		//((CButton *)GetDlgItem(IDC_CHECK_NANDBOOT))->SetCheck(BST_UNCHECKED);

		config.bNandBoot = false;

		GetDlgItem(IDC_BUTTON_BROWSE_NANDBOOT)->EnableWindow(FALSE);
        GetDlgItem(IDC_BUTTON_BROWSE_BIOS)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_NANDBOOT_PATH)->EnableWindow(FALSE);
        GetDlgItem(IDC_EDIT_BIOS_PATH)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_MAIN_VERSION)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_SUB_VERSION)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BIOS_START_ADDRESS)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BIOS_END_ADDRESS)->EnableWindow(FALSE);
        GetDlgItem(IDC_EDIT_BIOS_BACKUP_START_ADDRESS)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BIOS_BACKUP_END_ADDRESS)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BIOS_RUN_ADDRESS)->EnableWindow(FALSE);
	}
	
}

void CConfig_Page1::OnButtonBrowseBios() 
{
	// TODO: Add your control notification handler code here
    extern HINSTANCE _hInstance;
				
	OPENFILENAME ofn;
	TCHAR pstrFileName[260] = {0}, pstrTitleName[260] = {0};
	
	TCHAR szFilter[] =	TEXT ("BIN Files (*.bin;*.nb0)\0*.bin;*.nb0\0")  \
		TEXT ("All Files (*.*)\0*.*\0\0") ;
	
	memset ( &ofn, 0, sizeof ( ofn ) );
	
	ofn.lStructSize       = sizeof (OPENFILENAME) ;
	ofn.hInstance         = _hInstance ;
	ofn.hwndOwner         = GetSafeHwnd();
	ofn.lpstrFilter       = szFilter;
	ofn.nMaxFile          = MAX_PATH ;
	ofn.lpstrDefExt       = TEXT ("bin") ;
	ofn.lpstrFile         = pstrFileName ;
	ofn.Flags             = OFN_FILEMUSTEXIST; 
	
	
	if(GetOpenFileName (&ofn))
	{
		TCHAR * relative_path = pstrFileName;

		if((relative_path = strstr(pstrFileName, Current_DirectoryBuffer)) != NULL)
		{
			relative_path = pstrFileName + strlen(Current_DirectoryBuffer) + 1;
			SetDlgItemText(IDC_EDIT_BIOS_PATH, relative_path);
		}
		else
			SetDlgItemText(IDC_EDIT_BIOS_PATH, pstrFileName);				
	}
	
}

void CConfig_Page1::OnCheckCom() 
{
	// TODO: Add your control notification handler code here

    CString str;
	
	int check = ((CButton *)GetDlgItem(IDC_CHECK_COM))->GetCheck();
	
	CheckCom(check);	
}

void CConfig_Page1::CheckCom(bool check)
{	
    CString str;
	
	if(check == 1)//button is unchecked
	{
		//((CButton *)GetDlgItem(IDC_CHECK_NANDBOOT))->SetCheck(BST_CHECKED);

		config.bOpenCom = true;

		((CButton *)GetDlgItem(IDC_CHECK_COM))->SetCheck(BST_CHECKED);

        str.Format("%d", config.com_count);
	    SetDlgItemText(IDC_EDIT_COM_COUNT, str);

	    str.Format("%d", config.base_com);
	    SetDlgItemText(IDC_EDIT_BASE_COM, str);

	    str.Format("%d", config.BaudRate);
	    SetDlgItemText(IDC_EDIT_BAUDRATE, str);

        
		GetDlgItem(IDC_EDIT_COM_COUNT)->EnableWindow(TRUE);
        GetDlgItem(IDC_EDIT_BASE_COM)->EnableWindow(TRUE);
		GetDlgItem(IDC_EDIT_BAUDRATE)->EnableWindow(TRUE);

	}
	else
	{
		//((CButton *)GetDlgItem(IDC_CHECK_NANDBOOT))->SetCheck(BST_UNCHECKED);

		config.bOpenCom = false;

		GetDlgItem(IDC_EDIT_COM_COUNT)->EnableWindow(FALSE);
        GetDlgItem(IDC_EDIT_BASE_COM)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_BAUDRATE)->EnableWindow(FALSE);
	}	
}

void CConfig_Page1::OnChangeEditEquipmentCount() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CPropertyPage::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	CString str;

	if(!GetDlgItem(IDC_CHECK_COM)->IsWindowEnabled())
	{
		GetDlgItemText(IDC_EDIT_EQUIPMENT_COUNT, str);
		SetDlgItemText(IDC_EDIT_COM_COUNT, str);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -