Code for dialing to a server using a modem

Posted on 2005-04-11
Last Modified: 2010-04-24
Hi All,

Below is the extract of code for dialing to a server using a modem. It is working fine in Win98 but not in Win2000 and XP.

The modem returns a string “Error”.


CString m_ServerNum = “9,64809988”;

CString serverCmd = "ATV1Q0DT";

serverCmd = serverCmd+m_ServerNum;


UINT len = serverCmd.GetLength();

char* StartupStr = (LPTSTR)serverCmd.GetBuffer(len);


if (!::WriteFile (hPort, StartupStr, len, &BytesWritten, NULL))

            return ERROR;

Question by:fox404
    LVL 55

    Accepted Solution

    Have a try with:

    CString m_ServerNum = “9,64809988”;
    CString serverCmd = "ATV1Q0DT";
    serverCmd = serverCmd+m_ServerNum+"\n";

    if (!::WriteFile (hPort, (LPCTSTR)serverCmd, serverCmd.GetLength(), &BytesWritten, NULL))
          return ERROR;

    Author Comment

    Hi Jaime,

    I did try this code "WriteFile" in Window98, it is working, but in Windows 2000 and Windows XP it is not working!

    Do you have any idea?

    LVL 55

    Expert Comment

    by:Jaime Olivares

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    Title # Comments Views Activity
    Deploying with installshield 1 281
    Need help with a query 7 42
    Implementing a ResolveEventHandler in C++ 13 96
    Visual c++ and text files 7 45
    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now