Click here to Skip to main content
16,010,268 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: migrating MFC 6.0 app to 7.0; gotchas ? Pin
Chris Meech3-Dec-04 6:49
Chris Meech3-Dec-04 6:49 
AnswerRe: migrating MFC 6.0 app to 7.0; gotchas ? Pin
john john mackey3-Dec-04 8:44
john john mackey3-Dec-04 8:44 
AnswerRe: migrating MFC 6.0 app to 7.0; gotchas ? Pin
Kevin McFarlane4-Dec-04 4:18
Kevin McFarlane4-Dec-04 4:18 
GeneralMS VC++ & Flash Pin
Serg314163-Dec-04 4:07
Serg314163-Dec-04 4:07 
Generalmaybe a stupid Question,but need help! Pin
josephvan3-Dec-04 3:22
josephvan3-Dec-04 3:22 
GeneralRe: maybe a stupid Question,but need help! Pin
Mike Danberg3-Dec-04 9:32
Mike Danberg3-Dec-04 9:32 
GeneralRe: maybe a stupid Question,but need help! Pin
Mike O'Neill3-Dec-04 14:06
Mike O'Neill3-Dec-04 14:06 
GeneralReadFile(), what is wrong?!! Pin
tswan3-Dec-04 3:17
tswan3-Dec-04 3:17 
hi, i am a student and im currently dealing with c++ programming base assignment. however, im not strong in c++ programming language. hope to get help and assiatance. here's my question:
i suppose to write a program that open the serial comm port, configure it and receive data from it. however, the program i wrote is not functioning as it suppose to, as in, it never receives any data. what is wrong with the code. hope to get help. besides, was wondering if anyone has any recommended code that works for me to refer. was really hoping to get help.

the code goes like thia:

#include <windows.h>
#include <stdio.h>
#include <iostream.h>




int main(int argc, char *argv[])
{
DCB cofiguration;
HANDLE hCom;
BOOL fSuccess;
char *pcCommPort = "COM1";



hCom = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, //share mode: off
NULL,
OPEN_EXISTING, //to open existing file such as port
0,
NULL
);

if (hCom == INVALID_HANDLE_VALUE)
{

cout<<"create file with error ";
cout<<getlasterror(); to="" check="" if="" the="" port="" is="" available
="" return="" (0);
="" }

=""

="" fsuccess="GetCommState(hCom," &cofiguration);


="" cofiguration.baudrate="CBR_9600;"
="" cofiguration.bytesize="8;" cofiguration.parity="NOPARITY;" cofiguration.stopbits="ONESTOPBIT;"




="" &cofiguration);

="" (!fsuccess)="" {
="" cout<<"error="" occur="" "<<endl;
="" cout<<getlasterror();
="" (3);
="" cout<<"port="" opened="" bool="" rdfile;
="" char="" *bufferofdata="" ;
="" unsigned="" long="" nbytesread;
="" int="" sizebuffer="100;


" commtimeouts="" ctmonew="{0}," ctmoold;
="" getcommtimeouts(hcom,&ctmoold);
="" ctmonew.readtotaltimeoutconstant="100;
" ctmonew.readtotaltimeoutmultiplier="0;
" setcommtimeouts(hcom,="" &ctmonew);


="" rdfile="ReadFile(" hcom,bufferofdata,="" sizebuffer,="" &nbytesread,="" null)="" ;="" (="" nbytesread="">0)
{


cout<<"the received word is: ";

}

else if (nBytesRead == 0)
{
cout<<"no input"<
GeneralRe: ReadFile(), what is wrong?!! Pin
Blake Miller3-Dec-04 4:04
Blake Miller3-Dec-04 4:04 
GeneralRe: ReadFile(), what is wrong?!! Pin
tswan5-Dec-04 2:48
tswan5-Dec-04 2:48 
GeneralOn-Screen Keyboard Pin
Tripura.K3-Dec-04 2:36
Tripura.K3-Dec-04 2:36 
GeneraldwLastChange - Connection Time Pin
adriano_alvarez3-Dec-04 2:34
adriano_alvarez3-Dec-04 2:34 
GeneralRe: dwLastChange - Connection Time Pin
David Crow3-Dec-04 5:40
David Crow3-Dec-04 5:40 
GeneralCFileDialog crashes in Platform SDK Pin
Marius Bancila3-Dec-04 1:59
professionalMarius Bancila3-Dec-04 1:59 
GeneralRe: CFileDialog crashes in Platform SDK Pin
David Crow3-Dec-04 2:16
David Crow3-Dec-04 2:16 
GeneralRe: CFileDialog crashes in Platform SDK Pin
Blake Miller3-Dec-04 4:11
Blake Miller3-Dec-04 4:11 
GeneralRe: CFileDialog crashes in Platform SDK Pin
Marius Bancila3-Dec-04 4:29
professionalMarius Bancila3-Dec-04 4:29 
Generalhelp..... Pin
namaskaaram3-Dec-04 1:35
namaskaaram3-Dec-04 1:35 
Generaldll export problem Pin
Orkun GEDiK3-Dec-04 0:55
Orkun GEDiK3-Dec-04 0:55 
Generalvtable layout in vc++ for derived classes Pin
Member 13822803-Dec-04 0:43
Member 13822803-Dec-04 0:43 
GeneralConverting VARIANT data type Pin
Sahir Shah2-Dec-04 23:39
Sahir Shah2-Dec-04 23:39 
GeneralGetDisplayNameOf problems with Folder settings Pin
Digvijay Chauhan2-Dec-04 23:34
Digvijay Chauhan2-Dec-04 23:34 
GeneralRe: GetDisplayNameOf problems with Folder settings Pin
David Crow3-Dec-04 6:20
David Crow3-Dec-04 6:20 
GeneralMake each cell in a CListCtrl a little bigger Pin
anderslundsgard2-Dec-04 23:32
anderslundsgard2-Dec-04 23:32 
GeneralRe: Make each cell in a CListCtrl a little bigger Pin
Antony M Kancidrowski3-Dec-04 5:30
Antony M Kancidrowski3-Dec-04 5:30 

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.