Printing direct to printer port

sidNic
sidNic used Ask the Experts™
on
i'm having problems printing direct to a printer from visual basic on
windows 98 machines.

These are network shares that i print direct to - it works fine from
windows nt, but on windows 98 i get file not found.

- The printer ports are captured on nt by the command
"net use lpt4 \\mail\eltron"

on windows 98 this is done through network neighbourhood (as advised on
microsoft.com) (i tried the other way aswell)

the code below works fine on nt, but on 98 it just returns "File not
Found" as an error.

Open "LPT4:" For Output As #1
print #1, "test"
close #1

i've tried printing to nt hosts and windows98 hosts - both work printing
form nt, but neither works from 98.

Is it not possible to print this way on 98?

Cheers
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
I don't know if there are issues with Win98, but I don't think this is a VB problem.  To find out, open a DOS session and try this simple test:

>copy c:\autoexec.bat lpt4:

If it fails, the problem is in the DOS settings.  If it succeeds, then the settings are probably getting lost when called from VB, presumably meaning that Windows is not getting the information.  You can also try checking the port information through the control panel to ensure that LPT4 is set correctly.

Author

Commented:
Thanks for your reply.

i've tried a few other things now.

i modifed the application to write a text file and then copy that over to lpt4: using shell... this still has the error message.

I've tried to copy the files from the command prompt - this works fine.

with this in mind, i tried to create a bat file - i used exactly the same syntax as i used in the command prompt
>copy label.tmp lpt4:

this returned the error 'path not found lpt4'

any ideas? the mind boggles

Commented:
The batch file idea should work.  However, if it works from the command prompt, is this your shell command:

Shell("command /c copy label.tmp lpt4:") ' for Win98

or you can use:

Shell(Environ("comspec") & " /c copy label.tmp lpt4:") ' for any Windows environment

If this still doesn't work, I suggest asking the question in the Windows area since they may have more info about this.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
that still didn't work.

I eventually found something on mskb http://support.microsoft.com/default.aspx?scid=kb;EN-US;243075

and copying the file direct to the printer -i.e. \\mail\panasonic rather than the port works fine.

I don't understand why things work when you type them in a command prompt, but anything else doesn't work. But hey - i got it working so i don't care!!!!!!

Cheers

Commented:
>i got it working

That's good to hear.
Why not ask CS for a points refund and PAQ on this Q.
Author of the Year 2009

Commented:
sidNic, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial