COleException *pe;
pe->m_sc打印这个状态码看是什么,再判断是何种原因导致出错的。

解决方案 »

  1.   

    呵呵,主要是我感觉大家都不愿意看长篇代码,呵呵,好吧,我还是贴出来吧,多谢大家了
    void Display_Save_AP_INFO(CListBox *pAP_List,CEdit *pAP_Info,CCheckComboBox *m_checkcombo,int ap_num,int save_flag,FILE *file_orange,FILE *file_apple,FILE *file_coco,FILE *file_pear,FILE *file_banana,PWLAN_AVAILABLE_NETWORK_LIST pVList)
    {
    UCHAR ucssid[32] = {0};
    int i = 0;
    CString str;
    int m = 0;
    pAP_List->ResetContent(); //复位列表框中的数据
    pAP_Info->SetWindowText(""); //复位编辑框中的数据 CString temp_str;
    CString strength_str;
    char temp_string[50] = {0}; for(i = 0; i < ap_num; i++)//在编辑框中分行显示并且分行保存
    { int RSSI_strength = (int)(-100 + pVList->Network[i].wlanSignalQuality * 0.5);
    strength_str.Format("%d",RSSI_strength);
    strcpy_s((char *)ucssid,32,(char *)pVList->Network[i].dot11Ssid.ucSSID);
    temp_str = ucssid;
    pAP_List->AddString(temp_str);
    temp_str = temp_str + "   " + strength_str;
    str = str + "\r\n" + temp_str;

    if(save_flag)
    {
    try
    {
    if(m_checkcombo ->GetItemData(i))
    {
    try
    {
    CString strItem;
    m_checkcombo -> GetLBText(i,strItem);
    if(strItem == "Orange")
    {
    strength_str += "\n";
    //file_orange->WriteString((LPCTSTR)strength_str);
    strcpy_s(temp_string,(LPCTSTR)strength_str);
    fprintf(file_orange,"%s",temp_string);
    fflush(file_orange);
    }
    else if(strItem == "Apple")
    {
    strength_str += "\n";
    //file_apple->WriteString((LPCTSTR)strength_str);
    //file_apple->Flush();
    strcpy_s(temp_string,(LPCTSTR)strength_str);
    fprintf(file_apple,"%s",temp_string);
    fflush(file_apple);
    }
    else if(strItem == "Pear")
    {
    strength_str += "\n";
    //file_pear->WriteString((LPCTSTR)strength_str);
    //file_pear->Flush();
    strcpy_s(temp_string,(LPCTSTR)strength_str);
    fprintf(file_pear,"%s",temp_string);
    fflush(file_pear);
    }
    else if(strItem == "Banana")
    {
    strength_str += "\n";
    //file_banana->WriteString((LPCTSTR)strength_str);
    //file_banana->Flush();
    strcpy_s(temp_string,(LPCTSTR)strength_str);
    fprintf(file_banana,"%s",temp_string);
    fflush(file_banana);
    }
    else if(strItem == "CoCo")
    {
    strength_str += "\n";
    //file_coco->WriteString((LPCTSTR)strength_str);
    //file_coco->Flush();
    strcpy_s(temp_string,(LPCTSTR)strength_str);
    fprintf(file_coco,"%s",temp_string);
    fflush(file_coco);
    }
    }
    catch(COleException *pe)
    {
    AfxMessageBox("enter COleException 2");
    pe->ReportError();
    pe->Delete();
    }
    }
    }
    catch(COleException *pe)
    {
    AfxMessageBox("enter COleException 1");
    pe->ReportError();
    pe->Delete();
    }
    }
    }
    pAP_Info->SetWindowText("SSID         Strength" + str);
    }
      

  2.   

    这个状态码 为TRACE (_T("COleException caught. SCODE = %x\n"), pe->m_sc);
    -2147024809