>Hi Everyone,
>
>Here's the problem:
>
>I need to print to an old daisy wheel printer (NEC spinwriter) on a special form (8.5" X 7.0 tractor feed). The printer manufacturer does not have a printer driver available for this printer. They suggested using the Generic Text driver that comes with Windows 95. I set up a custom form for the Generic Text printer but when I send the report to the printer it ignores the length I set up and prints as if the form is 8.5" X 11".
>
>So I tried to find a way to stream the data directly to the printer using the SET DEVICE TO PRINT and @ x,y SAY commands like the old DOS printouts. This works until my x coordinate reaches around 4000. VFP doesn't like commands like @ 4001,1 SAY 'Hello World'.
>
>Next, I tried sending the output to a text file using the low level file functions. Then I used the RUN command to call the DOS print command like this: RUN PRINT C:\MYFILE.TXT. This works on my workstation (I'm running NTWS 4.0) but when I try this on a W95 WS I get 'bad commad or file name.'
>
>We are using this printer to print on forms that have membership cards stuck on them. A dot-matrix printer will not print on these cards.
>
>Does anyone have any ideas?
>
I'd try using the VFP native COPY FILE command, or RUN COMMAND /C COPY /B C:\MYFILE.TXT PRN; my preference is to use the Win32 API CopyFile() call, which works on both platforms unambiguously, and doesn't seem to be as picky as the VFP COPY FILE in some cases:
DECLARE INTEGER CopyFile IN WIN32API ;
STRING @ cSourceFile, ;
STRING @ cDest, ;
INTEGER bFailIfExits
IF CopyFile(cSourceFile,'PRN',0) = 1
ELSE
ENDIF
Don't try using CopyFileEx(), since it needs a callback function, which isn't doable in just native VFP code AFAIK.
>TIA,
>
>George