Code for dialing to a server using a modem

Posted on 2005-04-11
Medium Priority
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
  • 2
LVL 55

Accepted Solution

Jaime Olivares earned 500 total points
ID: 13759792
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

ID: 13975209
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?


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

850 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