A managed CommPortException (repost with source code)

L

lsheung

Hi,

My test program is as simple as the following. When I
deploy it as a Pocket PC 2002 application, I got a CommPortException.

Any advice on how to acheive it?


Lok

A managed CommPortException
occurred at Application::Run+0x1a

CreateFile Failed: 55

Application::Run+0x1a
MainForm::Main+0x27



using System;
using System.Data;
using OpenNETCF.IO.Serial;

namespace SmartDeviceApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
private Port port;
private string portName;
private BasicPortSettings portSetting = new BasicPortSettings();

public Class1(string portName)
{
portSetting.BaudRate = BaudRates.CBR_9600;
portSetting.Parity = Parity.none;
portSetting.ByteSize = 8;
portSetting.StopBits = StopBits.one;
this.portName = portName;
port = new Port(portName, portSetting);
//port = new Port(portName, BaudRates.CBR_9600, Parity.none, 8,
StopBits.one);
}

/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
string portName = "COM4:";
Class1 tester;

tester = new Class1(portName);

tester.port.Open();

tester.port.Close();

}
}
}
 
C

Christian Schwarz

CreateFile Failed: 55

Error 0x55 (ERROR_ALREADY_ASSIGNED) means that the device is already in use
(already open).

Greetings
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top