Code for dialing to a server using a modem

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;

serverCmd.Insert(serverCmd.GetLength(),13);

UINT len = serverCmd.GetLength();

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

 

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

            return ERROR;

fox404Asked:
Who is Participating?
 
Jaime OlivaresConnect With a Mentor Software ArchitectCommented:
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;
0
 
fox404Author Commented:
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?

Fox404
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.