使用mapobjects2.3开发,在应用程序类的InitInstance()函数出错,具体出错地方如下: if (!ProcessShellCommand(cmdInfo))  // 运行这一句时出错
return FALSE;    先是出现下面的错误图:
按“终止”之后,出现下面的错误图片:
     其实在我的程序中我是使用ado连接数据库的,但是我想到可能mapobjects2.3用到dao350.dll。于是使用regsvr32.exe把dao350.dll和Mo20.ocx都注册了,但是没用,运行还是出现上面的错误。用google搜索也没搜出什么东西。请问大家遇到过这样的错误吗?怎么解决呢?

解决方案 »

  1.   

       对了我的编译环境是:
    VC 6.0+sp6, WinXp sp2 
      

  2.   


      相关代码:BOOL CWMDQSApp::InitInstance()
    {
    AfxEnableControlContainer(); // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need.#ifdef _AFXDLL
    Enable3dControls(); // Call this when using MFC in a shared DLL
    #else
    Enable3dControlsStatic(); // Call this when linking to MFC statically
    #endif // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));
    CSYDrawMgrOffice2003* pDM2003 = new CSYDrawMgrOffice2003;
    pDM2003->SetAutoDel();
    CSYGUIMgr::S_SetDrawMgr(pDM2003); LoadStdProfileSettings();  // Load standard INI file options (including MRU)
        AfxOleInit();
    m_pConnection.CreateInstance(__uuidof(Connection));
    try                 
    {
    m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DataBase\\WMDQS.mdb","","",adModeUnknown);
    }
    catch(_com_error e)
    {
    AfxMessageBox("数据库连接失败,确认数据库WMDQS.mdb是否在当前路径下!");
    return FALSE;

    // Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views.
        // 系统登录
    CLoginDlg login;
        if(login.DoModal()==IDCANCEL)
    return FALSE;
    ////
        CSplashWnd* pCsw = new CSplashWnd("start_cn.jpg");//located in the local directory,or else full-path file name is needed
    pCsw->ShowSplash();
    Sleep(2000);//delay some time to observe the image displayed.
    pCsw->CloseSplash();
    delete pCsw;
    pCsw = NULL;
    ////
    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
    IDR_MAINFRAME,
    RUNTIME_CLASS(CWMDQSDoc),
    RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    RUNTIME_CLASS(CWMDQSView));
    AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
    return FALSE;
      
    // The one and only window has been initialized, so show and update it.
    m_pMainWnd->SetWindowText("世界大型超大型矿床数据库检索系统");
    m_pMainWnd->ShowWindow(SW_MAXIMIZE);
    m_pMainWnd->UpdateWindow();
    SystemParametersInfo(SPI_SETDRAGFULLWINDOWS,false,NULL,0);
    return TRUE;
    }
        上面是应用程序类的InitInstance函数,下面是登陆对话框的OnOK函数:void CLoginDlg::OnOK() 
    {
    _CommandPtr cmd;
    _RecordsetPtr rs;
    _ConnectionPtr conn;
    _variant_t va;

    try
    {
    //创建Command,Connection和Recordset的实例
    cmd.CreateInstance(__uuidof(Command));
    rs.CreateInstance(__uuidof(Recordset));
    conn.CreateInstance(__uuidof(Connection)); //获取在对话框中输入的数据
    UpdateData(TRUE);
    conn = theApp.m_pConnection;
    cmd->ActiveConnection = conn; //用SQL语句进行查询
    CString strQuery;
    strQuery.Format("SELECT * FROM Users WHERE userName='%s' AND userPassword='%s'",m_userName,m_password);
    cmd->CommandText = (_bstr_t)strQuery;
    cmd->CommandType = adCmdText;

    rs = cmd->Execute(&va,NULL,adCmdText);
    if(!rs->BOF)
    {
     CDialog::OnOK();

    }
    else
    {
        MessageBox("用户名和密码有错,请重新输入!","登录失败",MB_ICONINFORMATION);
    m_userName.Empty();
    m_password.Empty();
    UpdateData(FALSE);
    }
    }
    catch(_com_error &e)
    {
    CString strError;
    strError += (_bstr_t)e.Description();
    MessageBox(strError);
    }
    }
            我很奇怪为何会在InitInstance()函数的这一句if (!ProcessShellCommand(cmdInfo)) 出错呢.