Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send parameter from asp.net/c# to foxpro 1

Status
Not open for further replies.

robnowa

Programmer
Jun 11, 2013
6
SE
Hi!

I've created a simple asp.net project where I can search for customers by name in my SQL database using LINQ Contains(). From there I'd like to open up my VFP9 program the custormer id.

What I have now to test my vfp code:
Normal Windows shortcut, properties:
Target: C:\Data\test.exe "503"
That opens my program and a form I've created and shows me info for ID 503.
In my main.prg: PARAMETERS pcCID .. and later on I send that to my form.
Really simple.

Now if I want to send a different ID shortcut (while my program is still open) it opens up another instance of my program, what I want is to open it up in my already open program so I can view customer information.

How can I send a parameter to my already open program, or do what I want in another way? Any ideas are welcome!
 
You can't send a parameter to an already-open program. The act of receiving the parameter is the first thing that the program does, and it only does it once. You need a different mechanism for telling the VFP program to open another form.

One option would be for the C# program to write the ID to a storage location that the VFP program can access. That location might be a database table, or a text file, or perhaps even an entry in the registry. Whichever method you choose, the VFP program would run a small loop, in which it is constantly looking at that location. The moment it finds a valid ID there, it calls the code to open the form. It would also set the ID to zero, to ensure that it doesn't open the same form again next time round the loop.

Alternatively, the VFP program could run a timer instead of a loop. The timer might fire, say, every 500 ms, which means that the opening of the form would appear almost instantaneous to the user.

Of course, you've got to consider what would happen if the C# program sends an ID while the VFP program is busy doing something else. But that's a design issue rather than a programming problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
If it wouldn't be deprecated you could use DDL, but that is something I think you can't do from asp(x).
In short the topic is interprocess communication via shared memory, pipes. There are several things, but none of them is easy to implement in the VFP EXE. Not as simple as the parameter.

So in short, either live with one instance of your exe per call or do as Mike suggests.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top