473,813 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.cmd buffer, PChar('/c copy
'+ExtractFilePa th(Application. ExeName)+'PRINT ER\ZZ3.PRN
'+dmoMain.PRINT ER+':'), nil, SW_HIDE);

frmStockCardRep ort.QuickRep1.P review;

ShellExecute(0, 'open',Data.cmd buffer, PChar('/c copy
'+ExtractFilePa th(Application. ExeName)+'PRINT ER\ZZ2.PRN
'+dmoMain.PRINT ER+':'), nil, SW_HIDE);

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

Thanks
Jun 27 '08 #1
2 3522
On Mon, 12 May 2008 14:38:01 +0300, "Diego Armando Maradona"
<So*****@Somewh ere.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.cmd buffer, PChar('/c copy
'+ExtractFileP ath(Application .ExeName)+'PRIN TER\ZZ3.PRN
'+dmoMain.PRIN TER+':'), nil, SW_HIDE);

frmStockCardRep ort.QuickRep1.P review;

ShellExecute(0, 'open',Data.cmd buffer, PChar('/c copy
'+ExtractFileP ath(Application .ExeName)+'PRIN TER\ZZ2.PRN
'+dmoMain.PRIN TER+':'), nil, SW_HIDE);

After writing new program on .net, How can I write equivalent of above codes
Check out the System.Diagnost ics.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...@Somewh ere.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.cmd buffer, PChar('/c copy
'+ExtractFilePa th(Application. ExeName)+'PRINT ER\ZZ3.PRN
'+dmoMain.PRINT ER+':'), nil, SW_HIDE);

* * frmStockCardRep ort.QuickRep1.P review;

* * ShellExecute(0, 'open',Data.cmd buffer, PChar('/c copy
'+ExtractFilePa th(Application. ExeName)+'PRINT ER\ZZ2.PRN
'+dmoMain.PRINT ER+':'), 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
2568
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, however, needed the printer name, driver and port. All which were obtainable using the Printer object in VB6. Now in .net, I've tried using the System.Drawing.Printing namespace to do this, but that is unsatisfactory. So I went back to the API...
1
31201
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
5475
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 shdocvw.dll. And there comes the problem. I reference the libraries from my project. For this to work, I put the libraries in the same directory as the application. Now, from my code I try to ShellExecute to a link (to show it in a new window):
4
2517
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 hard time to understand vb syntax. I don't know if anyone in here can point out which is the equivalent object used in c sharp. Translate these two lines to C sharp: Sub Next_Click(Sender As Object, e As EventArgs) Select Case...
0
1837
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, string lpOperation, string lpFile,
0
1601
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, string lpOperation, string lpFile,
0
1860
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 ) } This always worked without problems until... We have modified the application so that it now contains some managed C++ and C# code (in dll's). The call to ShellExecute is in an unmanaged C++ dll. When trying
5
11014
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
10745
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 computer is set on. I've searched the web and nothing solid. I did get the following VBA code and it doesn't seem to work. If anyone can help me i'd appreciate it. From the code below txtImageNote is a field on the form that displays the path to...
0
9734
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10667
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10407
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9222
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5568
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5705
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3885
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.