Copy() to LPT1 in Windows11 not working?

In the label printing world, we have a little piece of code that writes a text file to a label printer:

copy(lFullFilenameWithPath,‘LPT1’)
if errorcode() then .. etc…

It’s been working for many years - no problem.
Now - on Windows11 - nothing happens. And we get no errorcode() (i.e. 0).

However - a manual upload from CMD to the printer (see below) does work:

  • copy /B GODEX_FILE1.TXT LPT1
  • copy /B GODEX_FILE2.TXT LPT1
  • copy /B LABEL.BMP LPT1

Any idea why it does not work from our Clarion code? (The exact same code still works on Windows10 and earlier).

.

Hi Fred

Not sure why the COPY in clarion does not work, but just in case you don’t find a solution.

An alternative is to use CS OddJob to create and run the CMD version
window is hidden and you get feedback/result

I have a standalone printserver that handles all the barcode/label/dot matrix printing and I switched to this quite a few years back, been working extremely well

Johan

1 Like

There has been some changes to the CopyFile win32 api’s.

I also wonder if the LPT port is visible.

  1. Right-click the My Computer icon on your desktop, and then click Properties.
  2. Click the Hardware tab, and then click Device Manager.
  3. Click to expand Ports, right-click Printer Port (LPT1), and then click Properties.

Note

If have more than one printer port installed on your computer, click LPT2 or LPT3.

  1. Click the Port Settings tab, click Enable legacy Plug and Play detection, and then click OK.
  2. Restart your computer when you are prompted to do so.

Are you sure the clarion app is using LPT1 and not PRN, which goes back to the dos days? LPT1 and PRN are one and the same in DOS but might be handled differently on your computer.

Although this is a DOS app, it might still be relevant.

There is also the issue of security and AV products which could be putting your app in a sandbox of sorts. Is anything like that running?

Is the printer using SMB1? This was disabled finally last month but might affect some printers which are redirecting LPT1 to network shares using “net use”.

The fact you are not getting an error is unusual because at the very least you should be getting an Access Denied error 5, but no error would suggest the windows api is suggesting its gone to its destination, which could be overridden with net use, and some registry entries.

Customer had a HP inkjet that acted a bit like you describe. The HP installation software never uninstalled properly, and a registry entry caused windows print jobs to be redirected to a non existent printer.

The above are just some of the things I would check.

hth

Try the RUN() command perhaps?

RUN('cmd.exe /c copy ’ & …)