Click here to Skip to main content
15,904,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: memory leak OT Pin
Richard MacCutchan9-Jun-10 2:32
mveRichard MacCutchan9-Jun-10 2:32 
Questionhandle of parent window containing windowless content Pin
rakesh54548-Jun-10 21:20
rakesh54548-Jun-10 21:20 
Questiontruncating file size using _chsize in C Pin
Nikesh Jagtap8-Jun-10 21:12
Nikesh Jagtap8-Jun-10 21:12 
AnswerRe: truncating file size using _chsize in C Pin
Cedric Moonen8-Jun-10 21:54
Cedric Moonen8-Jun-10 21:54 
QuestionTruncating size of file using _chsize() Pin
Nikesh Jagtap8-Jun-10 20:40
Nikesh Jagtap8-Jun-10 20:40 
AnswerRe: Truncating size of file using _chsize() Pin
Cedric Moonen8-Jun-10 20:41
Cedric Moonen8-Jun-10 20:41 
AnswerRe: Truncating size of file using _chsize() Pin
«_Superman_»8-Jun-10 20:48
professional«_Superman_»8-Jun-10 20:48 
QuestionReadFile function returns 1 but number of bytes read is returning 0 Pin
learningvisualc8-Jun-10 20:35
learningvisualc8-Jun-10 20:35 
Hi all,

I am trying to read a serial port using this code

DCB dcb;
	HANDLE hCom;
	BOOL fSuccess;
	char *pcCommPort = "COM6";
	COMMTIMEOUTS cto;
	
	hCom = CreateFile(pcCommPort,
                    GENERIC_READ | GENERIC_WRITE,
                    0,    // must be opened with exclusive-access
                    NULL, // no security attributes
                    OPEN_EXISTING, // must use OPEN_EXISTING
                    0,    // not overlapped I/O
                    NULL  // hTemplate must be NULL for comm devices
                    );
	
	if (hCom == INVALID_HANDLE_VALUE) 
	{
		// Handle the error.
		AfxMessageBox("CreateFile failed with error %d.\n");
		// return (1);
	}
	
	fSuccess = GetCommState(hCom, &dcb);
	
	dcb.BaudRate = CBR_19200;     // 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(hCom, &dcb);
	if (!fSuccess) 
	{
		// Handle the error.
		AfxMessageBox("SetCommState failed with error %d.\n");
		// return (3);
	}
int n = ReadFile(hCom, buff, 128, &readed, 0);


my problem is ReadFile is returning 1 but in bytes read field its returning 0.

Is there anythingthat i am missing
AnswerRe: ReadFile function returns 1 but number of bytes read is returning 0 Pin
Cedric Moonen8-Jun-10 20:40
Cedric Moonen8-Jun-10 20:40 
QuestionTab control Pin
john56328-Jun-10 19:53
john56328-Jun-10 19:53 
AnswerRe: Tab control Pin
Niklas L8-Jun-10 23:16
Niklas L8-Jun-10 23:16 
QuestionReg Excel Automation in SDI Pin
hellogany8-Jun-10 19:22
hellogany8-Jun-10 19:22 
AnswerRe: Reg Excel Automation in SDI Pin
«_Superman_»8-Jun-10 19:28
professional«_Superman_»8-Jun-10 19:28 
GeneralRe: Reg Excel Automation in SDI Pin
hellogany9-Jun-10 0:23
hellogany9-Jun-10 0:23 
QuestionFailure in SendMessage in Retail Verrsion only, has me baffled. Pin
Bram van Kampen8-Jun-10 14:16
Bram van Kampen8-Jun-10 14:16 
AnswerRe: Failure in SendMessage in Retail Verrsion only, has me baffled. Pin
Stephen Hewitt8-Jun-10 18:18
Stephen Hewitt8-Jun-10 18:18 
GeneralRe: Failure in SendMessage in Retail Verrsion only, has me baffled. Pin
Bram van Kampen8-Jun-10 21:53
Bram van Kampen8-Jun-10 21:53 
AnswerRe: Failure in SendMessage in Retail Verrsion only, has me baffled. Pin
ThatsAlok8-Jun-10 19:06
ThatsAlok8-Jun-10 19:06 
GeneralRe: Failure in SendMessage in Retail Verrsion only, has me baffled. Pin
Stephen Hewitt8-Jun-10 19:50
Stephen Hewitt8-Jun-10 19:50 
GeneralRe: Failure in SendMessage in Retail Verrsion only, has me baffled. Pin
Bram van Kampen8-Jun-10 21:40
Bram van Kampen8-Jun-10 21:40 
AnswerRe: Failure in SendMessage in Retail Verrsion only, has me baffled. Pin
SandipG 8-Jun-10 20:04
SandipG 8-Jun-10 20:04 
GeneralRe: Failure in SendMessage in Retail Verrsion only, has me baffled. Pin
Bram van Kampen8-Jun-10 21:46
Bram van Kampen8-Jun-10 21:46 
GeneralRe: Failure in SendMessage in Retail Verrsion only, has me baffled. Pin
SandipG 8-Jun-10 22:03
SandipG 8-Jun-10 22:03 
GeneralRe: Failure in SendMessage in Retail Verrsion only, has me baffled. Pin
Kelly Herald9-Jun-10 7:03
Kelly Herald9-Jun-10 7:03 
AnswerRe: Failure in SendMessage in Retail Verrsion only, has me baffled.(SOLVED) Pin
Bram van Kampen9-Jun-10 10:38
Bram van Kampen9-Jun-10 10:38 

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.