Invalid Handle Error on all COM ports 
Author Message
 Invalid Handle Error on all COM ports

Hi!

I have a problem with the serial communication under Windows CE. I
have a lot experience under Windows NT and W2K.

(1) When I open a COM Port with CreateFile() I get a VALID handle
back. Aso when I call GetLastError() after CreateFile() I get 0x00
back, so everything is ok. But when I start using some communication
APIs like SetupComm(), GetCommTimeouts() or SetCommState() - just to
name some of them - all of them give me an error back. GetLastError()
tells me always 0x06 (invalid handle). But CreateFile did not fail.
Any idea?

(2) A general question for the Microsoft Windows Platform SDK for
Pocket PC: Does the Desktop Pocket PC Emulation map the Pocket PC COM
ports to the COM ports of the development PC (Windows NT or W2K)?

Thanks for your help!
Bye
Mike



Tue, 28 Dec 2004 15:25:50 GMT  
 Invalid Handle Error on all COM ports
Hi!

I have a problem with the serial communication under Windows CE. I
have a lot experience under Windows NT and W2K.

(1) When I open a COM Port with CreateFile() I get a VALID handle
back. Aso when I call GetLastError() after CreateFile() I get 0x00
back, so everything is ok. But when I start using some communication
APIs like SetupComm(), GetCommTimeouts() or SetCommState() - just to
name some of them - all of them give me an error back. GetLastError()
tells me always 0x06 (invalid handle). But CreateFile did not fail.
Any idea?

(2) A general question for the Microsoft Windows Platform SDK for
Pocket PC: Does the Desktop Pocket PC Emulation map the Pocket PC COM
ports to the COM ports of the development PC (Windows NT or W2K)?

Thanks for your help!
Bye
Mike



Tue, 28 Dec 2004 15:28:32 GMT  
 Invalid Handle Error on all COM ports
Hi!

I have a problem with the serial communication under Windows CE. I
have a lot experience under Windows NT and W2K.

(1) When I open a COM Port with CreateFile() I get a VALID handle
back. Aso when I call GetLastError() after CreateFile() I get 0x00
back, so everything is ok. But when I start using some communication
APIs like SetupComm(), GetCommTimeouts() or SetCommState() - just to
name some of them - all of them give me an error back. GetLastError()
tells me always 0x06 (invalid handle). But CreateFile did not fail.
Any idea?

(2) A general question for the Microsoft Windows Platform SDK for
Pocket PC: Does the Desktop Pocket PC Emulation map the Pocket PC COM
ports to the COM ports of the development PC (Windows NT or W2K)?

Thanks for your help!
Bye
Mike



Tue, 28 Dec 2004 15:32:54 GMT  
 Invalid Handle Error on all COM ports
First, it's sufficient to post your message only once, without writing two
answers of the same text to yourself.

This is a code snippet on how to open COM1:

  hPort = CreateFile (TEXT("COM1:"),
                                  GENERIC_READ | GENERIC_WRITE, // Access
(read-write) mode
                                  0, // Share mode
                                  NULL, // Pointer to the security attribute
                                  OPEN_EXISTING, // How to open the serial
port
                                  0, // Port attributes
                                  NULL); // Handle to port with attribute to
copy



Quote:
> Hi!

> I have a problem with the serial communication under Windows CE. I
> have a lot experience under Windows NT and W2K.

> (1) When I open a COM Port with CreateFile() I get a VALID handle
> back. Aso when I call GetLastError() after CreateFile() I get 0x00
> back, so everything is ok. But when I start using some communication
> APIs like SetupComm(), GetCommTimeouts() or SetCommState() - just to
> name some of them - all of them give me an error back. GetLastError()
> tells me always 0x06 (invalid handle). But CreateFile did not fail.
> Any idea?

> (2) A general question for the Microsoft Windows Platform SDK for
> Pocket PC: Does the Desktop Pocket PC Emulation map the Pocket PC COM
> ports to the COM ports of the development PC (Windows NT or W2K)?

> Thanks for your help!
> Bye
> Mike



Tue, 28 Dec 2004 20:29:41 GMT  
 Invalid Handle Error on all COM ports
My guess is that you forgot the colon at the end of COM1:  No need to post
three times, either.

Paul T.


Quote:
> Hi!

> I have a problem with the serial communication under Windows CE. I
> have a lot experience under Windows NT and W2K.

> (1) When I open a COM Port with CreateFile() I get a VALID handle
> back. Aso when I call GetLastError() after CreateFile() I get 0x00
> back, so everything is ok. But when I start using some communication
> APIs like SetupComm(), GetCommTimeouts() or SetCommState() - just to
> name some of them - all of them give me an error back. GetLastError()
> tells me always 0x06 (invalid handle). But CreateFile did not fail.
> Any idea?

> (2) A general question for the Microsoft Windows Platform SDK for
> Pocket PC: Does the Desktop Pocket PC Emulation map the Pocket PC COM
> ports to the COM ports of the development PC (Windows NT or W2K)?

> Thanks for your help!
> Bye
> Mike



Wed, 29 Dec 2004 01:30:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Invalid Window Handle error from CRecordset

2. Passing a Com port handle from VB to a C DLL back and forth

3. error analysis/handling/detecting/reporting/preventing/recovery/reproduce/debug

4. Serial Port error handling

5. need help porting vb error handling to VC++ code

6. Handling MTS ATL COM Errors

7. Handling Atl Com errors

8. COM Error Handling

9. Handling Com Errors

10. Thread programing with COM Port...Error!!!

11. Thread programing with COM Port...Error!!!

12. Thread programing with COM Port...Error!!!

 

 
Powered by phpBB® Forum Software