[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Reopening: Serial Port Programming

Posted on 2000-03-30
2
Medium Priority
?
390 Views
Last Modified: 2013-12-27
For one of my application I need to access the serial port of the PPC(I have a Compaq Aero 2180 having win CE 2.11) .I tried opening the port using the CreateFile statement, but it gave me an error saying
INVALID_HANDLE_VALUE. I tried running the program on the device as well as in emulation . It failed on both. In emulation I did kill  the NT serial drivers and started the CE ones(i.e NET STOP SERIAL and then NET START WCEEMULD), but that didnt help either. I used GetLastError() and the value it returned was 2(i.e The system cannot find the file specified).the code goes something like this.
                  .....
                  .....
                  LPCTSTR comport;
                  HANDLE h;
                  comport =TEXT("COM1:");
                  // open port for I/O
                  h = CreateFile(comport,
                                       GENERIC_READ|GENERIC_WRITE,
                                       0,NULL,
                                       OPEN_EXISTING,0,NULL);
Also tried writng it as
 h = CreateFile(TEXT("COM1:"),
                                       GENERIC_READ|GENERIC_WRITE,
                                       0,NULL,
                                       OPEN_EXISTING,0,NULL);
 After this, the h is simply "INVALID_HANDLE_VALUE", which means it failed to open the port. Can anyone suggest where I am doing it  wrong. Do I need to make any changes in the registry settings? Any help will be greatly appreciated .
Thanks
0
Comment
Question by:nthota
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
alesp earned 400 total points
ID: 2729490
Hello,

I am using serial port on Palm-sizePC Casio E-105 and I use next code for opening COM port:

....
CString comport = "COM1:";
HANDLE h;

h = CreateFile((LPCTSTR)comport,
                GENERIC_READ | GENERIC_WRITE,
                0, NULL,
                OPEN_EXISTING,
                0, NULL);

....
 I hope this will help you solve you problem.

Best regards
0
 

Author Comment

by:nthota
ID: 2731144
Thanks for the suggestion.I guess there was some problem with my device then. I used the same code that I posted  and it worked well

regrads
Neelima
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…
I recently asked a question (http://www.experts-exchange.com/Programming/Smartphones/Android/Q_28684946.html) about Computer Inventory applications for Mobile Devices.  I was specifically interested in an app I could use on my android phone.  The be…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question