Solved

Passing parameters to a Windows application through C# Process.start

Posted on 2014-03-05
19
497 Views
Last Modified: 2014-04-03
hi

I want to call a Windows Application(a GUI) from C# Process.start, can you suggest me , how can i pass the parameters to the same , it is a third party application , so i myself don't know what are the parameters of the same .
0
Comment
Question by:BeyondBGCM
  • 9
  • 6
  • 4
19 Comments
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
How will you know which parameters to provide if you don't know the parameters?
0
 

Author Comment

by:BeyondBGCM
Comment Utility
yes , is there a way which can extract all available , parameters of the application , exe, so that i can use them.
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
No. Some applications allow /? or /help to display a list of available parameters, but that is no requirement for apps. Some do if you do not provide any parameter, or a wrong one.
Otherwise you have to find a manual for the application you want to call.
0
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
if the application is file oriented it often accepts a filename as first parameter.

if the application is associated with a file type you could/should find the functions it offers by right-clicking on a file of that type in the windows explorer. those functions like 'open', 'print', ... you also can find in the windows registry.

if so, you could use winapi function ShellExecute to call these functions programmatically.

Sara
0
 

Author Comment

by:BeyondBGCM
Comment Utility
but , i don't see those functions there ..... in Windows registry.
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
1. Try the /help
2. get the docu
3. Use e.g. strings from www.sysinternals.com to extract all strings contained in the exe file, to get an idea of parameter names
4. contact the vendor

If you have exhausted all those options, you are lost.
0
 

Author Comment

by:BeyondBGCM
Comment Utility
I still believe there should be some way of calling a GUI EXE in our C# code , if not , can i extract the code given in the EXE , to use in my application.
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
GUI apps are not thought to get automated input. There are exceptions like Office, but those implement a specific interface via COM or similar.
Sometimes you can help yourself by using the Sendkey approach: A simulation of key presses, but that is unreliable.

If you are able to extract the core features you need, that's certainly the best option here.
0
 

Author Comment

by:BeyondBGCM
Comment Utility
with above discussion , i can conclude , that a GUI exe is not possible to be executed from a C# application. if i am correct , then please close this thread.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 32

Expert Comment

by:sarabande
Comment Utility
i can conclude , that a GUI exe is not possible to be executed from a C# application
that is not correct. for a windows application there are multiple common ways to get automated and all these ways could be issued by a c# program if necessary:

1. automation by COM interface
2. automation by .NET services
3. shell automation to a file type and functions like 'open', 'print', ...
4. automation by command line interface
5. automation by hooking into windows messages.

the latter could only done if you have the appropriate rights or if it is your own program which you want to hook. for example test tools like autoit can be used to emulate user interaction to any windows based gui application.

it seems to me it is the lack of information you have which prevents from automation and not so much technical issues. it could help if you tell which application you want to automate.

Sara
0
 

Author Comment

by:BeyondBGCM
Comment Utility
hi Sara

you can take example of any GUI app, such as PDFToWord , freely available on net.

https://www.google.co.in/url?q=https://www.pdftoword.com/&sa=U&ei=RsoqU_XwL4bGrAeJ0YDYAg&ved=0CBsQFjAA&usg=AFQjCNGzKM5m370YTf43AnjxzVMo5ptSwg

now , how can i pass the arguments , to it using a C# application , and can call it's execute method.
0
 

Author Comment

by:BeyondBGCM
Comment Utility
the link i have shared is one example only, you can take any application , which has a GUI , a desktop application , and which we can automate in C# application.

please share your comments, for this.
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
You are so wrong with "you can take any application". The solution is always adapted to the specific application you want to control. Besides what we've told you, there is nothing more to say.
0
 

Author Comment

by:BeyondBGCM
Comment Utility
http://download.exdat.com/file/HP_LaserJet_6L_(PCL).exe/index-9591.html

you can download AllFileToAllFile converter , and check this.
0
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
as told you need to get the information which kind of automation is possible by the vendor of the application. nitro pdf (pdftoword) for example have a free trial of their desktop application and a good faq. they also have a server version of their product what means that there is a well-defined interface where clients can pass their files to server and get it back in the required form.

Sara
0
 

Author Comment

by:BeyondBGCM
Comment Utility
yes , we are on same page now (almost).
1. the desktop version which you are saying is the one , which i want to call using C# , as mostly freeware(not free trial) software are of desktop version, and if i want to use them directly in my programme , i need to pass the parameter and also call their execute command.

2. it is because i have many files to process at once , so i will create a console application , which will execute this code, and will process it for 100 files at once.
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
Comment Utility
There is a reason the software is free, and often it is because you can't automate or otherwise mass-misuse it. Automation is a business use.
0
 

Author Comment

by:BeyondBGCM
Comment Utility
hmmm, you have a point.....
0
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
to add: the free version of the conversion utility is a web-based service and allows 5 free conversions a month per user. it is pretty well possible (though beyond my expertise) to call those web-services programmatically. however, if they didn't make a mistake the 5 trials would apply nevertheless.

Sara
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoresClump  challenge 31 107
nestparen challenge 4 55
topping1 challenge 7 48
Arduino EDI - Programming language 3 60
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will show, step by step, how to integrate R code into a R Sweave document
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now