Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 978584 - Last Review: May 3, 2010 - Revision: 3.0
Turning off a Bluetooth printer from a program that uses the .NET compact framework in Windows Embedded CE or Windows Mobile causes a significant slow down when switching between other applications and when moving between windows.
If a Windows Embedded CE device or Microsoft Windows Mobile device is connected to a Bluetooth printer through a virtual COM port in a managed application that uses the Microsoft .NET compact framework, the .NET component monopolizes the CPU resources when the printer is turned off so that switching between other applications and moving between windows becomes significantly slower.
Additional notes: The time it takes to respond to the subsequent process depends on the type of device, but it sometimes takes from 5 to 10 seconds after the operation such as pushing a button (or switching).
When opening a virtual COM port from a .NET compact framework based application, a thread is created in the System.IO.Ports.SerialPort class to monitor events in the Bluetooth virtual COM port. If the Bluetooth printer power is turned off after the virtual COM port is opened, the EV_RLSD event is returned to the event monitoring thread because the Bluetooth connection was broken. For events other than EV_ERR, the event monitoring thread will acquire COM port events again in order to monitor them. The problem occurs because this process is repeated unless the application explicitly uses the Close or Dispose methods to force the COM port to close.
In order to avoid this problem, the COM port must be explicitly closed by the application connected to the Bluetooth printer in order to end the event monitoring thread.
- Register the serial even handler (SerialPinChangedEventHandler) when opening the COM port.
Coding example:
g_sPort = new SerialPort(@"COM" + ComPort);
g_sPort.PinChanged += new SerialPinChangedEventHandler(SerialPort_PinChanged)
- The SerialPinChange.CDChanged event is returned when the Bluetooth printer is turned off in the serial event handler, so that the application closes the virtual COM port.
Coding example:
public void SerialPort_PinChanged(object sender, SerialPinChangedEventArgs e)
{
SerialPort port = (SerialPort)sender;
if (e.EventType == SerialPinChange.CDChanged)
{
close();
}
}
Microsoft is researching this problem and will post more information in this article when the information becomes available.
APPLIES TO
- Windows Mobile 6 Standard
- Windows Mobile 6 Professional
- Windows Mobile 6 Classic
- Windows Embedded CE 6.0
- Microsoft Windows CE 5.0
- Microsoft .NET Framework 2.0
- Microsoft .NET Framework 3.5
- Windows Mobile 6.5 Standard
| kbexpertiseadvanced kbbug kbtshoot kbharmony KB978584 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate