Re: Calling procedure on another software

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Ken Halter (Ken_Halter_at_Use_Sparingly_Hotmail.com)
Date: 05/13/04


Date: Thu, 13 May 2004 09:37:42 -0700

Robert wrote:
> Hi,
>
> I'm trying to find a way to make a software react when an instance is
> already running.
> Here what i want:
>
> Execute a software called Test1.
> Execute this software again.
> The second instance should send a message to the first instance.
> Then, the second instance stop executing.
>
> I put this code in the Form_Load procedure:
> If app.PrevInstance Then
> SaveTitle = app.title
> app.title = "... duplicate instance."
> Me.Caption = "... duplicate instance."
> AppActivate SaveTitle
> ''''' Right here, i need to execute app.PrevInstance.SomeProcedure
> End
> End If
>
> Someone know how to run the procedure on the first instance?

What you'll need to do is add command line support to the app. That
second instance can send a command line to the first. VB's built in
Command$ variable will contain any command line params you send to an app.

There are quite a few examples showing how to do this. Here's a great
way.. it's a bit on the "advanced" side.

Registering File Associations and Passing Command Line Parameters to an
Existing App Instance
http://www.vbaccelerator.com/home/VB/Code/Libraries/Shell_Projects/Registering_File_Associations/article.asp

If you want an easy way, I have a sample that may help. It's a bit
different. Very easy. Just drop a control (included) on the form and
"talk" to other apps that also contain the control.

Communicate with another instance of your app
http://www.vbsight.com/Code.htm

It's not as "rock solid" as the first sample but for most situations, it
works great.

> It will really help me, and i greatly appreciate your help.
>
> Thanks,
>
> Robert
>
>

-- 
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..


Relevant Pages

  • Re: Calling procedure on another software
    ... >> The second instance should send a message to the first instance. ... > What you'll need to do is add command line support to the app. ... > Command$ variable will contain any command line params you send to an app. ...
    (microsoft.public.vb.general.discussion)
  • Re: Pass in additional command line arguments to a single instance app
    ... command line arguments, so it must be the way to go. ... implementing a DDE server looks awfully complicated, ... Explorer to send the filename to my app. ... because the first instance just finished its processing and is closing its ...
    (microsoft.public.vc.language)
  • Re: pygtk and long running process
    ... > Daniel Cer wrote: ... >> Robert wrote: ... >>> I have a command line app that can take up to 20 minutes to complete and ... >>> command I use to a) invoke the command and b) how to capture it's out put ...
    (comp.lang.python)
  • Re: Shell launch with multiple files
    ... from explorer and parse the file using Command$ inside the App and that ... If I highlicht a bunch of files in explorer and launch then I get ... separate instances of my App. ... Is there a way of getting all the files sent to the first instance of the ...
    (microsoft.public.vb.general.discussion)
  • Re: Programming "efficiently" on given hardware - what does it mean really?
    ... >> in a command line world again. ... > launching an app, selecting menu items, hoping it does what ... In a GUI environment, use a RAD tool to whip up a quick, simple UI ...
    (comp.programming)