Good morning,
I have set up a Windows 2000 Terminal Services system, and found it to be
a nice environment, and works very well, for Win32 applications. I do not
recommend using a command prompt / DOS script for printing though, as that
is probably one of the single most problematic areas for Terminal
Services. Instead, either load it up in a text editor that you can
automate and print from there, or try to print directly from VB. If you
need to create the temp file, and cannot print directly from your
application, then reload it into a Win32 application.
On Terminal Service, I can't emphasize it enough, AVOID DOS LIKE THE
PLAGUE! DOS application execution is probably the single easiest method to
destabilize the system.
If you have any more questions, feel free to contact me directly.
Gary Klesczewski
Northeast Utilities
klescgl@n...
>
> hi everybody,
>
> We are here doing an application in VB 6, which would run on a
> Cytrix - Terminal Server. The box has Win2000 installed in it. Many of
> the terminals, which would access it, has to print the reports in our
> application using their own Default Printer configuraton settings. In
> my application, for some of the reports, whenever the user clicks on a
> "Print button", I would get all the records in a text file using the
> following code:
>
> ' ------ Code ---------
> Dim fso as New FileSystemObject
> Dim txt as TextObjectStream
>
> Set txt =3D fso.CreateTextFile("C:\printfile.prn",ForAppending)
> txt.Write MyRecordsetObject.GetString(adClipString," ",vbCrLf,"")
> txt.Close
> '------ End of the Code --------
>
> The problem is, I want to print this file in DOS Mode,
> programatically. I also created a Batch file called "Printer.bat" and
> had the following code:
>
> Type %1 > PRN
>
> And in my VB app, I used the Shell function to call the Batch file, with
> the PrintFile.PRN (created above) as the parameter. I have put the batch
> file in their Win2000 box (since my application is setup there only) and
> so it would work fine (means it would print in DOS Mode) in that
> machine. But there are some terminals which uses other printers as their
> Default Printer. So, is there any way that my VB app, when executed on
> the Terminal Server, saves the file (either in the Terminal Server or in
> their local disk) and then prints the file in their own respective
> printer settings?
>
> Hope my question is clearer,
>
> Thanks in advance,
>
> N.T.GOPALAKRISHNAN
>