473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Equivalent of Shellexecute in csharp ?

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
2 3477
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marcel Sammut | last post by:
Greetings, I am converting a VB6 application to .net and am having troubles trying to print a document directley to the printer. My VB6 app used the API ShellExecute method to accomplish this,...
1
by: Paul Speranza | last post by:
Does anyone know what the C# equivalent of the shell command is? I want to play an mp3 file using the users default player. Regards, Paul Speranza
3
by: Wiktor Zychla | last post by:
I have a problem I cannot solve. My application hosts IE activex control. I follow the standard procedure: I just aximp shdocvw.dll. Note that this gives you two files: axshdocvw.dll and...
4
by: Hai Nguyen | last post by:
I'm learning C sharp and do not like vb much. I'm creatiing a wepage using panel to test myself. I tried to use these code below, which is written in VB, and to transform them to c sharp but I got...
0
by: the_openFace | last post by:
I'm trying to display the shell's property page for various files and I'm using this code: class Win32Shell { // ... other stuff here public static extern Int32 ShellExecute( Int32 hwnd,...
0
by: the openBack | last post by:
I'm trying to display the shell's property page for various files and I'm using this code: class Win32Shell { // ... other stuff here public static extern Int32 ShellExecute( Int32 hwnd,...
0
by: David | last post by:
We have an mfc application in which we use ShellExecute to launch the browser with an initial web site. {ShellExecute( NULL, "open", "http://www.SomeWebSite.com", NULL, NULL, SW_SHOWNORMAL ) } ...
5
by: =?Utf-8?B?VG9tYXM=?= | last post by:
Hello, Somebody knows which is the equivalent one in C++/CLI ? HINSTANCE ShellExecute(HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd
2
by: John Smith | last post by:
Hi, I have an access database form with an image. I'm trying to create an onclick event on the image so that when a user clicks on the image it opens that file with the default viewer the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.