我自己编了一个VC小程序,里面用了DBGrid和RomoteData,MSComm控件。
编译时都没错,但是运行时出现如下错误:
Debug Assertion Failed!
PROGRAM: E:\MYVVPRC\SERIALCOMM\DEBUG\SERIALCOMM.EXE
File: objcore.cpp
Line:43Fir information on how your program can cause an assertion failure, see the Visual C++
documention on assers.
    (Press Retry to debug the application)

解决方案 »

  1.   

    我在视图界面上添加了Button2和MSComm控件,将对话框Dialog1设置为类CSetPortDlg类里,并添加变量m_strSettings,
    原代码如下:
    /设置串口
    void CSerialComnView::OnButton2() 
    {
    // TODO: Add your control notification handler code here
    CSetPortDlg myport;
        myport.m_strSettings=_T("9600,n,8,1");
    m_mscomm.SetSettings(myport.m_strSettings);
        m_mscomm.SetCommPort(1);
    if (m_mscomm.GetPortOpen())
      AfxMessageBox("Port is already open!");
      

  2.   

    我在单步调试中,进入下面代码倒数第二行:
    // This is a part of the Microsoft Foundation Classes C++ library.
    // Copyright (C) 1992-1998 Microsoft Corporation
    // All rights reserved.
    //
    // This source code is only intended as a supplement to the
    // Microsoft Foundation Classes Reference and related
    // electronic documentation provided with the library.
    // See these sources for detailed information regarding the
    // Microsoft Foundation Classes product.#include "stdafx.h"#ifdef _DEBUG
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // export WinMain to force linkage to this moduleextern int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPTSTR lpCmdLine, int nCmdShow);extern "C" int WINAPI
    _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPTSTR lpCmdLine, int nCmdShow)
    { // call shared/exported WinMain
    return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
    }
    在调试窗口Watch中出现如下错误:
    Name: this
    Value:  CXX0017: Error: symbol "this" not found
      

  3.   

    呵呵 我试了一下 好象没有你说的这种问题 建议你再新建一个dialog工程,再试一下,应该不会有问题的我帮你up一下吧 :)
      

  4.   

    还有你要下断点去调试 不要去走他的main 如果是view 你可以在view的oncreate中下断点 如果是dialog 你可以在oninitdialog中下断点 另有一问 你的mscomm是自己create上去的吗??因为你说在view中放的 我只知道在view中只能用create啊 还是你把mscomm放在dialog中的?
      

  5.   

    我是把MScomm控件放在View中的,看来是我搞错了