Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems running FPD2.6 App on Win 2003 Server thru WinXP clients

Status
Not open for further replies.

proscoop

Programmer
Feb 6, 2002
16
JM
My sincere appreciation to Tek-Tips and all members/participants on this forum and for all the valuable help, tips, tricks, workarounds and sample code that I have used from the members throughout the years. Continue the wonderful work that you all are doing.

I developed a fairly complicated integrated point-of-sale, inventory, contact manager and accounting application approx. 12 years ago and have been using it in many retail branches over the years while continuing to fine-tune and improve the application. Traditionally, I would set the application to run on Novell servers and use Win95 or Win98 machines using Client for Netware to patch into the servers. I have NOT had any real issues so far with that configuration except for some slow printing (WinXP-resolved by resetting LPT_timeout value in the registry) and a few other easily-resolved quirks.

However, my network experts who use to set up my Novell servers are out of business and another Network Specialist convinced me to set up the program in three new locations (slated to open for business on May 2, 2007) on Windows 2003 Server machines using WinXP clients to patch into the network. I have been having great difficulty in getting the application to work properly with the following issues:

1) The application has a built in error trapping routine for testing when there is a problem with a printer on LPT1 (locally attached receipt/report printer - meaning "printer not ready / printer not attached / printer off-line"). Trapping Error()=125 or Sys(13)#'Ready' Instead of freezing as it now does, the program would automatically pop-up a dialog box prompting the user to retry the print job or abort. That feature NO LONGER works. I cannot seem to get the program under WIN2K3 Server/WinXP Client to recognize a problem when printing. It keeps trying to print until you turn on/fix/reattach the printer to LPT1.

2) As a work-around, I tried setting up a Generic Text Print Driver and eliminate spooling and send the job directly to printer. That saves the application from freezing but the print job on the Epson Thermal Receipt Printers TM-T88iiip does not run smoothly or quickly. It flys open the cash drawer, prints some text, pause, prints some more text, pause again etc. until the job is completed. LPT_timeout in the registry of the client machines are set to 2. Does it need to be changed at the server as well? The application is actually running on the server NOT on the client machines.

3) When Trying to use Windows Terminal Services to access the application remotely for support purposes, a NTVDM "Hard Error" occurs. However, the application runs full screen on the server locally. The problem is just when trying to access it through Windows Terminal Services-Remote Desktop. I have tried many of the suggestions in the "Search Archives and FAQ" but still no luck.

Any ideas or help would be greatly appreciated. I have given up programming many years ago and honestly cannot program in a visual language--so re-writing the code is out of the question. Just try to work the application until the very end (when there is no more workarounds) Thanking you.

Sincerely,

ProScoop (Kris)
 
q.1) exactly, I have the same problem. I tried read status of printer on port 378,... (in ntvdm i can do that), I tried much more and with no success.

q.2) for the fastest printing from xp you can use this proc. After every you send some data to "port", call this proc.

function netPrintFlush
**********************
parameters pnLPTPort && LPT 1 to 3
private lnHandl
if !betw(pnLPTPort,1,3) && BIOS LPT 1-3
return -1
endif
lnHandl = fopen('LPT'+str(pnLPTPort,1),11)
=fclose(lnHandl)
return 0


Tomas
 
Thanks for your reply, Tomas (Ezopaci)

I am still pulling my hair out trying to resolve the issues mentioned above but with very little success. I was hoping that many more members would have replied to this thread as it seems to be very common problems experienced by FoxPro 2.6 DOS application developers using Windows Servers/XP Clients.

I just want to ensure that I understand how to use your "Print Port Flush" function properly as I am still having a delay when printing to LPT1. As mentioned before, I have set the LPT_Timeout value in the registry to 2 and installed a Generic Text Printer Driver and disabled spooling (Print directly to printer). However, somehow Windows XP is still holding the print job for a couple seconds before printing. It is taking approximately 10-15 seconds to open the MMF printer-controlled cash drawer (through the Epson Thermal TM-T88iii printer kick-out port). Obviously, you can just imagine the grief that I am experiencing as the delay is causing customer frustration.

Below is a sample of the code used to print the customer's receipt and open the cash drawer. Please see if I am understanding the use and proper placement of your routine correctly as I am NOT quite sure what exactly it does. I am guessing it checks if the port is open then closes it. Am I correct?

PROCEDURE l_prntbill
PARAMETERS OPENDRAW
SET CONSOLE OFF
SET DEVICE TO PRINT
SET PRINT TO LPT1
SET PRINT ON

**--- Printer error trapping routine in addition to ON ERROR general
**--- procedure that tests for ERROR()=125

IF SYS(13) = 'OFFLINE'
WAIT WINDOW "Printer not ready... fix problem & press a key to retry"
IF SYS(13) = 'READY'
EXIT
ENDIF
ENDIF

WAIT WINDOW "Printing Invoice..." NOWAIT

**--Parameter check to decide if cash drawer should be opened
IF OPENDRAW
@ 0, 0 SAY CHR(27) + CHR(112) + CHR(0) + CHR(100) + CHR(40)
ENDIF

@ 1, 3 say SYS.INVHEAD1
.... etc
.... etc
@ 7, 1 SAY REPL("=",41)
@ 8, 0 SAY "Inv. #:"
@ 8, 9 SAY STR(MINVOICE,6,0)
@ 8, 17 SAY l_user
@ 8, 22 SAY LONGDATE(l_slsdte)
@ 8, 36 SAY LEFT(TIME(),5)

SET PRINT TO && This tip/trick is from Tek-Tips
SET PRINT TO && to speed up printing under WinXP
SET PRINT OFF
SET PRINT TO LPT1
SET DEVICE TO SCREEN
SET CONSOLE ON

=netPrintFlush(1) && Is this the correct placement
&& usage technique????? LPT 1

.... more code
.... more code

function netPrintFlush
**********************
parameters pnLPTPort && LPT 1 to 3
private lnHandl
if !betw(pnLPTPort,1,3) && BIOS LPT 1-3
return -1
endif
lnHandl = fopen('LPT'+str(pnLPTPort,1),11)
=fclose(lnHandl)
return 0


Thanks for your help,

ProScoop (Kris)
 
Yes, you are right.
I think your code
SET PRINT TO && This tip/trick is from Tek-Tips
SET PRINT TO && to speed up printing under WinXP
does the same thing like my, but my proc. functione even on LPT2 and LPT3 !

Fox internaly "close and open" LPT1 if you do SET PRINT TO, but for LPT2 and above it is not function.

It signaled to win xp that print job is done.

Strange. I have experinces with it on many machines (on cash systems like you) and after you call NetPrintFlush delay is very very short (100ms).

Tomas
 
Thanks again for your speedy reply, Tomas (Ezopaci)

I very much appreciate your help and thank you sincerely for taking the time to assist me as I am definitely going crazy trying to solve these issues working with my FPD2.6 application on the Windows Server 2003 using WinXP as clients. I honestly have NOT tried putting your code into my application as yet as I have followed some previous threads in the "Search" field and found your website which has a different code for the same function (even end with a CALL command). I just wanted to make sure that I could use the code that you sent me. Other suggestions here on this site, suggests that I should change the BIOS setting to Normal instead of ECP or EPP for the Parallel Port LPT1, however, I am using Dell GX260's which when I go into the BIOS setting, does not offer the option of "NORMAL" for the port...ONLY EPP or ECP. I have installed a GENERIC TEXT print driver in Windows XP to avoid the program crashing when a print job is sent (since ERROR()=125 & SYS(13) no longer works). I have set it to print directly to printer without spooling and changed the registry setting to LPT_Timeout=2. Do you think that your function will work much faster with the above conditions than "SET PRINT TO...SET PRINT TO (twice)"? Do I have your function called placed correctly in my code?

Your answer will be most welcomed and appreciated.

Sincerely,

ProScoop (Kris)
 
I have not used "generic text printer" so I can not say you anything about it. I use various cash printers on LPTx and it does not matter which type of printer you have installed in windows.
I never tried switch off spooling. Simply - if I call NetPrintFlush after every sended data, I get very fast printing even I don't have LPT_TIMEOUT in registry.
LPT_TIMEOUT is "crutch" for application which doesn't close LPT after printing. netPrintFlush does this.

But ! I still have problem with testing printers state. I can not recognize if is printer Online or Offline.
I think your test in code (IF SYS(13) = 'OFFLINE') must be overjumped on NT/2000/XP systems.
I get freezing application too if I print into offline printer. I think there is some error in NTVDM.


Tomas
 
And yes, you have placed calling the function correctly.

Version on my page is older version, which uses BIOS function "RESET PRINTER" for closing the job.
NTVDM recognize this like "close printer job".
Older version (with bios) was constructed only for
printers which is spooled over the network.
OPEN and CLOSE device driver LPT is clearer version and does the same - send signal into NTVDM the print job can be closed.


Tomas
 
My most sincere gratitude and appreciation, Tomas (Ezopaci). I enjoy learning and trying new work-a-rounds and am marveled at your kindness in sharing your knowledge and information on the subject matter.

I will most certainly try your code next week when I re-visit the site where the new installation/configuration was installed and I will let you know what happens. I also stumbled across a thread pointing to your free program to reduce the CPU usage of FPD2.6 (FoxFree). Should I be using this as well and if so can you give me the instructions for the proper use of this program. Also reading about the MEMLIMIT settings (what is the correct setting when using FPD2.6 on WinXP clients attached to Windows 2003 Server -- my current setting is: MEMLIMIT=60,2048,16384)?. Some members suggest NOT setting a number for the third parameter (Max Memory Usage). Others suggest ONLY using the first by setting the Memory Percentage required from WindowsXP. In addition, I see where you recommend changing the memory assignment for EMS in _Default.PIF (Is this change still necessary as I use a shortcut on my desktop to start my application e.g. somename.PIF--should the EMS memory change be done in this PIF instead and if so, what should the EMS setting be changed to?)

Thanking you,

ProScoop (Kris)
 
ATTENTION: TAMAR GRANOR (Programmer)

My sincere apologies to you Tamar Granor (Programmer) as I rudely neglected to thank you for your suggestion. Please excuse my tardy response and rest assured that every bit of information and help I receive is precious and valuable to me. I recognize that you did NOT have to respond in the first place and I appreciate your kindness in offering your help.

I followed your link to the e-book, but since I am looking for an immediate solution, I was leaning more towards tried and proven tips/tricks from members here who have experienced similar problems. I am getting somewhere with the printing problem using Tomas (Ezopaci)suggestions and function but the other problems remain unsolved at this time, especially the NTVDM "Hard Error" and the fact that ERROR()=125 & SYS(13)no longer works.

Sincerely,

ProScoop (Kris)
 
Hi,

ad. foxfree
Foxfree is freeware, you can use it anywhere.
Foxfree.com is dos memory resident, so it is loadable in batch file which startes your app. Simply launch it somewhere before line with FOXR ..... without any parameters.
There is PLB version of foxfree on my ftp on
You can start it by SET LIBRARY TO FOXFREE.PLB ADDITIVE
in your program. No addition command is not required.
When library is loaded, it automatically start.

ad. MEMLIMIT
I think the first number in the command sets DOS (main page) memory, so in extended version of foxpro it does not matter. Second number is minimum and third is maximum allocated XMS memory.
I have in config.fp memlimit=100,1024,7000 and fox
allocate about 8-9MB of ram. You can see it in task manager. If your program uses much/long string variable or huge array, you can icnrease it.

ad EMS
I think if you use (I do) only extended version of foxpro, it does not matter, bucause fox uses preferably XMS memory intead.
You can set EMS (expanded memory) to 0.


Tomas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top