serial WriteFile hangs

I need to get an old Win98 program running on WinXP.

The program works on Win98, but hangs in WriteFile to COM port on Windows-XP.

The Visual-C++ program remote controls an embedded board through serial port.

Any ideas?
0
Doug4515 (774)
11/10/2004 5:59:05 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
963 Views

Similar Articles

[PageSpeed] 49

_Doug wrote:

> I need to get an old Win98 program running on WinXP.
> 
> The program works on Win98, but hangs in WriteFile to COM port on Windows-XP.
> 
> The Visual-C++ program remote controls an embedded board through serial port.
> 
> Any ideas?

There is something wrong with the program.  Done properly, the same code 
should work on Win98 and XP.  Check all return values to make sure the 
steps prior to ReadFile succeeded, especially CreateFile.  And make sure 
the program sets the baud rate and other port parameters, and make sure 
the code calls SetCommTimeouts.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
11/10/2004 11:45:48 PM
If you are calling WaitCommEvent(... before calling WriteFile(..., it will 
hang at WaitCommEvent(... If it is so, you remove WaitCommEvent(... . If you 
are synchrounising your communication through WaitCommEvent(... do synch. 
with your own ID instead.

"_Doug" wrote:

> I need to get an old Win98 program running on WinXP.
> 
> The program works on Win98, but hangs in WriteFile to COM port on Windows-XP.
> 
> The Visual-C++ program remote controls an embedded board through serial port.
> 
> Any ideas?
0
CGSReddy (8)
11/11/2004 6:48:02 AM
I checked all that.  Still no luck.

Does non-overlapped (synchronous) serial comm
work under Windows-NT?





"Scott McPhillips [MVP]" wrote:

> _Doug wrote:
> 
> > I need to get an old Win98 program running on WinXP.
> > 
> > The program works on Win98, but hangs in WriteFile to COM port on Windows-XP.
> > 
> > The Visual-C++ program remote controls an embedded board through serial port.
> > 
> > Any ideas?
> 
> There is something wrong with the program.  Done properly, the same code 
> should work on Win98 and XP.  Check all return values to make sure the 
> steps prior to ReadFile succeeded, especially CreateFile.  And make sure 
> the program sets the baud rate and other port parameters, and make sure 
> the code calls SetCommTimeouts.
> 
> -- 
> Scott McPhillips [VC++ MVP]
> 
> 
0
Doug4515 (774)
11/11/2004 4:14:13 PM
_Doug wrote:
> I checked all that.  Still no luck.
> 
> Does non-overlapped (synchronous) serial comm
> work under Windows-NT?
> 

Yes it does.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
11/11/2004 11:30:34 PM
Make sure you don't have a ReadFile pending in another thread. In 
non-overlapped mode, all calls are serialized.

Serial device access is meant to be overlapped, and if you use it in 
synchronous mode, you'll get more troubles than you've saved by not using 
overlapped.

"_Doug" <Doug@discussions.microsoft.com> wrote in message 
news:88A18FFC-8FF0-41D7-98F5-9855E29DF5C1@microsoft.com...
>I checked all that.  Still no luck.
>
> Does non-overlapped (synchronous) serial comm
> work under Windows-NT?
>
>
>
>
>
> "Scott McPhillips [MVP]" wrote:
>
>> _Doug wrote:
>>
>> > I need to get an old Win98 program running on WinXP.
>> >
>> > The program works on Win98, but hangs in WriteFile to COM port on 
>> > Windows-XP.
>> >
>> > The Visual-C++ program remote controls an embedded board through serial 
>> > port.
>> >
>> > Any ideas?
>>
>> There is something wrong with the program.  Done properly, the same code
>> should work on Win98 and XP.  Check all return values to make sure the
>> steps prior to ReadFile succeeded, especially CreateFile.  And make sure
>> the program sets the baud rate and other port parameters, and make sure
>> the code calls SetCommTimeouts.
>>
>> -- 
>> Scott McPhillips [VC++ MVP]
>>
>> 


0
alegr (1130)
11/14/2004 4:05:59 AM
Reply:

Similar Artilces:

Serial Number Problem
Hi Everyone, we run Dynamics on our server anyway we had HUGE problems and lost a lot of work.....anyway after fixing lots up i still have one MAJOR problem. Serial numbers for items in the system do exist if you look up inventory ~ Serials. There is a list of serial numbers in stock ready to use. But when we go to do an invoice there are no serial numbers, it asks you if you want to overide the quantities... Our problem was we lost our inventory file therefore we had to put an old file back on...although these serial numbers are there we can not use them which also means i cant put t...

excel hangs
I have a user having a very wacky problem. She'll be working fine in Excel 2002 with the latest updates , then out of the blue she looses control of selecting cells with the mouse. It appears to randomly highlight multiple cells, deselecting cells. You cant even close down excell at this point. You have to kill the application. This is a dell laptop with an external ps2 mouse and an Alps track pad. I've updated the bios on this Dell 8200 running XP Prof and I've upgraded the Alps trackpad drivers as well. This seems to happen 3,4 times a day. She states that it happens whether o...

Duplicate Element Names in Serialized XML
Hi All, Hoping someone can solve a problem for me. I am modifying the schema for a rather complex web service written in VB.NET. The services uses a large number of serialized classes to output the overall XML. The problem I am having is that I require 2 XML elements of the same name to be serialized from the 1 class. Due to the way the web service is written only 1 of these would be ever be called at a time. However, it seems that I get an exception if the same element name is used twice in one class.. any ideas? For example: 'start class here <XMLElement ("elementName&q...

Out look 2000 on windows xp hangs
My vp's outlook 2000 is hanging on occasion. It hangs when it is starting up and some times it will load and then when she clicks on the remote personal folder it hangs and we have to kill the process. there is something that makes it hang. Any sugestions? she has a P4 with 512 DDR. Windows XP pro. Thank you ...

Serial Motor
How do you control a motor via serial port? What language should I use? Justin Case wrote: > How do you control a motor via serial port? What language should I > use? I don't know, but it certainly isn't possible with SQL Server ... http://lmgtfy.com/?q=How+do+you+control+a+motor+via+serial+port -- HTH, Bob Barrows Bob Barrows (reb01501@NOyahoo.SPAMcom) writes: > I don't know, but it certainly isn't possible with SQL Server ... What? You can't control a motor with an engine? -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se...

serial port communuication
Hi all, I m communicating to a printer device through serial port.It is failing to open the port,but when I disable and enable the com port in device manager,it works fine(i.e)it communicates with the printer and reads the configuration settings of the printer). Regards Hari are u leaving the port opened when ur program terminates ........ what is the frequency of u disabling/enabling port ....... after every run ...... some times works some times not ..... ????? "hari" <haricibi83@gmail.com> wrote in message news:1171455246.402743.203120@k78g2000cwa.googlegrou...

Serialization of jagged Arrays Issue
Hi there, I m trying to return an object (of my own written class) from a web service that contains jagged Arrays as public variables. Asp.Net is showing me the its serialized version on the browser when i invoke the service during test. Code: public class returnType { [System.Xml.Serialization.XmlElementAttribute("chassisdata")] public _chassisdata[] chassisdata; [XmlArray(),XmlArrayItem("wheel", typeof(_wheel[]),IsNullable=false)] public _wheel[][] upsteps; [XmlArray(),XmlArrayItem("wheelsize", typeof(_wheelsize[]),IsNullable=false)] publi...

excel hangs when copy 'n' pasting
Hi, I want to record the process of copying a row in a tabular region in my main worksheet and pasting the format of the row into the next line. However, after doing this, excel hangs/stalls/freezes. The only way to get out of this is to click the close "X" on the application window but then select "Cancel" on the confirmation box, which will return you to the document in a normal state. I don't understand why this is occuring?! FYI - I have a file of size 460Kb and around 30 worksheets. In the "This Workbook" module, I have a change event handler to ...

open files serially
Hi, I seek your help for the following; I have few files in one of the folder. The file names are ending with numeric number. The uniqueness of the file names are they are serially numbered e.g. ABC123.xls, XYZ124.xls, MNO_AB125.xls, LKM126.xls. I would like to open these files serially (...123 then ...124 so on so forth till last files in the folder). Once the file is open i would like to do some processing and save it in another folder. The files once opened and saved in another folder it should get deleted from earlier folder (From where the file was opened). Than...

COleDateTimeSpan
I noticed problem in Visual Studio.NET 7.0.9466, don't know if something wrong with my VC source code. the bug could cause data corruption if you use serialization of COleDatTimeSpan object, the problem is in file olevar.cpp, one line of code is missing (at least on my mashine ============= CArchive& AFXAPI operator<<(CArchive& ar, COleDateTimeSpan dateSpanSrc return ar << dateSpanSrc.m_span CArchive& AFXAPI operator>>(CArchive& ar, COleDateTimeSpan& dateSpanSrc ar >> (long&)dateSpanSrc.m_status return ar >> dateSpanSrc.m_span ...

IMAP connections appear to hang the server.
HELP!!!!!!!! It appears as though I have found a problem with Mac's connecting to Exchange2003 via IMAP4. Any time from 30 minutes to 2 hours after a reboot of the server, the server becomes unresponsive to clients (PC's and Mac's). The server console itself also becomes unresponsive (e.g. it can take up to 2 minutes to open Exchange System Manager). At the same time, CPU usage and memory usage are within normal ranges and I can see nothing out of the ordinary in the performance monitor. Also, the event logs are clear. The Mac's will get synchronization errors in their mail...

Serialize
Hi All, I use Serialize() to open files in my application. However, if the file is ReadOnly I get the error "Failed to open document" from CDocManager::OpenDocumentFile(LPCTSTR lpszFileName). Anyone have any ideas how to get around this? Cheers, Rob ...

Serializing Array with array "name" in the XML
I need help serializing an array without including the array "name". I am writing in C# and using the XmlSerializer to serial classes. I am trying to serialize a class with an array in it like the one below. public class myclass { public imagecontext; public myimage[] images; } public myimage { public string name; public string path; } It will serialize something like this... <myclass> <imagecontext>my context</imagecontext> <images> <myimage> <name>Image1</name> ...

Outlook 2003 hangs on exit #4
This is a repost from another group that did not get a response. Hopefully I'll have better luck here. I have searched high and low for a solution to this problem. I have found plenty of others that share the problem and tried the suggested fixes but nothing has worked to this point. Here is the scenario: Windows XP Pro (all updates applied), Office 2003 Basic, Access and Powerpoint XP, Chapura Pocketmirror Standard for Palm Pilot Synch (latest version for compatibility with OL 2003), Symantec Antivirus Enterprise connected to SBS 2000 running SAV Enterprise with Exchange support. Ou...

What is most efficient way to serialize a "group" of objects?
What would be the most efficient way to serialize a group of the same objects? For example, if I have 10 Organization objects I want to return from a WebMethod in a "container", what type of container would be most efficient (ArrayList, Collection, etc.)? It is a requirement that the container be dynamic in size and be able to add each object dynamically. Also, if an ArrayList or something similar is used, is there a way to have the root element be something other than "ArrayOfAnyType", e.g., "Organizations"? Thanks, Chris ...

serialize CObArray
I've just converted an app from vc6 to vc7 (vis studio .net 2003 version). I have a serialized file type which has worked perfectly for years, now i'm getting errors when reading newly archived CObArray (which not suprisingly contains objects derived from cobject). Anyone else had this problem?? Just a pointer. When you post, try and give as much information as you can, particularly the errors you are getting? Is this any use? http://support.microsoft.com/default.aspx?scid=kb;en-us;322621 Andy Mortimer [MS] Please do not send email directly to this alias. This alias is for news...

Serializing an object whose class implements ICollection
Hi All, I've been searching around for a solution to over-riding the default serialization of an object whose class is derived from System.Collections.CollectionBase (implementing ICollection). From searches, a solution seems to have been offered by a Dino Chiesa. In his proposed solution, Dino suggests that you specify an XmlRootAttribute in the serializer along with a code example that is no longer available at the url posted. Attempting this solution (without benefit of the example) yields only an error InnerException {"XmlRoot and XmlType attributes may not be specifi...

How to serialize multiple DataSets to a single file
I have 10 unique DataSets, and I would like to serialize them to a single file. I assign each of them a sequential name (e.g., DataSet 1, DataSet 2, etc.). The DataSets are comprised entirely of "double" types. I would like to serialize them to the same file, and later retrieve them, perhaps randomly (for example, extract only DataSet 4 from the file). All the information I have read on binary serialization and deserialization assumes that I will serialize each object to its own file. How can I serialize multiple DataSets to single a file, and later deserialize t...

Serial communication Threading (Thread is blocking)
Hi All, in my application, I am Creating one thread i.e worker thread. suppose my main thread is A and child thread(worker thread) is B. i am using this thread for serial communication. this is a blocking thread. now in my main application A when i create this thread B i start a timer. and i am expecting that in the interval specified in the timer the operation should get complete. otherwise i want to kill the thread B. but is it possible to kill the serial thread (B) in the context of thread (A). means in the timer handler. and how can we no is there any data is present on the port or n...

CRM 4.0 forms hanging for some users
We are noticing a problem with our Dynamics CRM 4.0 hanging sporadically from the web client. For some users, the whole system freezes for approximately three minutes at which point an error message is displayed(see below). In the meantime, other users can access the system fine. After the error message the system works fine for that user. This problem occurs for some users more than others, although they are set up with exactly the same roles and permissions. This issue doesn't occur if the user is logged onto the CRM server. ERROR MESSAGE: An error has occured. Try the action a...

Serialization - DeSerialization
Hello All, I'm trying to use XML Serialization to a class that inherits from another class and also has ArrayLists exposed as properties. When I serialize the class after populating the methods I get the following XML: <?xml version="1.0" encoding="utf-16"?> <Bulletin xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <MetaData>MetaData</MetaData> <Notes> <Note> <MetaData>MetaData</MetaData> <CreatedDate>2003-08-01T11:41:16.942...

XML Serialization problem
Hi folks! I have some XML Serialization problem. I searched Internet and found some good info but still can't resolve the problem. I have next situation: I have solution contains 2 projects: Proj1 and Proj2. Each project compiled to dll. In Proj1 contains Class1 And Proj2 contains Class2. Now, Class2 has reference to Class1. I want to XML serialize Class2. In order to do that I added attr: [XmlInclude(typeof(Class1))] before Class2 definition. It's compiled but when it's running it throws exception something like that: "File or assembly name Proj1, or one of its dependenc...

Cedit serialization
Is there a way to serialize CEdit control data? When I use the operator << or >> it fails since it has no overridden operator for serialization. Can someone advise please? Thanks Galia "Galia" <galia@mandi.com> ha scritto nel messaggio news:OcFOW8uHIHA.2480@TK2MSFTNGP05.phx.gbl... > Is there a way to serialize CEdit control data? > When I use the operator << or >> it fails since it has no overridden > operator for serialization. > Can someone advise please? You may want to serialize the string stored into the CEdit instance. So: * y...

Serialize processes
Hi I have an application and on the same PC two instances of this application. This means there are two processes of the same application. It is neceesary that the processes doesn't run simultaneous. Is it possible to serialize the two processes? I mean the processes, not the threads. I use Visual Studio 2003 and C++./MFC. Thanks Hans You can check on the OnInitInstance if the app is already running. If so, abort on the second instance, or you can wait until the first instance is done. Check out: http://www.codeproject.com/cpp/csingleinst.asp "Hans Stoessel" <hst...

Computer hangs during file copying
Can anyone help? My WinXP Home hangs every once in a while. Usually there is some file copying done when it happens. This phenomenon started after I once ran some 5 or 6 7zip processes concurrently, which was too much for my machine. Sometimes the computer hangs during 7zipping. By "hangs" I mean that: the mouse works, but the taskbar buttons are dead. I can select windows only if they are visible when the problem happens. And then, some windows work and some don't. Windows Explorer windows are dead. Bash windows (ntvdm) work as long as I can get to them. Firefox i...