Click here to Skip to main content
15,896,201 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: GetLastInputInfo error Pin
_AnsHUMAN_ 8-Aug-10 22:12
_AnsHUMAN_ 8-Aug-10 22:12 
GeneralRe: GetLastInputInfo error Pin
Pryabu8-Aug-10 22:17
Pryabu8-Aug-10 22:17 
AnswerRe: GetLastInputInfo error Pin
Niklas L8-Aug-10 23:07
Niklas L8-Aug-10 23:07 
AnswerRe: GetLastInputInfo error Pin
KingsGambit8-Aug-10 23:10
KingsGambit8-Aug-10 23:10 
QuestionCloseHandle() freezes the program... Pin
learningvisualc8-Aug-10 19:27
learningvisualc8-Aug-10 19:27 
AnswerRe: CloseHandle() freezes the program... Pin
«_Superman_»8-Aug-10 19:33
professional«_Superman_»8-Aug-10 19:33 
AnswerRe: CloseHandle() freezes the program... Pin
Iain Clarke, Warrior Programmer8-Aug-10 21:20
Iain Clarke, Warrior Programmer8-Aug-10 21:20 
GeneralRe: CloseHandle() freezes the program... Pin
SRIVATHSAN VIJAYA22-Apr-15 0:33
SRIVATHSAN VIJAYA22-Apr-15 0:33 
Hi,

Even I face the same problem when i try to close the handle.
I haven't used any thread to create or close the handle.

I have literally used CreateFileW() to create a handle for serial port communication.

hComm = CreateFileW (pcCommPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);


Where pcCommPort is "COM_2"
CreateFileW call succeeds even if device is not connected.

I have send few commands through WriteFile() and read ReadFile() api's and tried to close the handle using
CloseHandle(hComm)


But my application hangs infinitely.

What would be the exact root cause for this issue?


Sample:

C#
While(1)
{
  i = 0;
  hComm = CreateFileW (pcCommPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
  while(i < 10)
  {
    i++;
    WriteFile(hComm , &txBuffer[0], numBytesToTx, (DWORD*)&numBytesTx, NULL);
    ReadFile(hComm , &get_data[i], 1, (DWORD*)&numBytesRx, NULL);
  }
  CloseHandle(hComm);
  hComm = NULL;
}

QuestionHow to do fast Zip in c++? Pin
002comp8-Aug-10 18:20
002comp8-Aug-10 18:20 
AnswerRe: How to do fast Zip in c++? Pin
N a v a n e e t h8-Aug-10 18:46
N a v a n e e t h8-Aug-10 18:46 
GeneralRe: How to do fast Zip in c++? Pin
elchupathingy8-Aug-10 19:18
elchupathingy8-Aug-10 19:18 
GeneralRe: How to do fast Zip in c++? Pin
002comp8-Aug-10 21:11
002comp8-Aug-10 21:11 
GeneralRe: How to do fast Zip in c++? Pin
002comp9-Aug-10 0:16
002comp9-Aug-10 0:16 
GeneralRe: How to do fast Zip in c++? Pin
Moak10-Aug-10 13:13
Moak10-Aug-10 13:13 
QuestionHow to check the NULL iterator? Pin
DevelopmentNoob8-Aug-10 17:26
DevelopmentNoob8-Aug-10 17:26 
AnswerRe: How to check the NULL iterator? [modified] PinPopular
Niklas L8-Aug-10 19:44
Niklas L8-Aug-10 19:44 
AnswerRe: How to check the NULL iterator? Pin
Moak8-Aug-10 21:39
Moak8-Aug-10 21:39 
AnswerRe: How to check the NULL iterator? Pin
Aescleal8-Aug-10 22:22
Aescleal8-Aug-10 22:22 
QuestionwaveOutOpen returning no message?? Pin
AmbiguousName8-Aug-10 2:45
AmbiguousName8-Aug-10 2:45 
AnswerRe: waveOutOpen returning no message?? Pin
Richard MacCutchan8-Aug-10 2:54
mveRichard MacCutchan8-Aug-10 2:54 
GeneralRe: waveOutOpen returning no message?? Pin
AmbiguousName8-Aug-10 4:30
AmbiguousName8-Aug-10 4:30 
GeneralRe: waveOutOpen returning no message?? Pin
Luc Pattyn8-Aug-10 4:58
sitebuilderLuc Pattyn8-Aug-10 4:58 
GeneralRe: waveOutOpen returning no message?? Pin
Richard MacCutchan8-Aug-10 5:31
mveRichard MacCutchan8-Aug-10 5:31 
QuestionAvoiding Resource Conflicts in MFC Extension DLLs Pin
softwaremonkey7-Aug-10 21:07
softwaremonkey7-Aug-10 21:07 
AnswerRe: Avoiding Resource Conflicts in MFC Extension DLLs Pin
Niklas L7-Aug-10 22:27
Niklas L7-Aug-10 22:27 

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.