By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,224 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,224 IT Pros & Developers. It's quick & easy.

Equivalent of Shellexecute in csharp ?

P: n/a
Hi,

I am using toshiba tec sx8 thermal printer for printing our labels,

in My old Delphi application I was using such code;

ShellExecute(0,'open',Data.cmdbuffer, PChar('/c copy
'+ExtractFilePath(Application.ExeName)+'PRINTER\ZZ 3.PRN
'+dmoMain.PRINTER+':'), nil, SW_HIDE);

frmStockCardReport.QuickRep1.Preview;

ShellExecute(0,'open',Data.cmdbuffer, PChar('/c copy
'+ExtractFilePath(Application.ExeName)+'PRINTER\ZZ 2.PRN
'+dmoMain.PRINTER+':'), nil, SW_HIDE);

After writing new program on .net, How can I write equivalent of above codes
?

Thanks
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 12 May 2008 14:38:01 +0300, "Diego Armando Maradona"
<So*****@Somewhere.Co.Ukwrote:
>Hi,

I am using toshiba tec sx8 thermal printer for printing our labels,

in My old Delphi application I was using such code;

ShellExecute(0,'open',Data.cmdbuffer, PChar('/c copy
'+ExtractFilePath(Application.ExeName)+'PRINTER\Z Z3.PRN
'+dmoMain.PRINTER+':'), nil, SW_HIDE);

frmStockCardReport.QuickRep1.Preview;

ShellExecute(0,'open',Data.cmdbuffer, PChar('/c copy
'+ExtractFilePath(Application.ExeName)+'PRINTER\Z Z2.PRN
'+dmoMain.PRINTER+':'), nil, SW_HIDE);

After writing new program on .net, How can I write equivalent of above codes
Check out the System.Diagnostics.Process class, e.g. its static

public static Process Start(string fileName, string arguments)

overload.

You may want to explore other techniques for printing than sending
files to the printer port via "cmd copy /c filename lpt1:" (or
similar) though.

Regards,
Gilles [MVP].

(Please reply to the group, not via email.
Find my MVP profile with past articles / downloads here:
http://www.gilleskohl.de/mvpprofile.htm)

Jun 27 '08 #2

P: n/a
On May 12, 7:38*am, "Diego Armando Maradona" <Some...@Somewhere.Co.Uk>
wrote:
Hi,

I am using toshiba tec sx8 thermal printer for printing our labels,

in My old Delphi application I was using such code;

* * ShellExecute(0,'open',Data.cmdbuffer, PChar('/c copy
'+ExtractFilePath(Application.ExeName)+'PRINTER\ZZ 3.PRN
'+dmoMain.PRINTER+':'), nil, SW_HIDE);

* * frmStockCardReport.QuickRep1.Preview;

* * ShellExecute(0,'open',Data.cmdbuffer, PChar('/c copy
'+ExtractFilePath(Application.ExeName)+'PRINTER\ZZ 2.PRN
'+dmoMain.PRINTER+':'), nil, SW_HIDE);

After writing new program on .net, How can I write equivalent of above codes
?

Thanks
There is a Process class you can use.

Additiobnally try to print directly from C#, There is a serial port
class that I think you can use for that.
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.