Link to home
Start Free TrialLog in
Avatar of ammounpierre
ammounpierre

asked on

COM1 under Foxpro Dos & Windows XP ?

Hello guys,

I have a application in foxpro 2.5 dos running in Windows XP environment.
they got a cash drawer that opens when issuing a command to the com port.
under dos (command prompt) I created a text file called drawer.txt that contains 00000000 (8 zeros)
and created a batch file that copies that file to the com port
kick.bat
********
copy drawer.txt com1
**********************************
when in dos prompt I issue the command kick , the drawer opens.

So I opened my application and where I wanted to open the drawer, I wrote
!kick.bat
and closed the application thinking it will work ...
well it didnt !
it gives me "Error writing to port...."
please help me....

PS. there is a printer connected to the LPT port and it is functionning okay...
and the drawer is on COM1
Avatar of qz8dsw
qz8dsw
Flag of New Zealand image

Heres the problem the way I see it.
You are running under windows 16 bit VM for your program.
Windows inherently especially with Windows 2000, XP etc... HATES things especially older programs having direct access to hardware. It should be talking to windows.
As per rgbeans tip here
http://www.tek-tips.com/viewthread.cfm?qid=300782
"The concept violates one of the basic principles of these OS's - no direct access to the hardware by an application - everything must go through the OS."

NOW you running it from a "dos prompt" is actually runing it from inside a windows component. Yes the dos prompt is a windows component and can talk to windows properly without talking through the VM.

Ways to go?
Without seeing the source for the program itself thats hard.
Have you tried running the application in compatability mode?
(Create a shortcut that starts the App, right click on the shortcut, select properties, Under the compatability tab, check "Run this program in compatability mode for", and I'd select Windows 95 or 98, then click apply). Try them all and see if they have any effect.

Try changing your batch file
From copy drawer.txt com1
to cmd /c copy drawer.txt com1

Those would be my first 2 tests.

Terry
FoxPro DOS 2.5 is 32-bit.
Not necessarily.
Here is a fix for Foxpro from Microsoft as an example.
http://support.microsoft.com/kb/114465

"In the 16-bit version of FoxPro version 2.5a or 2.5b for MS-DOS"
I know of no one using anything but 32-bit of FoxPro for DOS under WinXP.

If it were FoxPro for Windows, that is truly ugly 16-bit.
The old 16-bit version used expanded memory.  The 32-bit version uses extended memory.  The difference in the file that was run for development (to create a standalone exe) is one had an "L" suffix while the extended had the "X" suffix.  FoxProX.exe would use the extended memory that a PC has and is/was 32-bit.
Pierre,
Any feedback on the suggestions?
I'm wondering whether or not you can treat that device like a printer on COM1: and then use the ??? command to send that string as output to that pseudo-printer device as far as FoxPro is concerned.
Or, since you have
copy drawer.txt com1
what happens when you add a colon after the com1?
copy drawer.txt com1:
Avatar of ammounpierre
ammounpierre

ASKER

WRITE FAULT ERROR WRITING DEVICE COM1:
ABORT RETRY FAIL....

??? IS ALSO NOT WORKING...
was wondering , If I create an executable in VFP that would open a form in which I have MSCOM port to COM1 and after few seconds writes to that ports then releases the form...
but that's too much hassle for a "silly" thing... as to open a drawer... could it be that complicated in WinXP ???
?? anyone ?
even the com component I did in vfp did not work under dos.
it did not kick the drawer...
error writing..
ASKER CERTIFIED SOLUTION
Avatar of qz8dsw
qz8dsw
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the accept Pierre.
Can you tell us what settings you changed since I could not see the results of the MODE COM1: /status command?

Thanks,
Terry