我做了一个串口和modem拨号的程序,第一次拨号好使,但是第二次再拨的时候modem就没有任何反应了,不知道是为什么?

解决方案 »

  1.   

    你没有关闭modem吧
    1。要是用ras api关闭函数如下
    RasHangUp(handle);
    Sleep(2000);
    handle=NULL;handle是你定义的HRASCONN handle=NULL;2.直接用串口关闭的话:
    //结束CommProc线程中WaitSingleObject函数的等待
    SetEvent(m_hPostMsgEvent);
    //结束CommProc线程中WaitCommEvent的等待
    SetCommMask(m_hCom, 0);
    //等待辅助线程终止
    WaitForSingleObject(m_pThread->m_hThread, INFINITE);
    m_pThread=NULL;

    CloseHandle(m_hCom);
    就可以了