LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

PrintTextFile hangs sometimes

When using PrintTextFile to print a file this function-call sometimes doesn't return. I put some tracing messages around it to figure out this was the function. The text file is closed before this call is performed and contains the correct data. The printer we use is a network printer and works ok with other applications like word. When the function is working correctly you see a printer at the right side of the taskbar. When the function hangs there is no printer visable and there is also no job present in the printer job list. The computer is running at winXP. After restarting the application it all works well again for some time (5 or 10 print actions) and after that the function hangs again.

My Questions:

There is also a function Pri
ntTextBuffer. I didn't try this one but would it be smart to try it?

How can I tackle this problem? Where can I look, because when I call the function PrintTextFile it stops for me. Is there an alternitive to use or can I call some functions to determine the status before starting to print?

Is it an OS, CVI or printer driver problem?

Thanx in advance,

Maarten
0 Kudos
Message 1 of 4
(2,975 Views)
Usually, problems like this are due to GDI printing problems in the printer driver. It would definately be worth trying to read in the text file and print it with PrintTextBuffer instead. Also, see if there is a updated printer driver for XP on the web for your printer.


Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(2,975 Views)
Hi Chris,

I have come across the similar problem while using the PrintTextFile command.

I have tried out by using the dos command to print out the text file, ie:

system("net use lpt1: \\\\servername\\printername");
system("print filename");

Yet, the problem is still not resolved.Not all the time the printing is successful. But at least the program wont hang.
0 Kudos
Message 3 of 4
(2,975 Views)
This issue seems to me to be similar, and potentially related, to a WinXP / DDE issue I posted June 2 ("Request to Word 97 and WinXP users").

While Word may be the problem for my issue, we do see some strange file locking issues under Win XP only.

In that other posting a DDE InsertFile command is not allowed access to the CVI file it created, wrote, and closed. ("Access denied")

In this thread, it seems that the reported issues are all programs hanging while trying to access text files that they created.

I'd encourage people to try out the posted simple .c file from the other thread, esp. on Win XP platforms with Word 97.

Hope this helps us all.
0 Kudos
Message 4 of 4
(2,975 Views)