|  | 
 
| 芯片参数修改和添加差不多,只是修改后点一下修改按钮而已。测试没问题后都得点保存才能将支持库的信息修改。 这里图就不贴了,不清楚就看前一帖。下面是实现代码:
 
 还是那句话,跟一下就明白了。复制代码void CProgDeviceManage::OnDeviceModify() 
{
        // TODO: Add your control notification handler code here
        CString temp;
        ZeroMemory(&m_stDFile, sizeof(DeviceListFileStruct));
//        ZeroMemory(&m_stDFileHead, sizeof(DeviceListFileHeadStruct));
        UpdateData(true);
        //device name
        if (m_sDeviceName.IsEmpty())
        {
                AfxMessageBox("芯片名称不能为空");
                return;
        }
        strcpy(m_stDFile.DeviceName,m_sDeviceName);
        //Device Type
        m_cDeviceType.GetWindowText(temp);
        if (temp.IsEmpty())
        {
                AfxMessageBox("芯片类型不能为空");
                return;
        }
        int index;
        CString tname;
//        m_cDeviceType.GetWindowText(temp);
        for (int i=0; i<parent->m_arTypeList.GetSize(); i++)
        {
                tname = parent->m_arTypeList.GetAt(i).TypeName;
                if (temp == tname)
                        index = i;
        }
        m_stDFile.DeviceType = parent->m_arTypeList.GetAt(index).TypeVal;
//        if (temp == "EPROM") m_stDFileHead.EpromCount += 1;
//        if (temp == "PROM") m_stDFileHead.PromCount += 1;
//        if (temp == "MPU") m_stDFileHead.MPUCount += 1;
//        if (temp == "PLD") m_stDFileHead.PLDCount += 1;
        m_stDFile.DeviceManuID = (DWORD)strtoul(m_sDeviceManuID, NULL, 16);
        m_stDFile.DeviceID = (DWORD)strtoul(m_sDeviceID, NULL, 16);
        m_stDFile.DeviceCheckCRC = (DWORD)strtoul(m_sDeviceCheckCRC, NULL, 16);
        
        m_cOperationID.GetWindowText(temp);
        for (i=0; i<parent->m_arOperationList.GetSize(); i++)
        {
                tname = parent->m_arOperationList.GetAt(i).TypeName;
                if (temp == tname)
                        index = i;
        }
        m_stDFile.OperationID = parent->m_arOperationList.GetAt(index).TypeVal;
        if (m_sDeviceManuName.IsEmpty())
        {
                AfxMessageBox("厂家名称不能为空");
                return;
        }
        strcpy(m_stDFile.DeviceManuName,m_sDeviceManuName);
        m_cDeviceSize.GetWindowText(temp);
        for (i=0; i<parent->m_arSizeList.GetSize(); i++)
        {
                tname = parent->m_arSizeList.GetAt(i).TypeName;
                if (temp == tname)
                        index = i;
        }
        m_stDFile.DeviceSize = parent->m_arSizeList.GetAt(index).TypeVal;
        m_cDeviceDataWidth.GetWindowText(temp);
        for (i=0; i<parent->m_arDataWidthList.GetSize(); i++)
        {
                tname = parent->m_arDataWidthList.GetAt(i).TypeName;
                if (temp == tname)
                        index = i;
        }
        m_stDFile.DeviceDataWidth = parent->m_arDataWidthList.GetAt(index).TypeVal;
        m_cDevicePackage.GetWindowText(temp);
        for (i=0; i<parent->m_arPackageList.GetSize(); i++)
        {
                tname = parent->m_arPackageList.GetAt(i).TypeName;
                if (temp == tname)
                        index = i;
        }
        m_stDFile.DevicePackage = parent->m_arPackageList.GetAt(index).TypeVal;
        m_cDevicePinCount.GetWindowText(temp);
        for (i=0; i<parent->m_arPinList.GetSize(); i++)
        {
                tname = parent->m_arPinList.GetAt(i).TypeName;
                if (temp == tname)
                        index = i;
        }
        m_stDFile.DevicePinCount = parent->m_arPinList.GetAt(index).TypeVal;
        m_cDeviceVCC.GetWindowText(temp);
        for (i=0; i<parent->m_arVCCList.GetSize(); i++)
        {
                tname = parent->m_arVCCList.GetAt(i).TypeName;
                if (temp == tname)
                        index = i;
        }
        m_stDFile.DeviceVCC = parent->m_arVCCList.GetAt(index).TypeVal;
        m_cDeviceVPP.GetWindowText(temp);
        for (i=0; i<parent->m_arVPPList.GetSize(); i++)
        {
                tname = parent->m_arVPPList.GetAt(i).TypeName;
                if (temp == tname)
                        index = i;
        }
        m_stDFile.DeviceVPP = parent->m_arVPPList.GetAt(index).TypeVal;
        m_cDeviceAdapter.GetWindowText(temp);
        for (i=0; i<parent->m_arAdapterList.GetSize(); i++)
        {
                tname = parent->m_arAdapterList.GetAt(i).TypeName;
                if (temp == tname)
                        index = i;
        }
        m_stDFile.DeviceAdapter = parent->m_arAdapterList.GetAt(index).TypeVal;
        strcpy(m_stDFile.Datasheet,m_sDeviceDatasheet);
        strcpy(m_stDFile.DeviceManuICO,m_sDeviceManuICO);
        strcpy(m_stDFile.DeviceICICO,m_sDeviceICICO);
        strcpy(m_stDFile.DeviceNote,m_sDeviceNote);
        int iDeviceSel;
        m_cDeviceList.GetText(m_cDeviceList.GetCurSel(),temp);
        for (i=0; i<parent->m_arDeviceList.GetSize(); i++)
        {
                if(temp == parent->m_arDeviceList.GetAt(i).DeviceName) 
                        iDeviceSel = i;
        }
        parent->m_arDeviceList.SetAt(iDeviceSel,m_stDFile);
                AfxMessageBox("芯片信息已修改");
        
}
 
 
 | 
 |