Re: Calling procedure on another software

From: Robert (robert_at_jcle_____.com)
Date: 05/13/04


Date: Thu, 13 May 2004 13:22:32 -0400

Hi,

Thanks a lot for these 2 samples.

I have to look more into this. But, i've think about somethings.

It seem easier to add a Client/Server control on the form. The first
instance open the server. When the second instance open, it only send a
"query" to the first instance.
The server on the instance accept and execute what's requested.

Is this a good way?

I've already work on client/server on VB, C++, Java... So i think i'll go
for this way.

Thanks a lot for your help, and i'll continue reading the website.

"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:OizbeiQOEHA.1392@TK2MSFTNGP09.phx.gbl...
> 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/Registeri
ng_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
    ... Robert wrote: ... > 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: cant bring "single instance" tray app to foreground
    ... frontmost/active window. ... anything since (because this is a trap app) the main window ... the second instance of your app needs to ... call AllowSetForegroundWindowso that the first instance ...
    (microsoft.public.vc.mfc)
  • Re: Multiple Instances of an App
    ... instances the first instance wins and therefore the running instance (the ... mutex owner relinquishes the mutex. ... So, send the message from the second instance to the first, as described ... then there is an app. ...
    (microsoft.public.dotnet.languages.csharp)
  • 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)
  • Detecting prior instances of an application
    ... app) if it is run again. ... First instance starts and begins processing. ... Second instance is kicked off before first instance finishes. ... Second instance detects first instance and signals first instance ...
    (microsoft.public.dotnet.languages.vb)