Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 567
  • Last Modified:

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

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
BeyondBGCM
Asked:
BeyondBGCM
  • 9
  • 6
  • 4
1 Solution
 
QlemoC++ DeveloperCommented:
How will you know which parameters to provide if you don't know the parameters?
0
 
BeyondBGCMAuthor Commented:
yes , is there a way which can extract all available , parameters of the application , exe, so that i can use them.
0
 
QlemoC++ DeveloperCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sarabandeCommented:
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
 
BeyondBGCMAuthor Commented:
but , i don't see those functions there ..... in Windows registry.
0
 
QlemoC++ DeveloperCommented:
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
 
BeyondBGCMAuthor Commented:
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
 
QlemoC++ DeveloperCommented:
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
 
BeyondBGCMAuthor Commented:
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
 
sarabandeCommented:
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
 
BeyondBGCMAuthor Commented:
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
 
BeyondBGCMAuthor Commented:
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
 
QlemoC++ DeveloperCommented:
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
 
BeyondBGCMAuthor Commented:
http://download.exdat.com/file/HP_LaserJet_6L_(PCL).exe/index-9591.html

you can download AllFileToAllFile converter , and check this.
0
 
sarabandeCommented:
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
 
BeyondBGCMAuthor Commented:
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
 
QlemoC++ DeveloperCommented:
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
 
BeyondBGCMAuthor Commented:
hmmm, you have a point.....
0
 
sarabandeCommented:
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 9
  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now