Click here to Skip to main content
15,914,071 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalloading icon to mainframe Pin
3-Feb-02 5:58
suss3-Feb-02 5:58 
GeneralRe: loading icon to mainframe Pin
Mazdak3-Feb-02 7:01
Mazdak3-Feb-02 7:01 
GeneralRe: loading icon to mainframe Pin
3-Feb-02 13:41
suss3-Feb-02 13:41 
GeneralRe: loading icon to mainframe Pin
Jay Beckert3-Feb-02 14:57
Jay Beckert3-Feb-02 14:57 
GeneralRe: loading icon to mainframe Pin
Jay Beckert3-Feb-02 15:09
Jay Beckert3-Feb-02 15:09 
GeneralRe: loading icon to mainframe Pin
Fredrik Skog4-Feb-02 0:17
Fredrik Skog4-Feb-02 0:17 
GeneralRe: loading icon to mainframe Pin
5-Feb-02 2:08
suss5-Feb-02 2:08 
Generalan event from comm-port Pin
Sergei3-Feb-02 3:32
Sergei3-Feb-02 3:32 
Please, help me! I have external device, which connects with comm-port.
I send to device the number, after it signaled it send to computer some signal;
how can i receive this signal? in case, if device is nonsignaled, how can i wait
it for five sec, and break the waiting operation?
What do i need to write to this code, in the end of it?
I know all abot WaitCommEvent and WaitForSingleObject, but i don't know
how to use it. WaitForSingleObject doesn't work with EVENT, or i don't know
how to use itFrown | :(

HANDLE port;
DWORD bc;
DCB dcb;
char buffer[100];
char *buf_out="50";
DWORD dwBlockSize=512;
void *szBuffer;
int send=255;

ZeroMemory(&dcb,sizeof(DCB));
strcpy(buffer,"baud=1200 parity=N data=8 stop=1");
BuildCommDCB((char*)&buffer,&dcb);
dcb.fRtsControl = RTS_CONTROL_ENABLE;

port=CreateFile("COM1",
GENERIC_READ|GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);

GetCommState(port,&dcb);

SetCommState(port,&dcb);
HeapFree(GetProcessHeap(),0,&dcb);

szBuffer = malloc(dwBlockSize);
memset(szBuffer, send, dwBlockSize);
// Sending number for device
WriteFile(port,szBuffer,sizeof(szBuffer),&bc,NULL);

free(szBuffer);


// Wait for signal for five sec


CloseHandle(port);
GeneralRe: an event from comm-port Pin
.:: RockNix ::.3-Feb-02 21:37
.:: RockNix ::.3-Feb-02 21:37 
GeneralPrinter Pin
Stan the man3-Feb-02 2:04
Stan the man3-Feb-02 2:04 
GeneralRe: Printer Pin
56789012343-Feb-02 21:00
56789012343-Feb-02 21:00 
GeneralMediaplayer Pin
RichardWdy3-Feb-02 1:36
RichardWdy3-Feb-02 1:36 
GeneralRe: Mediaplayer Pin
Mazdak3-Feb-02 3:45
Mazdak3-Feb-02 3:45 
GeneralRe: Mediaplayer Pin
RichardWdy3-Feb-02 17:02
RichardWdy3-Feb-02 17:02 
GeneralCrystal Report and changing database path ... Pin
Hadi Rezaee3-Feb-02 1:14
Hadi Rezaee3-Feb-02 1:14 
GeneralAccessing a MDI child window. Pin
kelthar2-Feb-02 23:31
kelthar2-Feb-02 23:31 
GeneralRe: Accessing a MDI child window. Pin
Mazdak3-Feb-02 0:54
Mazdak3-Feb-02 0:54 
GeneralFence post counterpart Pin
alex.barylski2-Feb-02 21:42
alex.barylski2-Feb-02 21:42 
Questionsorting arrays?? Pin
2-Feb-02 19:08
suss2-Feb-02 19:08 
AnswerRe: sorting arrays?? Pin
Paul M Watt2-Feb-02 19:58
mentorPaul M Watt2-Feb-02 19:58 
AnswerRe: sorting arrays?? Pin
alex.barylski2-Feb-02 19:59
alex.barylski2-Feb-02 19:59 
AnswerRe: sorting arrays?? Pin
Christian Graus3-Feb-02 2:14
protectorChristian Graus3-Feb-02 2:14 
Questioninsert elements in order??? Pin
2-Feb-02 17:12
suss2-Feb-02 17:12 
AnswerRe: insert elements in order??? Pin
Paul M Watt2-Feb-02 17:41
mentorPaul M Watt2-Feb-02 17:41 
GeneralRe: insert elements in order??? Pin
2-Feb-02 17:52
suss2-Feb-02 17:52 

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.