Article View: borland.public.cppbuilder.nativeapi
Article #14790Serial port communication
From: ScOe
Date: Sun, 03 Aug 2003 10:28
Date: Sun, 03 Aug 2003 10:28
34 lines
1865 bytes
1865 bytes
I've saw specifications for my mobile phone, and there is bunch of AT
commands that response to.
I'm trying to send them to mobile phone like this:
String gszPort;
gszPort = "COM2";
HANDLE hComm;
hComm = CreateFile( gszPort.c_str (),
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
0);
if (hComm == INVALID_HANDLE_VALUE) {
ShowMessage ("Gre�ka: INVALID_HANDLE_VALUE");
return;
}
DWORD dwToWrite;
if (WriteABuffer ("AT^SMSO", 10, hComm) == FALSE)
ShowMessage ("Gre�ka prilikom slanja");
CloseHandle (hComm);
BOOL TForm1::WriteABuffer(char * lpBuf, DWORD dwToWrite, HANDLE hComm)
{
...
if (!WriteFile(hComm, lpBuf, dwToWrite, &dwWritten, &osWrite)) {
if (GetLastError() != ERROR_IO_PENDING) {
fRes = FALSE;
}
}
what am i doing wrong ?
Technical Details
Message-ID:
<3f2ce3e3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10cc67,96d3ffb2702fb4bb,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-03 03:40:03 PST From: "ScOe" <sven.savic@zg.hinet.hr> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Serial port communication Date: Sun, 3 Aug 2003 12:28:44 +0200 Lines: 36 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 NNTP-Posting-Host: 213.191.130.43 Message-ID: <3f2ce3e3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1059906531 213.191.130.43 (3 Aug 2003 03:28:51 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail