?
Solved

Pass parameters to running application

Posted on 2015-01-29
8
Medium Priority
?
196 Views
Last Modified: 2015-02-06
Hi

I have a Delphi application with a lot of features. I would like to pass a parameter from another windows application (just a couple of small numbers or text) to run one or multiple features in my app. My app,  running app, is going to be idle, waiting for either user input (user running features manually) or input from other application, which is not delphi based and I have limited options to call/execute external applications. I can execute OS commands, so I can start my app with parameters, but the app is already running, so I need to pass some info, for example 2 numbers or a text and a number or 2 simple 20 chars texts.

So
1) I need to have my app ready to receive some parameters and execute menus/features based on received parameters and
2) I need to be able to pass these parameters from other app. - I assume using OS command

Any suggestions how to start?

Thanx
0
Comment
Question by:Delphi_developer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 19

Assisted Solution

by:MerijnB
MerijnB earned 668 total points
ID: 40579261
There are several ways to achieve this, and the best way will probably depend on what and how much data you want to sent from one app to the next. Is there data which is much larger then the 20 characters etc you mentioned.

Are you writing the apps you want to sent these commands from yourself? What languages?
0
 

Author Comment

by:Delphi_developer
ID: 40579616
Well, i really don't need a lot of data. For start, i f i can get 2 integers is great. Maybe at some point I would like to have a record of 30 variables, 25 integers and 5 strings (255 chars max), but that is ideally.
From the other application I can use
1: os command, so I can execute any .bat files that receive parameters and execute 'call' to my app
2: I can call dll, so maybe I can create middle-man (it will be created with delphi)
3: the other app has limited .Net capabilities, so in theory I could execute .Net code that would do the work

My delphi app is mine, so I can create anynkind of interface (stdcall?) I need for this to work.

Currently, I don't need to return any feedback, just 'receiving'.

I hope this gives more info.

Thanks!
0
 
LVL 3

Assisted Solution

by:lopem
lopem earned 664 total points
ID: 40580398
I have a similar problem. I was writing a delphi program that connects to a chess engine vía the standard input/output. The chess engine uses a Universal Chess Interface (UCI), a communication protocol between chess applications and chess GUIs.

I found a component, threated TPipes (http://torry.net/pages.php?id=224) that works perfectly for me. Maybe this can help you.

regards
Manuel Lopez (lopem)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Accepted Solution

by:
Delphi_developer earned 0 total points
ID: 40581124
@MerijnB: you mentioned a couple of solutions are available.. if you can give more details, I would appreciate.

@lopem: Manuel, thank you for the suggestion, although it doesn't fit my problem. Or I can't figure out how to modify it for me.

Right now, I have decided to do it the way I thought I wouldn't need to go:
1. other app will write file with all the info into 'watched' folder
2. My app will watch folder for files and read and execute based on written info in the file
It is not good solution, but this is the only one I can make work right now.

I think I would like to go the way of .Net (C#) <-> Delphi connection, some kind... so, I guess I will have to find a programmer who knows both technologies and can make this work. I understand this is very unique knowledge, so I hope I will find someone.



Thanks!
0
 
LVL 24

Assisted Solution

by:jimyX
jimyX earned 668 total points
ID: 40581164
Hi
Despite the variety of possible ways of doing this, I would pick Client/Server TCP approach (or UDP, depends on what you want to do). You can control your application locally or remotely. You can send commands, others can send as well if you share the communications (If you allow others to transmit to your application). Encryption is possible if you need particular client to connect to the Server. So basically you get flexibility in tackling different aspects.

1) I need to have my app ready to receive some parameters and execute menus/features based on received parameters
Then your app will be a Server. Upon starting, the app will listen for incoming connections on a particular port.
Executing received commands, from clients, based on predefined protocol.

2) I need to be able to pass these parameters from other app. - I assume using OS command
You can use Client/Server approach similar to telnet. The commands can be sent from different applications.
0
 

Author Comment

by:Delphi_developer
ID: 40583015
Thank you all for your suggestions!
I started playing around with SendMessages and WM_COPYDATA, so I have opened a new question here:

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_28608019.html
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 40583428
Hi Delphi_developer, sorry for late reply.
The 3 easiest methods are all mentioned already (sockets (tcp or udp), pipes and messages using WM_COPYDATA).
0
 

Author Closing Comment

by:Delphi_developer
ID: 40593209
This seems to be working so far, although it is not best solution for my problem, so I decided to ask another questions with WM_COPYDATA solution.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month15 days, 11 hours left to enroll

743 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