🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16096

Re: get command line into bcb

#16096
From: Remy Lebeau (TeamB)
Date: Fri, 30 May 2003 07:45
30 lines
2310 bytes
"jc" <jconnell@gci.net> wrote in message
news:3ed6ea80$1@newsgroups.borland.com...

> this is off topic (i think) but i realized i was on the
> wrong track (for reasons that will be obvious)

You are on the right track - just missing some additional details...

> what i need is when i click on a file in the file_explorer
> that file opens in a single instance of my prog.

Your program must first detect if a previous instance exists, and if
detected then send the new file path (available from the new command line)
to the previous instance before then shutting itself down without doing
anything else.  If the previous instance is not detected then just process
the file path normally.

To actually send the file path to the previous instance, you need to set up
some kind of IPC (inter-process communication) between the two.  The easily
way would be to use FindWindow() and SendMessage() to send the previous
instance a WM_COPYDATA message containing the file path.  Then you have to
code your window to intercept WM_COPYDATA messages and extract the file path
from them, if available.

Other IPC techniques include named pipes, TCP sockets, COM, RPC (Remote
Procedure Call), etc.


Gambit
Technical Details
Message-ID: <3ed70b6d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3ed6c57a$1@newsgroups.borland.com> <3ed6c7ad$1@newsgroups.borland.com> <3ed6e5c5$1@newsgroups.borland.com> <3ed6ea80$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,8f3a84c909afa32c
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-30 01:08:56 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ed6c57a$1@newsgroups.borland.com> <3ed6c7ad$1@newsgroups.borland.com> <3ed6e5c5$1@newsgroups.borland.com> <3ed6ea80$1@newsgroups.borland.com>
Subject: Re: get command line into bcb
Date: Fri, 30 May 2003 00:45:26 -0700
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3ed70b6d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1054280557 207.175.226.26 (30 May 2003 00:42:37 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!border3.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail