Click here to Skip to main content
16,012,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Having trouble using Chris' Grid Control Pin
Chris Maunder25-Jul-03 15:03
cofounderChris Maunder25-Jul-03 15:03 
GeneralRe: Having trouble using Chris' Grid Control Pin
Terry O'Nolley25-Jul-03 15:19
Terry O'Nolley25-Jul-03 15:19 
GeneralRe: Having trouble using Chris' Grid Control Pin
Chris Maunder25-Jul-03 15:08
cofounderChris Maunder25-Jul-03 15:08 
GeneralMenu prompt Pin
Anonymous25-Jul-03 8:06
Anonymous25-Jul-03 8:06 
GeneralRe: Menu prompt Pin
Maximilien25-Jul-03 8:51
Maximilien25-Jul-03 8:51 
GeneralRe: Menu prompt Pin
Anonymous25-Jul-03 8:56
Anonymous25-Jul-03 8:56 
GeneralRe: Menu prompt Pin
Bob Stanneveld25-Jul-03 10:20
Bob Stanneveld25-Jul-03 10:20 
GeneralProblem with openin CommPort Pin
soobot25-Jul-03 8:02
soobot25-Jul-03 8:02 
Dear Friends
As it is my first time to get a grip to commport, I've lots of problem with it, I used file operation method but it doesn't work properly, and notify by error 6 & 5.
I'd be appreciated if you could take a look at my code as bellow as advise me in this case
Regards

BOOL CMainFrame::InitSerialPort()
{
DCB dcb;
BOOL fSuccess;
char *pcCommPort = "COM1";
m_hComPort = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // comm devices must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);

if(m_hComPort == INVALID_HANDLE_VALUE)
{
// Handle the error.
CString str;
str.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str);
return FALSE;
}
fSuccess = GetCommState(m_hComPort, &dcb);

if (!fSuccess)
{
// Handle the error.
AfxMessageBox("GetCommState failed with error %d.\n", GetLastError());
return FALSE;
}
dcb.BaudRate = CBR_9600; // set the baud rate
dcb.ByteSize = 8; // data size, xmit, and rcv
dcb.Parity = NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit

fSuccess = SetCommState(m_hComPort, &dcb);

if(!fSuccess) //////////// this line hs been repeated ////////
{
// Handle the error.
AfxMessageBox("SetCommState failed with error %d.\n", GetLastError());
return FALSE;
}
return TRUE;
}
//**************************************************************************************************
void CMainFrame::OnCommClose()
{
m_ComPortOpened = FALSE;
m_isRunning = FALSE;
GeneralRe: Problem with openin CommPort Pin
David Crow25-Jul-03 10:56
David Crow25-Jul-03 10:56 
GeneralRe: Problem with openin CommPort Pin
Majid Shahabfar25-Jul-03 18:32
Majid Shahabfar25-Jul-03 18:32 
Generalconverting scanned graph to coordinates Pin
Peter Molnar25-Jul-03 7:47
Peter Molnar25-Jul-03 7:47 
GeneralConvert Font! Pin
Dang Xuan Ky25-Jul-03 7:45
Dang Xuan Ky25-Jul-03 7:45 
GeneralRe: Convert Font! Pin
Anthony_Yio25-Jul-03 17:27
Anthony_Yio25-Jul-03 17:27 
GeneralActiveX container Tester Pin
sdfdsfa25-Jul-03 5:18
sdfdsfa25-Jul-03 5:18 
GeneralHelp with timer 8-J Pin
Snyp25-Jul-03 5:09
Snyp25-Jul-03 5:09 
GeneralRe: Help with timer 8-J Pin
AlexO25-Jul-03 5:13
AlexO25-Jul-03 5:13 
GeneralRe: Help with timer 8-J Pin
Snyp25-Jul-03 5:19
Snyp25-Jul-03 5:19 
GeneralLOL Pin
Snyp25-Jul-03 5:24
Snyp25-Jul-03 5:24 
GeneralRe: Help with timer 8-J Pin
Snyp25-Jul-03 5:25
Snyp25-Jul-03 5:25 
QuestionInstall TCP/IP protocol programmatically? Pin
Dominik Reichl25-Jul-03 5:03
Dominik Reichl25-Jul-03 5:03 
AnswerRe: Install TCP/IP protocol programmatically? Pin
User 665825-Jul-03 6:06
User 665825-Jul-03 6:06 
GeneralRe: Install TCP/IP protocol programmatically? Pin
Dominik Reichl25-Jul-03 6:48
Dominik Reichl25-Jul-03 6:48 
GeneralRe: Install TCP/IP protocol programmatically? Pin
User 665825-Jul-03 6:58
User 665825-Jul-03 6:58 
GeneralRe: Install TCP/IP protocol programmatically? Pin
Dominik Reichl25-Jul-03 7:00
Dominik Reichl25-Jul-03 7:00 
GeneralRe: Install TCP/IP protocol programmatically? Pin
John M. Drescher25-Jul-03 8:36
John M. Drescher25-Jul-03 8:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.