Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How can 2 applications share a serial port in Windows 2000 ?

Posted on 2003-11-26
8
Medium Priority
?
210 Views
Last Modified: 2010-04-13
Hi experts,

I am migrating an old 16 bit windows app. thas does direct serial port handling in order to  take full advantage of a specialized printer. I have already programmed an interface using Win32 apis that takes care of this.

There is also a DOS application, running on a DOS window, that prints thru the system printer, which happens to be the same serial printer. So, it requires the printer driver to be installed.

It is mandatory to have both applications running on the same machine.

The problem is that whenever the driver is installed, the port seems to be unavailable for my interface, which gets an "invalid_operation" return code for all of its requests. As soon as I remove the printer driver from the system, my interface works OK.

So far I have tried to set the serial port as a multiport ans as a regular port, but the problem remains the same.

The question is what more settings can I try to fix the problem, or if there is any other printer driver that doesn´t block the port

Here is some specific information:
old environment: Pentium I w/Windows 95
new environment: Pentium IV w/Windows 2000
serial printer: Epson TM - H5000

Best regards


0
Comment
Question by:juliogonzalez
[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
  • 3
  • 2
8 Comments
 
LVL 43

Expert Comment

by:Steve Knight
ID: 9837386
Only a quick thought from something I did some while back.  The DOS program should be able to talk to a printer on LPT1: without having it installed in Windows so maybe you could change the port in the program to use LPT1: instead of COM1: (hoping it is editable...) and use a MODE LPT1:=COM1: type command to redirect it?

Alternatively could the Windows App not talk to the printer driver rather than direct to the serial port, I assume you are saying that the Windows program is the one that isn't working when the driver is installed, not the DOS one?

I was only passing through this TA looking for a solution to something myself, will keep an eye on this one though as I'm curious!

Steve
0
 

Author Comment

by:juliogonzalez
ID: 9838295
Hi Steve,

I´ll find out if the DOS program can switch to LPT1: and try with the mode command.
As for the Windows app, it´s very hard to make it change its printer approach because it dinamically loads data containing ESC sequences, a legacy from an earlier DOS version.

Thanks

Julio
0
 

Author Comment

by:juliogonzalez
ID: 9957948
Hi Steve,

Unfortunately, this DOS pgm. is a black box and doesn´t let me switch it to LPT1

I´ve found something weird, but helpful to me I didn´t make it clear before, but I was testing my win32 interface not directly from the 16 bit app. but from a test pgm. which ia a win32 console app. The pitfall was that this program was prompting the user in order to let me select COM1 or COM2 by using the C function getch(), which now seems to be the conflictive one. After commenting all getch()s, the test program started printing and the conflict with the driver is over.
I still get the INVALID_OPERATION return code for all api calls other than cretefile, readfile and writefile, and even the readfile ends alvays in timeout, but the printer is printing both ways (direct and driver).

Yet, I´m still interested having successfull readfile calls to get the printer status (paper out, etc), but I can live without this.

The compiler I am using is VC++ .Net.


Regards

Julio

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:juliogonzalez
ID: 10778855
Hi,

To me, this problem got solved when I realized what I explain on my comment
dated 12/17/2003 12:05PM PET above. To be more specific, the conflict generated by the C function getch().

"After commenting all getch()s, the test program started printing and the conflict with the driver is over".  
 
The complete code of the test program can fe found under the following question :

SERIAL PORT WORKS ON WIN/NT AND NOT IN WIN2K
http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20803035.html

Regards

Julio


0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 10778998
As a passer by expert I didn't help at all here but the asker's own comments must be worth a PAQ/REFUND?

Steve
0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 10798108
Closed, 500 points refunded.
Lunchy
Friendly Neighbourhood Community Support Moderator
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Let's take a look into the basics of ransomware—how it spreads, how it can hurt us, and why a disaster recovery plan is important.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

618 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